diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | config.h | 130 | ||||
-rw-r--r-- | dwm.c | 52 | ||||
-rw-r--r-- | larbs.mom | 18 |
4 files changed, 25 insertions, 177 deletions
@@ -35,7 +35,7 @@ dist: clean install: all mkdir -p ${DESTDIR}${PREFIX}/bin - cp -f dwm dwmc ${DESTDIR}${PREFIX}/bin + cp -f dwm ${DESTDIR}${PREFIX}/bin chmod 755 ${DESTDIR}${PREFIX}/bin/dwm mkdir -p ${DESTDIR}${MANPREFIX}/man1 sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 @@ -87,29 +87,13 @@ static const char *termcmd[] = { "st", NULL }; static const char scratchpadname[] = "scratchpad"; static const char *scratchpadcmd[] = { "st", "-t", scratchpadname, "-g", "120x34", NULL }; -/* PulseAudio commands. Require pulsemixer. */ -static const char *volup[] = { "pulsemixer", "--change-volume", "+5", NULL }; -static const char *bigvolup[] = { "pulsemixer", "--change-volume", "+15", NULL }; -static const char *voldown[] = { "pulsemixer", "--change-volume", "-5", NULL }; -static const char *bigvoldown[] = { "pulsemixer", "--change-volume", "-15", NULL }; -static const char *voltoggle[] = { "pulsemixer", "--toggle-mute", NULL }; -static const char *audiocontrol[] = { "st", "-e", "pulsemixer", NULL }; - -/* ALSA commands. Requires amixer in alsa-utils. */ -/* static const char *volup[] = { "amixer", "sset", "Master", "5%+", NULL }; */ -/* static const char *bigvolup[] = { "amixer", "sset", "Master", "15%+", NULL }; */ -/* static const char *voldown[] = { "amixer", "sset", "Master", "5%-", NULL }; */ -/* static const char *bigvoldown[] = { "amixer", "sset", "Master", "15%-", NULL }; */ -/* static const char *voltoggle[] = { "amixer", "sset", "Master", "toggle" NULL }; */ -/* static const char *audiocontrol[] = { "st", "-e", "alsamixer", NULL }; */ - #include <X11/XF86keysym.h> #include "shiftview.c" static Key keys[] = { /* modifier key function argument */ STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY|ShiftMask, push) - { MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Close dwm?\")\" = Yes ] && kill -TERM $(pidof dwm)") }, + /* { MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("") }, */ { MODKEY, XK_grave, spawn, SHCMD("dmenuunicode") }, /* { MODKEY|ShiftMask, XK_grave, togglescratch, SHCMD("") }, */ TAGKEYS( XK_1, 0) @@ -123,12 +107,12 @@ static Key keys[] = { TAGKEYS( XK_9, 8) { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_minus, spawn, {.v = voldown } }, - { MODKEY|ShiftMask, XK_minus, spawn, {.v = bigvoldown } }, - { MODKEY, XK_equal, spawn, {.v = volup } }, - { MODKEY|ShiftMask, XK_equal, spawn, {.v = bigvolup } }, - /* { MODKEY, XK_BackSpace, spawn, SHCMD("") }, */ - { MODKEY|ShiftMask, XK_BackSpace, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Reboot computer?\")\" = Yes ] && sudo -A reboot") }, + { MODKEY, XK_minus, spawn, SHCMD("pamixer --allow-boost -d 5; kill -44 $(pidof dwmblocks)") }, + { MODKEY|ShiftMask, XK_minus, spawn, SHCMD("pamixer --allow-boost -d 15; kill -44 $(pidof dwmblocks)") }, + { MODKEY, XK_equal, spawn, SHCMD("pamixer --allow-boost -i 5; kill -44 $(pidof dwmblocks)") }, + { MODKEY|ShiftMask, XK_equal, spawn, SHCMD("pamixer --allow-boost -i 15; kill -44 $(pidof dwmblocks)") }, + { MODKEY, XK_BackSpace, spawn, SHCMD("sysact") }, + /* { MODKEY|ShiftMask, XK_BackSpace, spawn, SHCMD("") }, */ { MODKEY, XK_Tab, view, {0} }, /* { MODKEY|ShiftMask, XK_Tab, spawn, SHCMD("") }, */ @@ -139,7 +123,7 @@ static Key keys[] = { { MODKEY, XK_e, spawn, SHCMD("st -e neomutt ; pkill -RTMIN+12 dwmblocks; rmdir ~/.abook") }, { MODKEY|ShiftMask, XK_e, spawn, SHCMD("tutorialvids") }, { MODKEY, XK_r, spawn, SHCMD("st -e lf") }, - { MODKEY|ShiftMask, XK_r, quit, {1} }, + /* { MODKEY|ShiftMask, XK_r, quit, {1} }, */ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, @@ -159,7 +143,7 @@ static Key keys[] = { { MODKEY, XK_backslash, view, {0} }, /* { MODKEY|ShiftMask, XK_backslash, spawn, SHCMD("") }, */ - { MODKEY, XK_a, spawn, {.v = audiocontrol } }, + { MODKEY, XK_a, spawn, SHCMD("st -e pulsemixer; kill -44 $(pidof dwmblocks)") }, /* { MODKEY|ShiftMask, XK_a, spawn, SHCMD("") }, */ { MODKEY, XK_s, togglesticky, {0} }, /* { MODKEY|ShiftMask, XK_s, spawn, SHCMD("") }, */ @@ -181,26 +165,26 @@ static Key keys[] = { { MODKEY, XK_z, incrgaps, {.i = +1 } }, { MODKEY|ShiftMask, XK_z, incrgaps, {.i = -1 } }, - { MODKEY, XK_x, spawn, SHCMD("slock & xset dpms force off; mpc pause ; pauseallmpv") }, - { MODKEY|ShiftMask, XK_x, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Shutdown computer?\")\" = Yes ] && sudo -A shutdown -h now") }, + /* { MODKEY, XK_x, spawn, SHCMD("") }, */ + /* { MODKEY|ShiftMask, XK_x, spawn, SHCMD("") }, */ { MODKEY, XK_c, spawn, SHCMD("st -e bc -l") }, { MODKEY|ShiftMask, XK_c, spawn, SHCMD("mpv --no-cache --no-osc --no-input-default-bindings --input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | tail -n 1)") }, { MODKEY, XK_v, spawn, SHCMD("st -e $EDITOR -c \"VimwikiIndex\"") }, { MODKEY|ShiftMask, XK_v, spawn, SHCMD("{ killall xcompmgr || setsid xcompmgr & } ; xwallpaper --zoom ~/.config/wall.png") }, { MODKEY, XK_b, togglebar, {0} }, - { MODKEY|ShiftMask, XK_b, spawn, SHCMD("hover left") }, + /* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */ { MODKEY, XK_n, spawn, SHCMD("st -e newsboat; pkill -RTMIN+6 dwmblocks") }, - { MODKEY|ShiftMask, XK_n, spawn, SHCMD("hover right") }, + /* { MODKEY|ShiftMask, XK_n, spawn, SHCMD("") }, */ { MODKEY, XK_m, spawn, SHCMD("st -e ncmpcpp") }, - { MODKEY|ShiftMask, XK_m, spawn, {.v = voltoggle } }, + { MODKEY|ShiftMask, XK_m, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") }, { MODKEY, XK_comma, spawn, SHCMD("mpc prev") }, { MODKEY|ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%") }, { MODKEY, XK_period, spawn, SHCMD("mpc next") }, { MODKEY|ShiftMask, XK_period, spawn, SHCMD("mpc repeat") }, { MODKEY, XK_Left, focusmon, {.i = -1 } }, - { MODKEY, XK_Left, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_Right, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_Left, tagmon, {.i = -1 } }, + { MODKEY, XK_Right, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_Right, tagmon, {.i = +1 } }, { MODKEY, XK_Page_Up, shiftview, { .i = -1 } }, @@ -210,7 +194,7 @@ static Key keys[] = { { MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/larbs.mom -Tpdf | zathura -") }, { MODKEY, XK_F2, quit, {1} }, { MODKEY, XK_F3, spawn, SHCMD("displayselect") }, - { MODKEY, XK_F4, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Hibernate computer?\")\" = Yes ] && sudo -A zzz") }, + /* { MODKEY, XK_F4, spawn, SHCMD("") }, */ { MODKEY, XK_F5, xrdb, {.v = NULL } }, { MODKEY, XK_F6, spawn, SHCMD("torwrap") }, { MODKEY, XK_F7, spawn, SHCMD("td-toggle") }, @@ -229,9 +213,9 @@ static Key keys[] = { { MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill") }, { MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") }, - { 0, XF86XK_AudioMute, spawn, {.v = voltoggle } }, - { 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } }, - { 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } }, + { 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; kill -44 $(pidof dwmblocks)") }, + { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 3; kill -44 $(pidof dwmblocks)") }, + { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 3; kill -44 $(pidof dwmblocks)") }, { 0, XF86XK_AudioPrev, spawn, SHCMD("mpc prev") }, { 0, XF86XK_AudioNext, spawn, SHCMD("mpc next") }, { 0, XF86XK_AudioPause, spawn, SHCMD("mpc pause") }, @@ -242,7 +226,7 @@ static Key keys[] = { { 0, XF86XK_AudioMedia, spawn, SHCMD("st -e ncmpcpp") }, { 0, XF86XK_PowerOff, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Shutdown computer?\")\" = Yes ] && sudo -A shutdown -h now") }, { 0, XF86XK_Calculator, spawn, SHCMD("st -e bc -l") }, - { 0, XF86XK_Sleep, spawn, SHCMD("[ \"$(printf \"No\\nYes\" | dmenu -i -nb darkred -sb red -sf white -nf gray -p \"Hibernate computer?\")\" = Yes ] && sudo -A zzz") }, + { 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") }, { 0, XF86XK_WWW, spawn, SHCMD("$BROWSER") }, { 0, XF86XK_DOS, spawn, SHCMD("st") }, { 0, XF86XK_ScreenSaver, spawn, SHCMD("slock & xset dpms force off; mpc pause; pauseallmpv") }, @@ -298,75 +282,3 @@ static Button buttons[] = { { ClkTagBar, 0, Button4, shiftview, {.i = -1} }, { ClkTagBar, 0, Button5, shiftview, {.i = 1} }, }; - -void -setlayoutex(const Arg *arg) -{ - setlayout(&((Arg) { .v = &layouts[arg->i] })); -} - -void -viewex(const Arg *arg) -{ - view(&((Arg) { .ui = 1 << arg->ui })); -} - -void -viewall(const Arg *arg) -{ - view(&((Arg){.ui = ~0})); -} - -void -toggleviewex(const Arg *arg) -{ - toggleview(&((Arg) { .ui = 1 << arg->ui })); -} - -void -tagex(const Arg *arg) -{ - tag(&((Arg) { .ui = 1 << arg->ui })); -} - -void -toggletagex(const Arg *arg) -{ - toggletag(&((Arg) { .ui = 1 << arg->ui })); -} - -void -tagall(const Arg *arg) -{ - tag(&((Arg){.ui = ~0})); -} - -/* signal definitions */ -/* signum must be greater than 0 */ -/* trigger signals using `xsetroot -name "fsignal:<signame> [<type> <value>]"` */ -static Signal signals[] = { - /* signum function */ - { "focusstack", focusstack }, - { "setmfact", setmfact }, - { "togglebar", togglebar }, - { "incnmaster", incnmaster }, - { "togglefloating", togglefloating }, - { "focusmon", focusmon }, - { "tagmon", tagmon }, - { "zoom", zoom }, - { "view", view }, - { "viewall", viewall }, - { "viewex", viewex }, - { "toggleview", view }, - { "toggleviewex", toggleviewex }, - { "tag", tag }, - { "tagall", tagall }, - { "tagex", tagex }, - { "toggletag", tag }, - { "toggletagex", toggletagex }, - { "killclient", killclient }, - { "quit", quit }, - { "setlayout", setlayout }, - { "setlayoutex", setlayoutex }, - { "xrdb", xrdb }, -}; @@ -129,11 +129,6 @@ typedef struct { } Key; typedef struct { - const char * sig; - void (*func)(const Arg *); -} Signal; - -typedef struct { const char *symbol; void (*arrange)(Monitor *); } Layout; @@ -179,7 +174,6 @@ static void arrange(Monitor *m); static void arrangemon(Monitor *m); static void attach(Client *c); static void attachstack(Client *c); -static int fake_signal(void); static void buttonpress(XEvent *e); static void checkotherwm(void); static void cleanup(void); @@ -1088,49 +1082,6 @@ keypress(XEvent *e) keys[i].func(&(keys[i].arg)); } -int -fake_signal(void) -{ - char fsignal[256]; - char indicator[9] = "fsignal:"; - char str_sig[50]; - char param[16]; - int i, len_str_sig, n, paramn; - size_t len_fsignal, len_indicator = strlen(indicator); - Arg arg; - - // Get root name property - if (gettextprop(root, XA_WM_NAME, fsignal, sizeof(fsignal))) { - len_fsignal = strlen(fsignal); - - // Check if this is indeed a fake signal - if (len_indicator > len_fsignal ? 0 : strncmp(indicator, fsignal, len_indicator) == 0) { - paramn = sscanf(fsignal+len_indicator, "%s%n%s%n", str_sig, &len_str_sig, param, &n); - - if (paramn == 1) arg = (Arg) {0}; - else if (paramn > 2) return 1; - else if (strncmp(param, "i", n - len_str_sig) == 0) - sscanf(fsignal + len_indicator + n, "%i", &(arg.i)); - else if (strncmp(param, "ui", n - len_str_sig) == 0) - sscanf(fsignal + len_indicator + n, "%u", &(arg.ui)); - else if (strncmp(param, "f", n - len_str_sig) == 0) - sscanf(fsignal + len_indicator + n, "%f", &(arg.f)); - else return 1; - - // Check if a signal was found, and if so handle it - for (i = 0; i < LENGTH(signals); i++) - if (strncmp(str_sig, signals[i].sig, len_str_sig) == 0 && signals[i].func) - signals[i].func(&(arg)); - - // A fake signal was sent - return 1; - } - } - - // No fake signal was sent, so proceed with update - return 0; -} - void killclient(const Arg *arg) { @@ -1411,8 +1362,7 @@ propertynotify(XEvent *e) XPropertyEvent *ev = &e->xproperty; if ((ev->window == root) && (ev->atom == XA_WM_NAME)) { - if (!fake_signal()) - updatestatus(); + updatestatus(); } else if (ev->state == PropertyDelete) { return; /* ignore */ } else if ((c = wintoclient(ev->window))) { @@ -112,10 +112,6 @@ To type capital letters, hold down the \f(CWShift\fP key\(emthat might sound lik \f(CWMod+Shift+Space\fP \(en Make a window float (move and resize with \f(CWMod+\fPleft/right click). .ITEM \f(CWMod+b\fP \(en Toggle status bar -.ITEM -\f(CWMod+B\fP \(en Toggle window float in bottom left corner (good for video watched intermittently) -.ITEM -\f(CWMod+N\fP \(en Same as above, but for the bottom right corner. .LIST OFF .HEADING 2 "Window layouts" .LI @@ -166,24 +162,14 @@ To type capital letters, hold down the \f(CWShift\fP key\(emthat might sound lik .HEADING 2 "System" .LI .ITEM -\f(CWMod+x\fP \(en Lock screen (Enter password to return) -.ITEM -\f(CWMod+X\fP \(en Shutdown (will ask to confirm) -.ITEM -\f(CWMod+Shift+Backspace\fP \(en Reboot (will ask to confirm) -.ITEM -\f(CWMod+Shift+Escape\fP \(en Exit the graphical environment (will ask to confirm) +\f(CWMod+BackSpace\fP \(enChoose to lock screen, logout, shutdown, reboot, etc. .ITEM \f(CWMod+V\fP \(en Toggle xcompmgr (to remove transparency and window effects) .ITEM -\f(CWMod+F1\fP \(en Shows this document -.ITEM -\f(CWMod+F2\fP \(en Restart dwm (makes active any changes you've made to dwm) +\f(CWMod+F1\fP \(en Show this document .ITEM \f(CWMod+F3\fP \(en Select screen/display to use .ITEM -\f(CWMod+F4\fP \(en Hibernate (will ask to confirm) -.ITEM \f(CWMod+F5\fP \(en Update dwm's colorscheme if you have changed Xresources .ITEM \f(CWMod+F6\fP \(en Transmission torrent client (not installed by default) |