mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 08:53:56 -05:00
switched to dwm
This commit is contained in:
parent
f543cd8e23
commit
20b8b3c80d
39 changed files with 8298 additions and 0 deletions
109
suckless/dwm-patches/13-fade-inactive.diff
Normal file
109
suckless/dwm-patches/13-fade-inactive.diff
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 56659ef..20312c7 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,6 +7,9 @@ static const unsigned int gappx = 10; /* default gap between windows i
|
||||
static const unsigned int snap = 32; /* snap pixel */
|
||||
static const int showbar = 1; /* 0 means no bar */
|
||||
static const int topbar = 1; /* 0 means bottom bar */
|
||||
+static const double activeopacity = 1.0f; /* Window opacity when it's focused (0 <= opacity <= 1) */
|
||||
+static const double inactiveopacity = 0.875f; /* Window opacity when it's inactive (0 <= opacity <= 1) */
|
||||
+static Bool bUseOpacity = True; /* Starts with opacity on any unfocused windows */
|
||||
static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm willcalculate bar height, >= 1 means dwm will user_bh as bar height */
|
||||
static const int focusonwheel = 0;
|
||||
static const int vertpad = 10; /* vertical padding of bar */
|
||||
@@ -87,6 +90,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||
{ MODKEY, XK_Return, zoom, {0} },
|
||||
{ MODKEY, XK_Tab, view, {0} },
|
||||
+ { MODKEY, XK_a, toggleopacity, {0} },
|
||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 9dc53d0..c77ed1b 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -68,7 +68,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
|
||||
enum { SchemeNorm, SchemeSel }; /* color schemes */
|
||||
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||
- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||
+ NetWMWindowTypeDialog, NetClientList, NetWMWindowsOpacity, NetLast }; /* EWMH atoms */
|
||||
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
|
||||
ClkRootWin, ClkLast }; /* clicks */
|
||||
@@ -191,6 +191,7 @@ static void maprequest(XEvent *e);
|
||||
static void monocle(Monitor *m);
|
||||
static void movemouse(const Arg *arg);
|
||||
static Client *nexttiled(Client *c);
|
||||
+static void opacity(Client *c, double opacity);
|
||||
static void pop(Client *c);
|
||||
static void propertynotify(XEvent *e);
|
||||
static void quit(const Arg *arg);
|
||||
@@ -221,6 +222,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
+static void toggleopacity(const Arg *arg);
|
||||
static void togglefullscr(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
@@ -812,6 +814,7 @@ focus(Client *c)
|
||||
XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
|
||||
}
|
||||
setfocus(c);
|
||||
+ opacity(c, activeopacity);
|
||||
} else {
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
||||
@@ -1194,6 +1197,18 @@ nexttiled(Client *c)
|
||||
return c;
|
||||
}
|
||||
|
||||
+void
|
||||
+opacity(Client *c, double opacity)
|
||||
+{
|
||||
+ if(bUseOpacity && opacity > 0 && opacity < 1) {
|
||||
+ unsigned long real_opacity[] = { opacity * 0xffffffff };
|
||||
+ XChangeProperty(dpy, c->win, netatom[NetWMWindowsOpacity], XA_CARDINAL,
|
||||
+ 32, PropModeReplace, (unsigned char *)real_opacity,
|
||||
+ 1);
|
||||
+ } else
|
||||
+ XDeleteProperty(dpy, c->win, netatom[NetWMWindowsOpacity]);
|
||||
+}
|
||||
+
|
||||
void
|
||||
pop(Client *c)
|
||||
{
|
||||
@@ -1677,6 +1692,7 @@ setup(void)
|
||||
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
|
||||
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
|
||||
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
|
||||
+ netatom[NetWMWindowsOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
|
||||
/* init cursors */
|
||||
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
|
||||
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
|
||||
@@ -1857,6 +1873,14 @@ togglefullscr(const Arg *arg)
|
||||
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
|
||||
}
|
||||
|
||||
+void
|
||||
+toggleopacity(const Arg *arg) {
|
||||
+ bUseOpacity = !bUseOpacity;
|
||||
+ for (Monitor* m = mons; m; m = m->next)
|
||||
+ for (Client* c = m->clients; c; c = c->next)
|
||||
+ opacity(c, (bUseOpacity && c != selmon->sel) ? inactiveopacity : activeopacity);
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
@@ -1890,6 +1914,7 @@ unfocus(Client *c, int setfocus)
|
||||
if (!c)
|
||||
return;
|
||||
grabbuttons(c, 0);
|
||||
+ opacity(c, inactiveopacity);
|
||||
lastfocused = c;
|
||||
if (setfocus) {
|
||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||
Loading…
Add table
Add a link
Reference in a new issue