more configuration
parent
36d3819b9d
commit
b1c607630b
7
README
7
README
|
|
@ -2,6 +2,13 @@ dwm - dynamic window manager
|
|||
============================
|
||||
dwm is an extremely fast, small, and dynamic window manager for X.
|
||||
|
||||
Installed patches
|
||||
-----------------
|
||||
underlinetags
|
||||
cool autostart
|
||||
|
||||
Used xkb-switch for multiple kayoubard layouts support
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
|
|
|||
10
config.def.h
10
config.def.h
|
|
@ -18,9 +18,19 @@ static const char *colors[][3] = {
|
|||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
|
||||
static const char *const autostart[] = {
|
||||
"st", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
|
||||
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
|
||||
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
|
||||
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
|
|
|
|||
40
config.h
40
config.h
|
|
@ -8,10 +8,15 @@ 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 char *fonts[] = {
|
||||
"JetBrainsMono Nerd Font:size=12",
|
||||
//"monospace:size=12",
|
||||
"FontAwesome 6 Free:size=12",
|
||||
//"NotoColorEmoji:size=10"
|
||||
//"Noto Sans:size=14",
|
||||
"Hack:pixelsize=16",
|
||||
// "JoyPixels:pixelsize=12:antialias=true:autohint=true",
|
||||
"JetBrains Nerd Font:size=14",
|
||||
//"JoyPixels:size=12",
|
||||
"monospace:size=12",
|
||||
//"FontAwesome 6 Brands:size=12,"
|
||||
// "FontAwesome 6 Free:size=12,"
|
||||
//"Noto Color Emoji:size=12"
|
||||
};
|
||||
static const char dmenufont[] = "monospace:size=10:antialias=true:autohint=true";
|
||||
static const char col_gray1[] = "#222222";
|
||||
|
|
@ -26,11 +31,33 @@ static const char *colors[][3] = {
|
|||
};
|
||||
|
||||
static const char *keyboardLayouts[] = { "us", "ru" };
|
||||
static int currentKeyboardLayout = 0;
|
||||
static void switchKeyboardLayout(const Arg *arg) {
|
||||
currentKeyboardLayout = (currentKeyboardLayout + arg->i) % LENGTH(keyboardLayouts);
|
||||
const char *switchcmd[] = { "xkb-switch", "-s", keyboardLayouts[currentKeyboardLayout], NULL };
|
||||
const char *reloadcmd[] = { "pkill", "-RTMIN+11", "dwmblocks", NULL };
|
||||
const Arg sarg = {.v = switchcmd};
|
||||
spawn(&sarg);
|
||||
const Arg rarg = {.v = reloadcmd};
|
||||
spawn(&rarg);
|
||||
}
|
||||
|
||||
static const char *const autostart[] = {
|
||||
"dwmblocks", NULL,
|
||||
"setxkbmap", "-layout", "us,ru", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "", "", "", "", "", "", "", "", "9" };
|
||||
|
||||
static const Rule rules[] = {i
|
||||
static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
|
||||
static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
|
||||
static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
|
||||
static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* WM_NAME(STRING) = title
|
||||
|
|
@ -55,6 +82,7 @@ static const Layout layouts[] = {
|
|||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define WINKEY Mod4Mask
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
|
|
@ -80,7 +108,7 @@ static Key keys[] = {
|
|||
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks") },
|
||||
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
|
||||
{ 0, XK_Print, spawn, {.v = screenshot } },
|
||||
{ MODKEY, XK_Shift_L,spawn, {.v }},
|
||||
{ WINKEY, XK_space, switchKeyboardLayout, {.i = +1 } },
|
||||
{ MODKEY, XK_b, togglebar, {0} },
|
||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..ed056a4 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -18,6 +18,11 @@ static const char *colors[][3] = {
|
||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||
};
|
||||
|
||||
+static const char *const autostart[] = {
|
||||
+ "st", NULL,
|
||||
+ NULL /* terminate */
|
||||
+};
|
||||
+
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 9fd0286..1facd56 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
+static void autostart_exec(void);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
@@ -275,6 +276,34 @@ static Window root, wmcheckwin;
|
||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
+/* dwm will keep pid's of processes from autostart array and kill them at quit */
|
||||
+static pid_t *autostart_pids;
|
||||
+static size_t autostart_len;
|
||||
+
|
||||
+/* execute command from autostart array */
|
||||
+static void
|
||||
+autostart_exec() {
|
||||
+ const char *const *p;
|
||||
+ size_t i = 0;
|
||||
+
|
||||
+ /* count entries */
|
||||
+ for (p = autostart; *p; autostart_len++, p++)
|
||||
+ while (*++p);
|
||||
+
|
||||
+ autostart_pids = malloc(autostart_len * sizeof(pid_t));
|
||||
+ for (p = autostart; *p; i++, p++) {
|
||||
+ if ((autostart_pids[i] = fork()) == 0) {
|
||||
+ setsid();
|
||||
+ execvp(*p, (char *const *)p);
|
||||
+ fprintf(stderr, "dwm: execvp %s\n", *p);
|
||||
+ perror(" failed");
|
||||
+ _exit(EXIT_FAILURE);
|
||||
+ }
|
||||
+ /* skip arguments */
|
||||
+ while (*++p);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/* function implementations */
|
||||
void
|
||||
applyrules(Client *c)
|
||||
@@ -1249,6 +1278,16 @@ propertynotify(XEvent *e)
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
+ size_t i;
|
||||
+
|
||||
+ /* kill child processes */
|
||||
+ for (i = 0; i < autostart_len; i++) {
|
||||
+ if (0 < autostart_pids[i]) {
|
||||
+ kill(autostart_pids[i], SIGTERM);
|
||||
+ waitpid(autostart_pids[i], NULL, 0);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
running = 0;
|
||||
}
|
||||
|
||||
@@ -1632,9 +1671,25 @@ showhide(Client *c)
|
||||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
+ pid_t pid;
|
||||
+
|
||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||
die("can't install SIGCHLD handler:");
|
||||
- while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
+ while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
|
||||
+ pid_t *p, *lim;
|
||||
+
|
||||
+ if (!(p = autostart_pids))
|
||||
+ continue;
|
||||
+ lim = &p[autostart_len];
|
||||
+
|
||||
+ for (; p < lim; p++) {
|
||||
+ if (*p == pid) {
|
||||
+ *p = -1;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2139,6 +2194,7 @@ main(int argc, char *argv[])
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
checkotherwm();
|
||||
+ autostart_exec();
|
||||
setup();
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
diff -pu dwm.git/config.def.h dwm.underlinetags/config.def.h
|
||||
--- dwm.git/config.def.h 2021-02-27 20:04:32.030570909 -0600
|
||||
+++ dwm.underlinetags/config.def.h 2021-03-16 16:42:26.278703624 -0500
|
||||
@@ -21,6 +21,11 @@ static const char *colors[][3] = {
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
||||
+static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
|
||||
+static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
|
||||
+static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
|
||||
+static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
|
||||
+
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
diff -pu dwm.git/dwm.c dwm.underlinetags/dwm.c
|
||||
--- dwm.git/dwm.c 2021-02-27 20:04:32.030570909 -0600
|
||||
+++ dwm.underlinetags/dwm.c 2021-03-16 16:41:21.468077151 -0500
|
||||
@@ -719,6 +719,8 @@ drawbar(Monitor *m)
|
||||
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 (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
|
||||
+ drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
60
dwm.c
60
dwm.c
|
|
@ -234,6 +234,7 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
|||
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
static void autostart_exec(void);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
|
|
@ -275,6 +276,34 @@ static Window root, wmcheckwin;
|
|||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||
|
||||
/* dwm will keep pid's of processes from autostart array and kill them at quit */
|
||||
static pid_t *autostart_pids;
|
||||
static size_t autostart_len;
|
||||
|
||||
/* execute command from autostart array */
|
||||
static void
|
||||
autostart_exec() {
|
||||
const char *const *p;
|
||||
size_t i = 0;
|
||||
|
||||
/* count entries */
|
||||
for (p = autostart; *p; autostart_len++, p++)
|
||||
while (*++p);
|
||||
|
||||
autostart_pids = malloc(autostart_len * sizeof(pid_t));
|
||||
for (p = autostart; *p; i++, p++) {
|
||||
if ((autostart_pids[i] = fork()) == 0) {
|
||||
setsid();
|
||||
execvp(*p, (char *const *)p);
|
||||
fprintf(stderr, "dwm: execvp %s\n", *p);
|
||||
perror(" failed");
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
/* skip arguments */
|
||||
while (*++p);
|
||||
}
|
||||
}
|
||||
|
||||
/* function implementations */
|
||||
void
|
||||
applyrules(Client *c)
|
||||
|
|
@ -725,6 +754,8 @@ drawbar(Monitor *m)
|
|||
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 (ulineall || m->tagset[m->seltags] & 1 << i) /* if there are conflicts, just move these lines directly underneath both 'drw_setscheme' and 'drw_text' :) */
|
||||
drw_rect(drw, x + ulinepad, bh - ulinestroke - ulinevoffset, w - (ulinepad * 2), ulinestroke, 1, 0);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
|
|
@ -1255,6 +1286,16 @@ propertynotify(XEvent *e)
|
|||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
/* kill child processes */
|
||||
for (i = 0; i < autostart_len; i++) {
|
||||
if (0 < autostart_pids[i]) {
|
||||
kill(autostart_pids[i], SIGTERM);
|
||||
waitpid(autostart_pids[i], NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
running = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1638,9 +1679,25 @@ showhide(Client *c)
|
|||
void
|
||||
sigchld(int unused)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||
die("can't install SIGCHLD handler:");
|
||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
|
||||
pid_t *p, *lim;
|
||||
|
||||
if (!(p = autostart_pids))
|
||||
continue;
|
||||
lim = &p[autostart_len];
|
||||
|
||||
for (; p < lim; p++) {
|
||||
if (*p == pid) {
|
||||
*p = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -2146,6 +2203,7 @@ main(int argc, char *argv[])
|
|||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
checkotherwm();
|
||||
autostart_exec();
|
||||
setup();
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue