diff options
author | Leonardo Murça <leo@leomurca.xyz> | 2023-12-28 13:42:15 -0300 |
---|---|---|
committer | Leonardo Murça <leo@leomurca.xyz> | 2023-12-28 13:42:15 -0300 |
commit | c7573d54dd5c84a693922fa816da4d5b82eee1f6 (patch) | |
tree | dd429d8ac7e84a3cb66d225150d2dfb62c4ddac3 | |
parent | b9e8fbcb51734d702286634b260643fbf6239391 (diff) | |
parent | 7d03db6aabfecd819d36469ac8a444b35b8ca7f2 (diff) |
-rw-r--r-- | config.def.h | 14 | ||||
-rw-r--r-- | config.h | 14 | ||||
-rw-r--r-- | dwm-attachbelow-6.2.diff | 96 |
3 files changed, 24 insertions, 100 deletions
diff --git a/config.def.h b/config.def.h index c8baa68..e759b34 100644 --- a/config.def.h +++ b/config.def.h @@ -1,5 +1,11 @@ /* See LICENSE file for copyright and license details. */ #include <X11/XF86keysym.h> + + +/* Constants */ +#define TERMINAL "st" +#define BROWSER "brave" + /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ @@ -59,14 +65,16 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *termcmd[] = { "st", "-e", "/bin/zsh", NULL }; +static const char *termcmd[] = { TERMINAL, "-e", "/bin/zsh", NULL }; +static const char *browsercmd[] = { BROWSER, NULL }; static const char *togglemutecmd[] = { "/usr/bin/wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL }; static const char *upvolcmd[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+", NULL }; static const char *downvolcmd[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL }; static const char *updisplaybrightnesscmd[] = { "/usr/bin/brightnessctl", "set", "10%+", NULL }; static const char *downdisplaybrightnesscmd[] = { "/usr/bin/brightnessctl", "set", "10%-", NULL }; static const char *keyboardbacklighttogglecmd[] = { "keyboard_backlight", NULL }; -static const char *fileexplorercmd[] = {"st", "-t lf", "lf", NULL }; +static const char *fileexplorercmd[] = { TERMINAL, "-e", "lfub", NULL }; +static const char *lockscreencmd[] = { "/bin/sh", "-c", "slock & xset dpms force off", NULL }; static const int attachbelow = 1; /* 1 means attach after the currently active window */ static const Key keys[] = { @@ -79,6 +87,8 @@ static const Key keys[] = { { 0, XF86XK_MonBrightnessUp, spawn, {.v = updisplaybrightnesscmd} }, { 0, XF86XK_MonBrightnessDown, spawn, {.v = downdisplaybrightnesscmd} }, { MODKEY, XK_e, spawn, {.v = fileexplorercmd} }, + { MODKEY, XK_w, spawn, {.v = browsercmd} }, + { MODKEY|ShiftMask, XK_l, spawn, {.v = lockscreencmd} }, { MOD2KEY, XK_space, spawn, {.v = keyboardbacklighttogglecmd} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, @@ -1,5 +1,11 @@ /* See LICENSE file for copyright and license details. */ #include <X11/XF86keysym.h> + + +/* Constants */ +#define TERMINAL "st" +#define BROWSER "brave" + /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ @@ -59,14 +65,16 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; -static const char *termcmd[] = { "st", "-e", "/bin/zsh", NULL }; +static const char *termcmd[] = { TERMINAL, "-e", "/bin/zsh", NULL }; +static const char *browsercmd[] = { BROWSER, NULL }; static const char *togglemutecmd[] = { "/usr/bin/wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL }; static const char *upvolcmd[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+", NULL }; static const char *downvolcmd[] = { "/usr/bin/wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL }; static const char *updisplaybrightnesscmd[] = { "/usr/bin/brightnessctl", "set", "10%+", NULL }; static const char *downdisplaybrightnesscmd[] = { "/usr/bin/brightnessctl", "set", "10%-", NULL }; static const char *keyboardbacklighttogglecmd[] = { "keyboard_backlight", NULL }; -static const char *fileexplorercmd[] = {"st", "-t lf", "lf", NULL }; +static const char *fileexplorercmd[] = { TERMINAL, "-e", "lfub", NULL }; +static const char *lockscreencmd[] = { "/bin/sh", "-c", "slock & xset dpms force off", NULL }; static const int attachbelow = 1; /* 1 means attach after the currently active window */ static const Key keys[] = { @@ -79,6 +87,8 @@ static const Key keys[] = { { 0, XF86XK_MonBrightnessUp, spawn, {.v = updisplaybrightnesscmd} }, { 0, XF86XK_MonBrightnessDown, spawn, {.v = downdisplaybrightnesscmd} }, { MODKEY, XK_e, spawn, {.v = fileexplorercmd} }, + { MODKEY, XK_w, spawn, {.v = browsercmd} }, + { MODKEY|ShiftMask, XK_l, spawn, {.v = lockscreencmd} }, { MOD2KEY, XK_space, spawn, {.v = keyboardbacklighttogglecmd} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, diff --git a/dwm-attachbelow-6.2.diff b/dwm-attachbelow-6.2.diff deleted file mode 100644 index 1562b38..0000000 --- a/dwm-attachbelow-6.2.diff +++ /dev/null @@ -1,96 +0,0 @@ -diff --git a/config.def.h b/config.def.h -index 1c0b587..cb8053a 100644 ---- a/config.def.h -+++ b/config.def.h -@@ -35,6 +35,7 @@ static const Rule rules[] = { - static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ - static const int nmaster = 1; /* number of clients in master area */ - static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ -+static const int attachbelow = 1; /* 1 means attach after the currently active window */ - - static const Layout layouts[] = { - /* symbol arrange function */ -diff --git a/dwm.1 b/dwm.1 -index 13b3729..fb6e76c 100644 ---- a/dwm.1 -+++ b/dwm.1 -@@ -29,6 +29,9 @@ color. The tags of the focused window are indicated with a filled square in the - top left corner. The tags which are applied to one or more windows are - indicated with an empty square in the top left corner. - .P -+The attach below patch makes newly spawned windows attach after the currently -+selected window -+.P - dwm draws a small border around windows to indicate the focus state. - .SH OPTIONS - .TP -diff --git a/dwm.c b/dwm.c -index 4465af1..bd715a2 100644 ---- a/dwm.c -+++ b/dwm.c -@@ -147,6 +147,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac - static void arrange(Monitor *m); - static void arrangemon(Monitor *m); - static void attach(Client *c); -+static void attachBelow(Client *c); - static void attachstack(Client *c); - static void buttonpress(XEvent *e); - static void checkotherwm(void); -@@ -405,6 +406,21 @@ attach(Client *c) - c->next = c->mon->clients; - c->mon->clients = c; - } -+void -+attachBelow(Client *c) -+{ -+ //If there is nothing on the monitor or the selected client is floating, attach as normal -+ if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating) { -+ attach(c); -+ return; -+ } -+ -+ //Set the new client's next property to the same as the currently selected clients next -+ c->next = c->mon->sel->next; -+ //Set the currently selected clients next property to the new client -+ c->mon->sel->next = c; -+ -+} - - void - attachstack(Client *c) -@@ -1062,7 +1078,10 @@ manage(Window w, XWindowAttributes *wa) - c->isfloating = c->oldstate = trans != None || c->isfixed; - if (c->isfloating) - XRaiseWindow(dpy, c->win); -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, - (unsigned char *) &(c->win), 1); -@@ -1417,7 +1436,10 @@ sendmon(Client *c, Monitor *m) - detachstack(c); - c->mon = m; - c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - focus(NULL); - arrange(NULL); -@@ -1897,7 +1919,10 @@ updategeom(void) - m->clients = c->next; - detachstack(c); - c->mon = mons; -- attach(c); -+ if( attachbelow ) -+ attachBelow(c); -+ else -+ attach(c); - attachstack(c); - } - if (m == selmon) |