diff options
| -rw-r--r-- | config.h | 38 | ||||
| -rw-r--r-- | dwm.c | 12 | ||||
| -rw-r--r-- | patches/dwm-focusonnetactive-6.2.diff | 57 |
3 files changed, 85 insertions, 22 deletions
@@ -3,7 +3,7 @@ /* Constants */ #define TERMINAL "st" #define TERMCLASS "St" -#define BROWSER "librewolf" +#define BROWSER "firefox" /* appearance */ static unsigned int borderpx = 3; /* border pixel of windows */ @@ -21,7 +21,7 @@ static char normbgcolor[] = "#222222"; static char normbordercolor[] = "#444444"; static char normfgcolor[] = "#bbbbbb"; static char selfgcolor[] = "#eeeeee"; -static char selbordercolor[] = "#770000"; +static char selbordercolor[] = "#17293d"; static char selbgcolor[] = "#005577"; static char *colors[][3] = { /* fg bg border */ @@ -50,6 +50,7 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating isterminal noswallow monitor */ + { "Wfica", NULL, NULL, 0, 0, 0, 0, -1 }, { "Gimp", NULL, NULL, 1 << 8, 0, 0, 0, -1 }, { TERMCLASS, NULL, NULL, 0, 0, 1, 0, -1 }, { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, @@ -152,10 +153,10 @@ static const Key keys[] = { TAGKEYS( XK_9, 8) { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -44 $(pidof dwmblocks)") }, - { MODKEY|ShiftMask, XK_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%-; kill -44 $(pidof dwmblocks)") }, - { MODKEY, XK_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -44 $(pidof dwmblocks)") }, - { MODKEY|ShiftMask, XK_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%+; kill -44 $(pidof dwmblocks)") }, + { MODKEY, XK_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; pkill -RTMIN+10 dwmblocks") }, + { MODKEY|ShiftMask, XK_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%-; pkill -RTMIN+10 dwmblocks") }, + { MODKEY, XK_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; pkill -RTMIN+10 dwmblocks") }, + { MODKEY|ShiftMask, XK_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%+; pkill -RTMIN+10 dwmblocks") }, { MODKEY, XK_BackSpace, spawn, {.v = (const char*[]){ "sysact", NULL } } }, { MODKEY|ShiftMask, XK_BackSpace, spawn, {.v = (const char*[]){ "sysact", NULL } } }, @@ -163,7 +164,7 @@ static const Key keys[] = { /* { MODKEY|ShiftMask, XK_Tab, spawn, SHCMD("") }, */ { MODKEY, XK_q, killclient, {0} }, { MODKEY|ShiftMask, XK_q, spawn, {.v = (const char*[]){ "sysact", NULL } } }, - { MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, NULL } } }, + { MODKEY, XK_w, spawn, {.v = (const char*[]){ BROWSER, "https://google.com", NULL } } }, { MODKEY|ShiftMask, XK_w, spawn, {.v = (const char*[]){ TERMINAL, "-e", "sudo", "nmtui", NULL } } }, { MODKEY, XK_e, spawn, SHCMD(TERMINAL " -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook 2>/dev/null") }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD(TERMINAL " -e abook -C ~/.config/abook/abookrc --datafile ~/.config/abook/addressbook") }, @@ -179,8 +180,8 @@ static const Key keys[] = { { MODKEY|ShiftMask, XK_i, setlayout, {.v = &layouts[7]} }, /* centeredfloatingmaster */ { MODKEY, XK_o, incnmaster, {.i = +1 } }, { MODKEY|ShiftMask, XK_o, incnmaster, {.i = -1 } }, - { MODKEY, XK_p, spawn, {.v = (const char*[]){ "mpc", "toggle", NULL } } }, - { MODKEY|ShiftMask, XK_p, spawn, SHCMD("mpc pause; pauseallmpv") }, + { MODKEY, XK_p, spawn, SHCMD("mpc toggle; pkill -RTMIN+11 dwmblocks;") }, + { MODKEY|ShiftMask, XK_p, spawn, SHCMD("mpc pause; pauseallmpv; pkill -RTMIN+11 dwmblocks;") }, { MODKEY, XK_bracketleft, spawn, {.v = (const char*[]){ "mpc", "seek", "-10", NULL } } }, { MODKEY|ShiftMask, XK_bracketleft, spawn, {.v = (const char*[]){ "mpc", "seek", "-60", NULL } } }, { MODKEY, XK_bracketright, spawn, {.v = (const char*[]){ "mpc", "seek", "+10", NULL } } }, @@ -212,16 +213,16 @@ static const Key keys[] = { { MODKEY, XK_z, incrgaps, {.i = +3 } }, /* { MODKEY|ShiftMask, XK_z, spawn, SHCMD("") }, */ { MODKEY, XK_x, incrgaps, {.i = -3 } }, - /* { MODKEY|ShiftMask, XK_x, spawn, SHCMD("") }, */ + { MODKEY|ShiftMask, XK_x, spawn, {.v = (const char*[]){ "kx", NULL } } }, { MODKEY, XK_c, spawn, {.v = (const char*[]){ TERMINAL, "-e", "profanity", NULL } } }, - /* { MODKEY|ShiftMask, XK_c, spawn, SHCMD("") }, */ + { MODKEY|ShiftMask, XK_c, spawn, {.v = (const char*[]){ TERMINAL, "-e", "tiny", NULL } } }, /* V is automatically bound above in STACKKEYS */ { MODKEY, XK_b, togglebar, {0} }, /* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */ - { MODKEY, XK_n, spawn, {.v = (const char*[]){ TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL } } }, + { MODKEY, XK_n, spawn, {.v = (const char*[]){ TERMINAL, "-e", "kn" , NULL } } }, { MODKEY|ShiftMask, XK_n, spawn, SHCMD(TERMINAL " -e newsboat ; pkill -RTMIN+6 dwmblocks") }, { MODKEY, XK_m, spawn, {.v = (const char*[]){ TERMINAL, "-e", "ncmpcpp", NULL } } }, - { MODKEY|ShiftMask, XK_m, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44 $(pidof dwmblocks)") }, + { MODKEY|ShiftMask, XK_m, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; pkill -RTMIN+10 dwmblocks") }, { MODKEY, XK_comma, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } }, { MODKEY|ShiftMask, XK_comma, spawn, {.v = (const char*[]){ "mpc", "seek", "0%", NULL } } }, { MODKEY, XK_period, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } }, @@ -241,7 +242,7 @@ static const Key keys[] = { { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") }, { MODKEY, XK_F2, spawn, {.v = (const char*[]){ "tutorialvids", NULL } } }, { MODKEY, XK_F3, spawn, {.v = (const char*[]){ "displayselect", NULL } } }, - { MODKEY, XK_F4, spawn, SHCMD(TERMINAL " -e pulsemixer; kill -44 $(pidof dwmblocks)") }, + { MODKEY, XK_F4, spawn, SHCMD(TERMINAL " -e pulsemixer; pkill -RTMIN+10 dwmblocks") }, { MODKEY, XK_F5, xrdb, {.v = NULL } }, { MODKEY, XK_F6, spawn, {.v = (const char*[]){ "torwrap", NULL } } }, { MODKEY, XK_F7, spawn, {.v = (const char*[]){ "td-toggle", NULL } } }, @@ -253,16 +254,16 @@ static const Key keys[] = { { MODKEY, XK_space, zoom, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { 0, XK_Print, spawn, SHCMD("maim pic-full-$(date '+%y%m%d-%H%M-%S').png") }, + { 0, XK_Print, spawn, SHCMD("maim -q -d 0.2 -i \"$(xdotool getactivewindow)\" | xclip -f -t image/png | xclip -sel c -t image/png ") }, { ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "maimpick", NULL } } }, { MODKEY, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", NULL } } }, { MODKEY|ShiftMask, XK_Print, spawn, {.v = (const char*[]){ "dmenurecord", "kill", NULL } } }, { MODKEY, XK_Delete, spawn, {.v = (const char*[]){ "dmenurecord", "kill", NULL } } }, { MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") }, - { 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -44 $(pidof dwmblocks)") }, - { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; kill -44 $(pidof dwmblocks)") }, - { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%-; kill -44 $(pidof dwmblocks)") }, + { 0, XF86XK_AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; pkill -RTMIN+10 dwmblocks") }, + { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%+; pkill -RTMIN+10 dwmblocks") }, + { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 3%-; pkill -RTMIN+10 dwmblocks") }, { 0, XF86XK_AudioPrev, spawn, {.v = (const char*[]){ "mpc", "prev", NULL } } }, { 0, XF86XK_AudioNext, spawn, {.v = (const char*[]){ "mpc", "next", NULL } } }, { 0, XF86XK_AudioPause, spawn, {.v = (const char*[]){ "mpc", "pause", NULL } } }, @@ -334,4 +335,3 @@ static const Button buttons[] = { { ClkTagBar, 0, Button5, shiftview, {.i = 1} }, { ClkRootWin, 0, Button2, togglebar, {0} }, }; - @@ -668,6 +668,7 @@ clientmessage(XEvent *e) { XClientMessageEvent *cme = &e->xclient; Client *c = wintoclient(cme->window); + unsigned int i; if (!c) return; @@ -677,8 +678,14 @@ clientmessage(XEvent *e) setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); } else if (cme->message_type == netatom[NetActiveWindow]) { - if (c != selmon->sel && !c->isurgent) - seturgent(c, 1); + for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); + if (i < LENGTH(tags)) { + const Arg a = {.ui = 1 << i}; + selmon = c->mon; + view(&a); + focus(c); + restack(selmon); + } } } @@ -2683,4 +2690,3 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } - diff --git a/patches/dwm-focusonnetactive-6.2.diff b/patches/dwm-focusonnetactive-6.2.diff new file mode 100644 index 0000000..5d358d2 --- /dev/null +++ b/patches/dwm-focusonnetactive-6.2.diff @@ -0,0 +1,57 @@ +From 286ca3bb1af08b452bf8140abcc23d4ef61baaa2 Mon Sep 17 00:00:00 2001 +From: bakkeby <bakkeby@gmail.com> +Date: Tue, 7 Apr 2020 12:33:04 +0200 +Subject: [PATCH] Activate a window in response to _NET_ACTIVE_WINDOW + +By default, dwm response to client requests to _NET_ACTIVE_WINDOW client +messages by setting the urgency bit on the named window. + +This patch activates the window instead. + +Both behaviours are legitimate according to +https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472702304 + +One should decide which of these one should perform based on the message +senders' untestable claims that it represents the end-user. Setting the +urgency bit is the conservative decision. This patch implements the more +trusting alternative. + +It also allows dwm to work with `wmctrl -a` and other external window +management utilities + +--- + dwm.c | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/dwm.c b/dwm.c +index 4465af1..3919d47 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -514,6 +514,7 @@ clientmessage(XEvent *e) + { + XClientMessageEvent *cme = &e->xclient; + Client *c = wintoclient(cme->window); ++ unsigned int i; + + if (!c) + return; +@@ -523,8 +524,14 @@ clientmessage(XEvent *e) + setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */ + || (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen))); + } else if (cme->message_type == netatom[NetActiveWindow]) { +- if (c != selmon->sel && !c->isurgent) +- seturgent(c, 1); ++ for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++); ++ if (i < LENGTH(tags)) { ++ const Arg a = {.ui = 1 << i}; ++ selmon = c->mon; ++ view(&a); ++ focus(c); ++ restack(selmon); ++ } + } + } + +-- +2.17.1 + |
