diff options
| author | tslil clingman <tslil@posteo.de> | 2023-01-18 21:02:38 +0100 |
|---|---|---|
| committer | tslil clingman <tslil@posteo.de> | 2023-01-18 21:02:38 +0100 |
| commit | 67b505107e8c8075b409bdc7a7a8a0158caf4aa6 (patch) | |
| tree | 9fee55ff2f006da57ec8a9922b21d3d8257c362b /dwm-6.2 | |
| parent | 67f463598e40139adcd70b074a8ee415310b402f (diff) | |
dwm config changes + emacs tweaks
Diffstat (limited to 'dwm-6.2')
| -rw-r--r-- | dwm-6.2/config.h | 166 | ||||
| -rw-r--r-- | dwm-6.2/dwm.c | 94 |
2 files changed, 91 insertions, 169 deletions
diff --git a/dwm-6.2/config.h b/dwm-6.2/config.h index db80e04..d2baa43 100644 --- a/dwm-6.2/config.h +++ b/dwm-6.2/config.h @@ -1,30 +1,29 @@ /* See LICENSE file for copyright and license details. */ /* appearance */ -static const unsigned int borderpx = 1; /* border pixel of windows */ -static const unsigned int gappx = 6; /* gaps between windows */ -static const unsigned int snap = 16; /* snap pixel */ -static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ -static const unsigned int systrayspacing = 2; /* systray spacing */ -static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ -static const int showsystray = 1; /* 0 means no systray */ -static const int showbar = 1; /* 0 means no bar */ -static const int topbar = 0; /* 0 means bottom bar */ -static const char *fonts[] = { "Sudo:size=10" }; -static const char dmenufont[] = "Sudo:size=24"; -static const char col_gray1[] = "#222222"; -static const char col_gray2[] = "#444444"; -static const char col_gray3[] = "#bbbbbb"; -static const char col_gray4[] = "#eeeeee"; -static const char col_orang[] = "dark orange"; // "#ED9121"; -static const char *colors[][3] = { +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int gappx = 3; /* gaps between windows */ +static const unsigned int snap = 16; /* snap pixel */ +static const unsigned int systraypinning = 0; /* 0: sloppy systray follows selected monitor, >0: pin systray to monitor X */ +static const unsigned int systrayspacing = 2; /* systray spacing */ +static const int systraypinningfailfirst = 1; /* 1: if pinning fails, display systray on the first monitor, False: display systray on the last monitor*/ +static const int showsystray = 1; /* 0 means no systray */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 0; /* 0 means bottom bar */ +static const char *fonts[] = { "Terminus:size=12" }; +static const char col_gray1[] = "#000000"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_orang[] = "dark orange"; // "#ED9121"; +static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, - [SchemeSel] = { col_gray1, col_orang, col_orang }, + [SchemeSel] = { col_orang, col_gray2, col_orang }, }; /* tagging */ -static const char *tags[] = { "L", "U", "Y", ";", "Q", "W", "F", "B", "P" }; +static const char *tags[] = { "F", "U", "H", ".", "V", "L", "O", "M" }; static const Rule rules[] = { /* xprop(1): @@ -59,75 +58,82 @@ static const Layout layouts[] = { #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } /* 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_orang, "-sf", col_gray1, NULL }; -static const char *termcmd[] = { "st", NULL }; - -/* -#define XF86MonBrightnessUp 0x1008ff02 -#define XF86MonBrightnessDown 0x1008ff03 -static const char *brightness_up[] = { "brightnessctl", "s", "5%+", NULL }; -static const char *brightness_dn[] = { "brightnessctl", "s", "5%-", NULL }; -*/ +static const char *termcmd[] = { "alacritty", NULL }; +static const char *menucmd[] = { "run", NULL }; +static const char *now_playing[] = { "now_playing", NULL }; +static const char *albumbler[] = { "albumbler.py", NULL }; +static const char *mpc_toggle[] = { "mpc", "toggle", NULL }; +static const char *mpc_next[] = { "mpc", "next", NULL }; +static const char *mpc_prev[] = { "mpc", "prev", NULL }; +static const char *mpc_stop[] = { "mpc", "stop", NULL }; +static const char *lock[] = { "lock", NULL }; +static const char *flameshot[] = { "flameshot", "gui", NULL }; #define XF86AudioLowerVolume 0x1008ff11 -#define XF86AudioRaiseVolume 0x1008ff13 #define XF86AudioMute 0x1008ff12 +#define XF86AudioRaiseVolume 0x1008ff13 +#define XF86AudioPlay 0x1008ff14 +#define XF86AudioStop 0x1008ff15 +#define XF86AudioPrev 0x1008ff16 +#define XF86AudioNext 0x1008ff17 + static const char *vol_dn[] = { "pactl", "set-sink-volume", "0", "-5%", NULL }; static const char *vol_up[] = { "pactl", "set-sink-volume", "0", "+5%", NULL }; static const char *vol_mt[] = { "pactl", "set-sink-mute", "0", "toggle", NULL }; -#define XF86ScreenSaver 0x1008ff2d -static const char *lock[] = {"lock", NULL}; -static const char *toggle_autolock[] = { "toggle_autolock", NULL }; - static Key keys[] = { - /* modifier key function argument */ -// Commands - { MODKEY, XK_space, spawn, {.v = dmenucmd } }, - { MODKEY, XK_t, spawn, {.v = termcmd } }, - { 0, XF86AudioLowerVolume, spawn, {.v = vol_dn } }, - { 0, XF86AudioRaiseVolume, spawn, {.v = vol_up } }, - { 0, XF86AudioMute, spawn, {.v = vol_mt } }, - { 0, XF86ScreenSaver, spawn, {.v = lock } }, - { MODKEY, XK_h, spawn, {.v = lock } }, - { MODKEY|ShiftMask, XK_h, spawn, {.v = toggle_autolock } }, -/* - { 0, XF86MonBrightnessDown, spawn, {.v = brightness_dn } }, - { 0, XF86MonBrightnessUp, spawn, {.v = brightness_up } }, -*/ -// Windows - { MODKEY, XK_n, focusstack, {.i = +1 } }, - { MODKEY, XK_o, focusstack, {.i = -1 } }, - { MODKEY|ShiftMask, XK_e, incnmaster, {.i = +1 } }, - { MODKEY|ShiftMask, XK_i, incnmaster, {.i = -1 } }, - { MODKEY, XK_e, setmfact, {.f = -0.05} }, - { MODKEY, XK_i, setmfact, {.f = +0.05} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_k, killclient, {0} }, -// Layout - { MODKEY, XK_a, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_r, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_s, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_d, togglefloating, {0} }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, -// Tags - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - TAGKEYS( XK_l, 0) - TAGKEYS( XK_u, 1) - TAGKEYS( XK_y, 2) - TAGKEYS( XK_semicolon, 3) - TAGKEYS( XK_q, 4) - TAGKEYS( XK_w, 5) - TAGKEYS( XK_f, 6) - TAGKEYS( XK_p, 7) - TAGKEYS( XK_b, 8) - { MODKEY|ShiftMask|ControlMask, XK_q, quit, {0} }, + /* modifier key function argument */ + + // Commands + { MODKEY, XK_t, spawn, {.v = termcmd} }, + { MODKEY, XK_d, spawn, {.v = menucmd} }, + { MODKEY|ShiftMask, XK_space, spawn, {.v = albumbler } }, + { MODKEY|ShiftMask|ControlMask, XK_space, spawn, {.v = now_playing } }, + { MODKEY, XK_x, spawn, {.v = lock } }, + { MODKEY, XK_p, spawn, {.v = flameshot } }, + { MODKEY|ShiftMask|ControlMask, XK_q, quit, {0} }, + + // Multimedia + { 0, XF86AudioLowerVolume, spawn, {.v = vol_dn } }, + { 0, XF86AudioMute, spawn, {.v = vol_mt } }, + { 0, XF86AudioRaiseVolume, spawn, {.v = vol_up } }, + { 0, XF86AudioPlay, spawn, {.v = mpc_toggle } }, + { 0, XF86AudioStop, spawn, {.v = mpc_stop } }, + { 0, XF86AudioPrev, spawn, {.v = mpc_prev } }, + { 0, XF86AudioNext, spawn, {.v = mpc_next } }, + + // Windows + { MODKEY, XK_c, focusstack, {.i = +1 } }, + { MODKEY, XK_i, focusstack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_c, incnmaster, {.i = +1 } }, + { MODKEY|ShiftMask, XK_i, incnmaster, {.i = -1 } }, + { MODKEY, XK_e, setmfact, {.f = -0.05} }, + { MODKEY, XK_n, setmfact, {.f = +0.05} }, + { MODKEY, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_k, killclient, {0} }, + + // Layout + { MODKEY, XK_s, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_r, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_a, setlayout, {.v = &layouts[2]} }, + { MODKEY|ShiftMask, XK_r, togglefloating, {0} }, + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_b, focusmon, {.i = +1 } }, + + // Tags + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_b, tagmon, {.i = +1 } }, + TAGKEYS( XK_f, 0) + TAGKEYS( XK_u, 1) + TAGKEYS( XK_h, 2) + TAGKEYS( XK_period, 3) + TAGKEYS( XK_v, 4) + TAGKEYS( XK_l, 5) + TAGKEYS( XK_o, 6) + TAGKEYS( XK_m, 7) }; /* button definitions */ diff --git a/dwm-6.2/dwm.c b/dwm-6.2/dwm.c index 370f484..27e1105 100644 --- a/dwm-6.2/dwm.c +++ b/dwm-6.2/dwm.c @@ -225,7 +225,6 @@ static void resizemouse(const Arg *arg); static void resizerequest(XEvent *e); static void restack(Monitor *m); static void run(void); -static void runautostart(void); static void scan(void); static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, long d3, long d4); static void sendmon(Client *c, Monitor *m); @@ -274,10 +273,6 @@ static void zoom(const Arg *arg); /* variables */ static Systray *systray = NULL; -static const char autostartblocksh[] = "autostart_blocking.sh"; -static const char autostartsh[] = "autostart.sh"; -static const char dwmdir[] = "dwm"; -static const char localshare[] = ".local/share"; static const char broken[] = "broken"; static char stext[256]; static int screen; @@ -1464,17 +1459,17 @@ void resizeclient(Client *c, int x, int y, int w, int h) { XWindowChanges wc; - unsigned int gapoffset; - unsigned int gapincr; + unsigned int gapoffset; + unsigned int gapincr; wc.border_width = c->bw; /* Do nothing if layout is floating */ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) { - gapincr = gapoffset = 0; + gapincr = gapoffset = 0; } else { - gapoffset = gappx; - gapincr = 2 * gappx; + gapoffset = gappx; + gapincr = 2 * gappx; } c->oldx = c->x; c->x = wc.x = x + gapoffset; @@ -1593,82 +1588,6 @@ run(void) handler[ev.type](&ev); /* call handler */ } -void -runautostart(void) -{ - char *pathpfx; - char *path; - char *xdgdatahome; - char *home; - struct stat sb; - - if ((home = getenv("HOME")) == NULL) - /* this is almost impossible */ - return; - - /* if $XDG_DATA_HOME is set and not empty, use $XDG_DATA_HOME/dwm, - * otherwise use ~/.local/share/dwm as autostart script directory - */ - xdgdatahome = getenv("XDG_DATA_HOME"); - if (xdgdatahome != NULL && *xdgdatahome != '\0') { - /* space for path segments, separators and nul */ - pathpfx = ecalloc(1, strlen(xdgdatahome) + strlen(dwmdir) + 2); - - if (sprintf(pathpfx, "%s/%s", xdgdatahome, dwmdir) <= 0) { - free(pathpfx); - return; - } - } else { - /* space for path segments, separators and nul */ - pathpfx = ecalloc(1, strlen(home) + strlen(localshare) - + strlen(dwmdir) + 3); - - if (sprintf(pathpfx, "%s/%s/%s", home, localshare, dwmdir) < 0) { - free(pathpfx); - return; - } - } - - /* check if the autostart script directory exists */ - if (! (stat(pathpfx, &sb) == 0 && S_ISDIR(sb.st_mode))) { - /* the XDG conformant path does not exist or is no directory - * so we try ~/.dwm instead - */ - char *pathpfx_new = realloc(pathpfx, strlen(home) + strlen(dwmdir) + 3); - if(pathpfx_new == NULL) { - free(pathpfx); - return; - } - pathpfx = pathpfx_new; - - if (sprintf(pathpfx, "%s/.%s", home, dwmdir) <= 0) { - free(pathpfx); - return; - } - } - - /* try the blocking script first */ - path = ecalloc(1, strlen(pathpfx) + strlen(autostartblocksh) + 2); - if (sprintf(path, "%s/%s", pathpfx, autostartblocksh) <= 0) { - free(path); - free(pathpfx); - } - - if (access(path, X_OK) == 0) - system(path); - - /* now the non-blocking script */ - if (sprintf(path, "%s/%s", pathpfx, autostartsh) <= 0) { - free(path); - free(pathpfx); - } - - if (access(path, X_OK) == 0) - system(strcat(path, " &")); - - free(pathpfx); - free(path); -} void scan(void) @@ -1948,8 +1867,6 @@ sigchld(int unused) void spawn(const Arg *arg) { - if (arg->v == dmenucmd) - dmenumon[0] = '0' + selmon->num; if (fork() == 0) { if (dpy) close(ConnectionNumber(dpy)); @@ -2665,7 +2582,6 @@ main(int argc, char *argv[]) die("pledge"); #endif /* __OpenBSD__ */ scan(); - runautostart(); run(); cleanup(); XCloseDisplay(dpy); |
