summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h38
-rw-r--r--dwm.c24
2 files changed, 42 insertions, 20 deletions
diff --git a/config.h b/config.h
index 638d6a5..f6756ba 100644
--- a/config.h
+++ b/config.h
@@ -81,6 +81,22 @@ 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[] = {
@@ -101,10 +117,10 @@ static Key keys[] = {
TAGKEYS( XK_9, 8)
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
- { MODKEY, XK_minus, spawn, SHCMD("lmc down") },
- { MODKEY|ShiftMask, XK_minus, spawn, SHCMD("lmc down 15") },
- { MODKEY, XK_equal, spawn, SHCMD("lmc up") },
- { MODKEY|ShiftMask, XK_equal, spawn, SHCMD("lmc up 15") },
+ { 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") },
@@ -137,7 +153,7 @@ static Key keys[] = {
{ MODKEY, XK_backslash, view, {0} },
/* { MODKEY|ShiftMask, XK_backslash, spawn, SHCMD("") }, */
- { MODKEY, XK_a, spawn, SHCMD("st -e lmc control") },
+ { MODKEY, XK_a, spawn, {.v = audiocontrol} },
/* { MODKEY|ShiftMask, XK_a, spawn, SHCMD("") }, */
{ MODKEY, XK_s, togglesticky, {0} },
/* { MODKEY|ShiftMask, XK_s, spawn, SHCMD("") }, */
@@ -161,8 +177,8 @@ static Key keys[] = {
{ 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_c, spawn, SHCMD("") }, */
- { MODKEY|ShiftMask, XK_c, spawn, SHCMD("mpv --no-cache --no-osc --no-input-default-bindings --input-conf=/dev/null --title=mpvfloat $(ls /dev/video[0,2,4,6,8] | tail -n 1)") },
+ { 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} },
@@ -170,7 +186,7 @@ static Key keys[] = {
{ MODKEY, XK_n, spawn, SHCMD("st -e newsboat; pkill -RTMIN+6 dwmblocks") },
{ MODKEY|ShiftMask, XK_n, spawn, SHCMD("hover right") },
{ MODKEY, XK_m, spawn, SHCMD("st -e ncmpcpp") },
- { MODKEY|ShiftMask, XK_m, spawn, SHCMD("lmc toggle") },
+ { MODKEY|ShiftMask, XK_m, spawn, {.v = voltoggle } },
{ MODKEY, XK_comma, spawn, SHCMD("mpc prev") },
{ MODKEY|ShiftMask, XK_comma, spawn, SHCMD("mpc seek 0%") },
{ MODKEY, XK_period, spawn, SHCMD("mpc next") },
@@ -202,9 +218,9 @@ static Key keys[] = {
{ MODKEY, XK_Delete, spawn, SHCMD("dmenurecord kill") },
{ MODKEY, XK_Scroll_Lock, spawn, SHCMD("killall screenkey || screenkey &") },
- { 0, XF86XK_AudioMute, spawn, SHCMD("lmc toggle") },
- { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("lmc up") },
- { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("lmc down") },
+ { 0, XF86XK_AudioMute, spawn, {.v = voltoggle } },
+ { 0, XF86XK_AudioRaiseVolume, spawn, {.v = volup } },
+ { 0, XF86XK_AudioLowerVolume, spawn, {.v = voldown } },
{ 0, XF86XK_AudioPrev, spawn, SHCMD("mpc prev") },
{ 0, XF86XK_AudioNext, spawn, SHCMD("mpc next") },
{ 0, XF86XK_AudioPause, spawn, SHCMD("mpc pause") },
diff --git a/dwm.c b/dwm.c
index bea6b6e..8f08bea 100644
--- a/dwm.c
+++ b/dwm.c
@@ -472,7 +472,7 @@ attachstack(Client *c)
void
buttonpress(XEvent *e)
{
- unsigned int i, x, click;
+ unsigned int i, x, click, occ = 0;
Arg arg = {0};
Client *c;
Monitor *m;
@@ -487,9 +487,14 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- do
+ for (c = m->clients; c; c = c->next)
+ occ |= c->tags == 255 ? 0 : c->tags;
+ do {
+ /* do not reserve space for vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
+ } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -769,19 +774,19 @@ drawbar(Monitor *m)
}
for (c = m->clients; c; c = c->next) {
- occ |= c->tags;
+ occ |= c->tags == 255 ? 0 : c->tags;
if (c->isurgent)
urg |= c->tags;
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* do not draw vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
+
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = blw = TEXTW(m->ltsymbol);
@@ -1522,7 +1527,8 @@ run(void)
void
runAutostart(void) {
- system("export STATUSBAR=\"dwmblocks\" ; killall dwmblocks ; dwmblocks &");
+ system("type startup >/dev/null 2>&1 && startup &");
+ system("killall dwmblocks ; dwmblocks &");
}
void