From 2d2aae65841c6e49bb86380908fb78cbe90c426c Mon Sep 17 00:00:00 2001 From: Derek Taylor Date: Tue, 10 Mar 2020 21:57:00 -0500 Subject: [PATCH] Editing dwm and st. --- .dwm/autostart.sh | 2 +- dwm/config.def.h | 1 + dwm/config.def.h.orig | 14 ++- dwm/config.h | 173 +++++++++++++++++---------------- dwm/dwm-r1615-selfrestart.diff | 101 ------------------- dwm/dwm.1 | 10 ++ dwm/dwm.c | 22 +++++ dwm/dwm.c.orig | 46 +++++++-- dwm/selfrestart.c | 65 ------------- st/config.h | 34 +++---- 10 files changed, 185 insertions(+), 283 deletions(-) delete mode 100755 dwm/dwm-r1615-selfrestart.diff delete mode 100755 dwm/selfrestart.c diff --git a/.dwm/autostart.sh b/.dwm/autostart.sh index b45b826..2304144 100755 --- a/.dwm/autostart.sh +++ b/.dwm/autostart.sh @@ -4,7 +4,7 @@ nitrogen --restore & urxvtd -q -o -f & dte(){ - dte="$(date +"%A, %B %d - %l:%M%p")" + dte="$(date +"%A, %B %d %l:%M%p")" echo -e "🕒 $dte" } diff --git a/dwm/config.def.h b/dwm/config.def.h index 2d5f9e8..704979f 100755 --- a/dwm/config.def.h +++ b/dwm/config.def.h @@ -111,6 +111,7 @@ static Key keys[] = { TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_r, self_restart, {0} }, { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} }, }; /* button definitions */ diff --git a/dwm/config.def.h.orig b/dwm/config.def.h.orig index 54249fc..2d5f9e8 100755 --- a/dwm/config.def.h.orig +++ b/dwm/config.def.h.orig @@ -5,8 +5,8 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ -static const int horizpadbar = 2; /* horizontal padding for statusbar */ -static const int vertpadbar = 0; /* vertical padding for statusbar */ +static const int horizpadbar = 4; /* horizontal padding for statusbar */ +static const int vertpadbar = 2; /* vertical padding for statusbar */ static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; @@ -14,11 +14,18 @@ static const char col_gray2[] = "#444444"; static const char col_gray3[] = "#bbbbbb"; static const char col_gray4[] = "#eeeeee"; static const char col_cyan[] = "#005577"; +static const unsigned int baralpha = 0xd0; +static const unsigned int borderalpha = OPAQUE; static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; +static const unsigned int alphas[][3] = { + /* fg bg border */ + [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, + [SchemeSel] = { OPAQUE, baralpha, borderalpha }, +}; /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; @@ -38,13 +45,11 @@ 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 */ -#include "layouts.c" static const Layout layouts[] = { /* symbol arrange function */ { "[]=", tile }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, - { "HHH", grid }, { NULL, NULL }, }; @@ -85,7 +90,6 @@ static Key keys[] = { { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_g, setlayout, {.v = &layouts[3]} }, { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, { MODKEY, XK_space, setlayout, {0} }, diff --git a/dwm/config.h b/dwm/config.h index 06ce7b2..c299d68 100755 --- a/dwm/config.h +++ b/dwm/config.h @@ -4,33 +4,30 @@ /* | |_| || | http://www.gitlab.com/dwt1/ */ /* |____/ |_| */ - -#include "selfrestart.c" - /* See LICENSE file for copyright and license details. */ /* appearance */ -static const unsigned int borderpx = 2; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const unsigned int gappx = 5; /* pixel gap between clients */ -static const int showbar = 1; /* 0 means no bar */ -static const int topbar = 1; /* 0 means bottom bar */ -static const int horizpadbar = 6; /* horizontal padding for statusbar */ -static const int vertpadbar = 7; /* vertical padding for statusbar */ -static const char *fonts[] = { "Mononoki Nerd Font:size=9" }; -static const char dmenufont[] = "Mononoki Nerd Font:size=9"; -static const char col_gray1[] = "#282a36"; -static const char col_gray2[] = "#000000"; /* border color unfocused windows */ -static const char col_gray3[] = "#96b5b4"; -static const char col_gray4[] = "#c0c5ce"; -static const char col_cyan[] = "#924441"; /* border color focused windows and tags */ -static const unsigned int baralpha = 0xee; +static const unsigned int borderpx = 2; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const unsigned int gappx = 5; /* pixel gap between clients */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const int horizpadbar = 6; /* horizontal padding for statusbar */ +static const int vertpadbar = 7; /* vertical padding for statusbar */ +static const char *fonts[] = { "Mononoki Nerd Font:size=9" }; +static const char dmenufont[] = "Mononoki Nerd Font:size=9"; +static const char col_gray1[] = "#282a36"; +static const char col_gray2[] = "#000000"; /* border color unfocused windows */ +static const char col_gray3[] = "#96b5b4"; +static const char col_gray4[] = "#c0c5ce"; +static const char col_cyan[] = "#924441"; /* border color focused windows and tags */ +static const unsigned int baralpha = 0xff; /* 0xee adds a wee bit transparency */ static const unsigned int borderalpha = OPAQUE; -static const char *colors[][3] = { +static const char *colors[][3] = { /* fg bg border */ [SchemeNorm] = { col_gray4, col_gray1, col_gray2 }, [SchemeSel] = { col_gray4, col_cyan, col_cyan }, }; -static const unsigned int alphas[][3] = { +static const unsigned int alphas[][3] = { /* fg bg border */ [SchemeNorm] = { OPAQUE, baralpha, borderalpha }, [SchemeSel] = { OPAQUE, baralpha, borderalpha }, @@ -85,77 +82,85 @@ static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, static const char *termcmd[] = { "alacritty", NULL }; static Key keys[] = { - /* modifier key function argument */ - { Mod1Mask|ControlMask, XK_Return, spawn, {.v = dmenucmd } }, - { MODKEY, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } }, - { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, - { MODKEY|ShiftMask, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_g, setlayout, {.v = &layouts[3]} }, - { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, - { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + /* modifier key function argument */ + { MODKEY, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, + { MODKEY, XK_d, incnmaster, {.i = -1 } }, + { MODKEY, XK_h, setmfact, {.f = -0.05} }, + { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + { MODKEY, XK_Tab, view, {0} }, + { MODKEY|ShiftMask, XK_c, killclient, {0} }, + + /* Layouts and layout manipulation */ + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_g, setlayout, {.v = &layouts[3]} }, + { MODKEY|ControlMask, XK_comma, cyclelayout, {.i = -1 } }, + { MODKEY|ControlMask, XK_period, cyclelayout, {.i = +1 } }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + + /* Switching between monitors */ + { MODKEY, XK_comma, focusmon, {.i = -1 } }, + { MODKEY, XK_period, focusmon, {.i = +1 } }, + { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, - /* Dmenu scripts launched with ALT + CTRL + KEY */ - { Mod1Mask|ControlMask, XK_e, spawn, CMD("./.dmenu/dmenu-edit-configs.sh") }, - { Mod1Mask|ControlMask, XK_m, spawn, CMD("./.dmenu/dmenu-sysmon.sh") }, - { Mod1Mask|ControlMask, XK_p, spawn, CMD("passmenu") }, - { Mod1Mask|ControlMask, XK_s, spawn, CMD("./.dmenu/dmenu-surfraw.sh") }, + /* Dmenu scripts launched with ALT + CTRL + KEY */ + { Mod1Mask|ControlMask, XK_Return, spawn, {.v = dmenucmd } }, + { Mod1Mask|ControlMask, XK_e, spawn, CMD("./.dmenu/dmenu-edit-configs.sh") }, + { Mod1Mask|ControlMask, XK_m, spawn, CMD("./.dmenu/dmenu-sysmon.sh") }, + { Mod1Mask|ControlMask, XK_p, spawn, CMD("passmenu") }, + { Mod1Mask|ControlMask, XK_r, spawn, CMD("./.dmenu/dmenu-reddio.sh") }, + { Mod1Mask|ControlMask, XK_s, spawn, CMD("./.dmenu/dmenu-surfraw.sh") }, + { Mod1Mask|ControlMask, XK_t, spawn, CMD("./.dmenu/dmenu-trading.sh") }, + { Mod1Mask|ControlMask, XK_i, spawn, CMD("./.dmenu/dmenu-scrot.sh") }, - /* Apps Launched with SUPER + ALT + KEY */ - { MODKEY|Mod1Mask, XK_l, spawn, CMD("st -e lynx -cfg=~/.lynx/lynx.cfg -lss=~/.lynx/lynx.lss gopher://distro.tube") }, - { MODKEY|Mod1Mask, XK_f, spawn, CMD("st -e sh ./.config/vifm/scripts/vifmrun") }, - { MODKEY|Mod1Mask, XK_i, spawn, CMD("st -e irssi") }, - { MODKEY|Mod1Mask, XK_n, spawn, CMD("st -e newsboat") }, - { MODKEY|Mod1Mask, XK_r, spawn, CMD("st -e rtv") }, - { MODKEY|Mod1Mask, XK_e, spawn, CMD("st -e neomutt") }, + /* Apps Launched with SUPER + ALT + KEY */ + { MODKEY|Mod1Mask, XK_l, spawn, CMD("alacritty -e lynx gopher://distro.tube") }, + { MODKEY|Mod1Mask, XK_f, spawn, CMD("alacritty -e sh ./.config/vifm/scripts/vifmrun") }, + { MODKEY|Mod1Mask, XK_i, spawn, CMD("alacritty -e irssi") }, + { MODKEY|Mod1Mask, XK_n, spawn, CMD("alacritty -e newsboat") }, + { MODKEY|Mod1Mask, XK_r, spawn, CMD("alacritty -e rtv") }, + { MODKEY|Mod1Mask, XK_e, spawn, CMD("alacritty -e neomutt") }, - TAGKEYS( XK_1, 0) - TAGKEYS( XK_2, 1) - TAGKEYS( XK_3, 2) - TAGKEYS( XK_4, 3) - TAGKEYS( XK_5, 4) - TAGKEYS( XK_6, 5) - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, - { MODKEY|ShiftMask, XK_r, self_restart, {0} }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY|ShiftMask, XK_r, quit, {1} }, }; /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static Button buttons[] = { - /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, - { ClkClientWin, MODKEY, Button1, movemouse, {0} }, - { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, - { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, - { ClkTagBar, 0, Button1, view, {0} }, - { ClkTagBar, 0, Button3, toggleview, {0} }, - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, + { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, + { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, }; diff --git a/dwm/dwm-r1615-selfrestart.diff b/dwm/dwm-r1615-selfrestart.diff deleted file mode 100755 index 5d019b2..0000000 --- a/dwm/dwm-r1615-selfrestart.diff +++ /dev/null @@ -1,101 +0,0 @@ -# HG changeset patch -# User Barbu Paul - Gheorghe -# Date 1354650884 -7200 -# Node ID 6c472a21a5887c5295a331c48c4da188ec2c8413 -# Parent aaab44133a6830c9a00263731d098c01cc1d6fb5 -selfrestart now magically locates the current dwm (no need to hardcode a path) - -diff -r aaab44133a68 -r 6c472a21a588 config.def.h ---- a/config.def.h Tue Dec 04 21:54:44 2012 +0200 -+++ b/config.def.h Tue Dec 04 21:54:44 2012 +0200 -@@ -54,6 +54,8 @@ - static const char *termcmd[] = { "urxvtc", NULL }; - static const char *filemancmd[] = { "thunar", NULL }; - -+#include "selfrestart.c" -+ - static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_r, spawn, {.v = dmenucmd } }, -@@ -89,6 +91,7 @@ - TAGKEYS( XK_7, 6) - TAGKEYS( XK_8, 7) - TAGKEYS( XK_9, 8) -+ { MODKEY|ShiftMask, XK_r, self_restart, {0} }, - { MODKEY|ShiftMask, XK_q, quit, {0} }, - }; - -@@ -108,4 +111,3 @@ - { ClkTagBar, MODKEY, Button1, tag, {0} }, - { ClkTagBar, MODKEY, Button3, toggletag, {0} }, - }; -- -diff -r aaab44133a68 -r 6c472a21a588 selfrestart.c ---- /dev/null Thu Jan 01 00:00:00 1970 +0000 -+++ b/selfrestart.c Tue Dec 04 21:54:44 2012 +0200 -@@ -0,0 +1,65 @@ -+#include -+#include -+#include -+#include -+#include -+ -+/** -+ * Magically finds the current's executable path -+ * -+ * I'm doing the do{}while(); trick because Linux (what I'm running) is not -+ * POSIX compilant and so lstat() cannot be trusted on /proc entries -+ * -+ * @return char* the path of the current executable -+ */ -+char *get_dwm_path(){ -+ struct stat s; -+ int r, length, rate = 42; -+ char *path = NULL; -+ -+ if(lstat("/proc/self/exe", &s) == -1){ -+ perror("lstat:"); -+ return NULL; -+ } -+ -+ length = s.st_size + 1 - rate; -+ -+ do{ -+ length+=rate; -+ -+ free(path); -+ path = malloc(sizeof(char) * length); -+ -+ if(path == NULL){ -+ perror("malloc:"); -+ return NULL; -+ } -+ -+ r = readlink("/proc/self/exe", path, length); -+ -+ if(r == -1){ -+ perror("readlink:"); -+ return NULL; -+ } -+ }while(r >= length); -+ -+ path[r] = '\0'; -+ -+ return path; -+} -+ -+/** -+ * self-restart -+ * -+ * Initially inspired by: Yu-Jie Lin -+ * https://sites.google.com/site/yjlnotes/notes/dwm -+ */ -+void self_restart(const Arg *arg) { -+ char *const argv[] = {get_dwm_path(), NULL}; -+ -+ if(argv[0] == NULL){ -+ return; -+ } -+ -+ execv(argv[0], argv); -+} diff --git a/dwm/dwm.1 b/dwm/dwm.1 index 165891b..85d1cdc 100755 --- a/dwm/dwm.1 +++ b/dwm/dwm.1 @@ -148,6 +148,9 @@ Add/remove all windows with nth tag to/from the view. .TP .B Mod1\-Shift\-q Quit dwm. +.TP +.B Mod1\-Control\-Shift\-q +Restart dwm. .SS Mouse commands .TP .B Mod1\-Button1 @@ -161,6 +164,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float .SH CUSTOMIZATION dwm is customized by creating a custom config.h and (re)compiling the source code. This keeps it fast, secure and simple. +.SH SIGNALS +.TP +.B SIGHUP - 1 +Restart the dwm process. +.TP +.B SIGTERM - 15 +Cleanly terminate the dwm process. .SH SEE ALSO .BR dmenu (1), .BR st (1) diff --git a/dwm/dwm.c b/dwm/dwm.c index be182ae..3945c1f 100755 --- a/dwm/dwm.c +++ b/dwm/dwm.c @@ -215,6 +215,8 @@ static void setup(void); static void seturgent(Client *c, int urg); static void showhide(Client *c); static void sigchld(int unused); +static void sighup(int unused); +static void sigterm(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); static void tagmon(const Arg *arg); @@ -271,6 +273,7 @@ static void (*handler[LASTEvent]) (XEvent *) = { [UnmapNotify] = unmapnotify }; static Atom wmatom[WMLast], netatom[NetLast]; +static int restart = 0; static int running = 1; static Cur *cursor[CurLast]; static Clr **scheme; @@ -1351,6 +1354,7 @@ propertynotify(XEvent *e) void quit(const Arg *arg) { + if(arg->i) restart = 1; running = 0; } @@ -1701,6 +1705,9 @@ setup(void) /* clean up any zombies immediately */ sigchld(0); + signal(SIGHUP, sighup); + signal(SIGTERM, sigterm); + /* init screen */ screen = DefaultScreen(dpy); sw = DisplayWidth(dpy, screen); @@ -1802,6 +1809,20 @@ sigchld(int unused) while (0 < waitpid(-1, NULL, WNOHANG)); } +void +sighup(int unused) +{ + Arg a = {.i = 1}; + quit(&a); +} + +void +sigterm(int unused) +{ + Arg a = {.i = 0}; + quit(&a); +} + void spawn(const Arg *arg) { @@ -2350,6 +2371,7 @@ main(int argc, char *argv[]) scan(); runAutostart(); run(); + if(restart) execvp(argv[0], argv); cleanup(); XCloseDisplay(dpy); return EXIT_SUCCESS; diff --git a/dwm/dwm.c.orig b/dwm/dwm.c.orig index ce9021e..be182ae 100755 --- a/dwm/dwm.c.orig +++ b/dwm/dwm.c.orig @@ -740,10 +740,10 @@ dirtomon(int dir) void drawbar(Monitor *m) { - int x, w, sw = 0; + int x, w, sw = 0, tw, mw, ew = 0; int boxs = drw->fonts->h / 9; int boxw = drw->fonts->h / 6 + 2; - unsigned int i, occ = 0, urg = 0; + unsigned int i, occ = 0, urg = 0, n = 0; Client *c; /* draw status first so it can be overdrawn by tags later */ @@ -754,6 +754,8 @@ drawbar(Monitor *m) } for (c = m->clients; c; c = c->next) { + if (ISVISIBLE(c)) + n++; occ |= c->tags; if (c->isurgent) urg |= c->tags; @@ -774,15 +776,39 @@ drawbar(Monitor *m) x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); if ((w = m->ww - sw - x) > bh) { - if (m->sel) { - drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]); - drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0); - if (m->sel->isfloating) - drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0); - } else { - drw_setscheme(drw, scheme[SchemeNorm]); - drw_rect(drw, x, 0, w, bh, 1, 1); + if (n > 0) { + tw = TEXTW(m->sel->name) + lrpad; + mw = (tw >= w || n == 1) ? 0 : (w - tw) / (n - 1); + + i = 0; + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c) || c == m->sel) + continue; + tw = TEXTW(c->name); + if(tw < mw) + ew += (mw - tw); + else + i++; + } + if (i > 0) + mw += ew / i; + + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c)) + continue; + tw = MIN(m->sel == c ? w : mw, TEXTW(c->name)); + + drw_setscheme(drw, scheme[m->sel == c ? SchemeSel : SchemeNorm]); + if (tw > 0) /* trap special handling of 0 in drw_text */ + drw_text(drw, x, 0, tw, bh, lrpad / 2, c->name, 0); + if (c->isfloating) + drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); + x += tw; + w -= tw; + } } + drw_setscheme(drw, scheme[SchemeNorm]); + drw_rect(drw, x, 0, w, bh, 1, 1); } drw_map(drw, m->barwin, 0, 0, m->ww, bh); } diff --git a/dwm/selfrestart.c b/dwm/selfrestart.c deleted file mode 100755 index d695d48..0000000 --- a/dwm/selfrestart.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include -#include -#include - -/** - * Magically finds the current's executable path - * - * I'm doing the do{}while(); trick because Linux (what I'm running) is not - * POSIX compilant and so lstat() cannot be trusted on /proc entries - * - * @return char* the path of the current executable - */ -char *get_dwm_path(){ - struct stat s; - int r, length, rate = 42; - char *path = NULL; - - if(lstat("/proc/self/exe", &s) == -1){ - perror("lstat:"); - return NULL; - } - - length = s.st_size + 1 - rate; - - do{ - length+=rate; - - free(path); - path = malloc(sizeof(char) * length); - - if(path == NULL){ - perror("malloc:"); - return NULL; - } - - r = readlink("/proc/self/exe", path, length); - - if(r == -1){ - perror("readlink:"); - return NULL; - } - }while(r >= length); - - path[r] = '\0'; - - return path; -} - -/** - * self-restart - * - * Initially inspired by: Yu-Jie Lin - * https://sites.google.com/site/yjlnotes/notes/dwm - */ -void self_restart(const Arg *arg) { - char *const argv[] = {get_dwm_path(), NULL}; - - if(argv[0] == NULL){ - return; - } - - execv(argv[0], argv); -} diff --git a/st/config.h b/st/config.h index 91137b4..2deb3d0 100755 --- a/st/config.h +++ b/st/config.h @@ -83,35 +83,35 @@ char *termname = "st-256color"; unsigned int tabspaces = 8; /* bg opacity */ -unsigned int alpha = 0xf2; +unsigned int alpha = 0xff; /* 0xf2 adds wee bit of transparency */ /* Terminal colors (16 first used in escape sequence) */ static const char *colorname[] = { /* 8 normal colors */ "#282a36", - "#ff5555", - "#50fa7b", - "#f1fa8c", - "#bd93f9", - "#ff79c6", - "#8be9fd", - "#bbbbbb", + "#f07178", + "#c3e88d", + "#ffcb6b", + "#82aaff", + "#c792ea", + "#89ddff", + "#d0d0d0", /* 8 bright colors */ - "#44475a", - "#FF6E67", - "#5AF78E", - "#F4F99D", - "#CAA9FA", - "#FF92D0", - "#9AEDFE", - "#E6E6E6", + "#434758", + "#ff8b92", + "#ddffa7", + "#ffe585", + "#9cc4ff", + "#e1acff", + "#a3f7ff", + "#ffffff", [255] = 0, /* more colors can be added after 255 to use with DefaultXX */ "#282a36", - "#f8f8f2", + "#bbc5ff", "#d7d7d7", };