various changes/fixes regarding scratchpads and floatrules

This commit is contained in:
Luca Bilke 2022-09-13 22:20:45 +02:00
parent edb14d50f5
commit c51faf0289
No known key found for this signature in database
GPG Key ID: 7B77C51E8C779E75
5 changed files with 124 additions and 275 deletions

View File

@ -1,166 +1,3 @@
/* See LICENSE file for copyright and license details. */
#define BROWSER "librewolf"
#define TERMINAL "kitty"
/* appearance */
static unsigned int borderpx = 2; /* border pixel of windows */
static unsigned int snap = 20; /* snap pixel */
static unsigned int gappih = 10; /* horiz inner gap between windows */
static unsigned int gappiv = 10; /* vert inner gap between windows */
static unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
static unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10", "monospace:size=14", "monospace:size=20", "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" };
static char color0[] = "#000000";
static char color1[] = "#7f0000";
static char color2[] = "#007f00";
static char color3[] = "#7f7f00";
static char color4[] = "#00007f";
static char color5[] = "#7f007f";
static char color6[] = "#007f7f";
static char color7[] = "#cccccc";
static char color8[] = "#333333";
static char color9[] = "#ff0000";
static char color10[] = "#00ff00";
static char color11[] = "#ffff00";
static char color12[] = "#0000ff";
static char color13[] = "#ff00ff";
static char color14[] = "#00ffff";
static char color15[] = "#ffffff";
static char bordernorm[] = "#222222";
static char bordersel[] = "#444444";
static char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { color15, color0, bordernorm },
[SchemeSel] = { color15, color4, bordersel },
[SchemeStatus] = { color7, color0, "#000000" }, // Statusbar right
[SchemeTagsSel] = { color0, color4, "#000000" }, // Tagbar left selected
[SchemeTagsNorm] = { color7, color0, "#000000" }, // Tagbar left unselected
[SchemeInfoSel] = { color7, color0, "#000000" }, // infobar middle selected
[SchemeInfoNorm] = { color7, color0, "#000000" }, // infobar middle unselected
};
/* Colors for SGR escapes */
static const char *barcolors[] = {
color0,
color1,
color2,
color3,
color4,
color5,
color6,
color7,
color8,
color9,
color10,
color11,
color12,
color13,
color14,
color15,
};
/* tagging */
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h floatborderpx monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1, -1, -1, -1, -1, -1},
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1, -1},
{ NULL, "dropterm", NULL, 'd', 0, 1, 0, 0, 0, 0, 1, 1, 0, 1},
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .5, .5, -1, -1},
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .5, .5, -1, -1},
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1, -1, -1, -1, -1, -1},
};
/* layout(s) */
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static int nmaster = 1; /* number of clients in master area */
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
#include "vanitygaps.c"
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "[M]", monocle },
{ "[@]", spiral },
{ "[\\]", dwindle },
{ "H[]", deck },
{ "TTT", bstack },
{ "===", bstackhoriz },
{ "HHH", grid },
{ "###", nrowgrid },
{ "---", horizgrid },
{ ":::", gaplessgrid },
{ "|M|", centeredmaster },
{ ">M>", centeredfloatingmaster },
{ "><>", NULL }, /* no layout function means floating behavior */
{ NULL, NULL },
};
/* key definitions */
#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
#define STACKKEYS(MOD,ACTION) \
{MOD, XK_j, ACTION##stack, {.i = INC(+1)}}, \
{MOD, XK_k, ACTION##stack, {.i = INC(-1)}}, \
{MOD, XK_v, ACTION##stack, {.i = 0}}, \
/*{MOD, XK_grave, ACTION##stack, {.i = PREVSEL}}, \ */
/*{MOD, XK_a, ACTION##stack, {.i = 1}}, \ */
/*{MOD, XK_z, ACTION##stack, {.i = 2}}, \ */
/*{MOD, XK_x, ACTION##stack, {.i = -1}}, */
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){"/bin/sh", "-c", cmd, NULL} }
/* commands */
static const char *spqalc[] = { "q", "qalculate-gtk", NULL };
static const char *splf[] = { "l", "kitty", "--name", "splf", "-d", "~", "-e", "lf", NULL };
static const char *sphtop[] = { "h", "kitty", "--name", "sphtop", "-e", "htop", NULL };
/*
* Xresources preferences to load at startup
*/
ResourcePref resources[] = {
{ "color0", STRING, &color0 },
{ "color1", STRING, &color1 },
{ "color2", STRING, &color2 },
{ "color3", STRING, &color3 },
{ "color4", STRING, &color4 },
{ "color5", STRING, &color5 },
{ "color6", STRING, &color6 },
{ "color7", STRING, &color7 },
{ "color8", STRING, &color8 },
{ "color9", STRING, &color9 },
{ "color10", STRING, &color10 },
{ "color11", STRING, &color11 },
{ "color12", STRING, &color12 },
{ "color13", STRING, &color13 },
{ "color14", STRING, &color14 },
{ "color15", STRING, &color15 },
{ "bordernorm", STRING, &bordernorm },
{ "bordersel", STRING, &bordersel },
};
#include <X11/XF86keysym.h>
static Key keys[] = {
STACKKEYS(MODKEY, focus) STACKKEYS(MODKEY | ShiftMask, push)
/* modifier key function argument */
@ -176,8 +13,8 @@
{ MODKEY, XK_F10, spawn, {.v = (const char *[]){"dmenuumount", NULL}} },
/*{ MODKEY, XK_F11, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_F12, spawn, {.v = (const char *[]){"remaps", NULL}} },
{ MODKEY, XK_asciicircum, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
/*{ MODKEY | ShiftMask, XK_asciicircum, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_grave, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
/*{ MODKEY | ShiftMask, XK_grave, spawn, {.v = (const char *[]){NULL}} },*/
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
@ -189,10 +26,10 @@
TAGKEYS( XK_9, 8)
{ MODKEY, XK_0, view, {.ui = ~0} },
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
{ MODKEY, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 5; kill -44 $(pidof dwmblocks)") },
{ MODKEY | ShiftMask, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 15; kill -44 $(pidof dwmblocks)") },
{ MODKEY, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 5; kill -44 $(pidof dwmblocks)") },
{ MODKEY | ShiftMask, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 15; kill -44 $(pidof dwmblocks)") },
{ 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, {.v = (const char *[]){"sysact", NULL}} },
{ MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
{ MODKEY, XK_Tab, view, {0} },
@ -207,8 +44,8 @@
{ MODKEY | ShiftMask, XK_r, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */
{ MODKEY | ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */
{ MODKEY, XK_z, setlayout, {.v = &layouts[2]} }, /* spiral */
{ MODKEY | ShiftMask, XK_z, setlayout, {.v = &layouts[3]} }, /* dwindle */
{ MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, /* spiral */
{ MODKEY | ShiftMask, XK_y, setlayout, {.v = &layouts[3]} }, /* dwindle */
{ MODKEY, XK_u, setlayout, {.v = &layouts[4]} }, /* deck */
{ MODKEY | ShiftMask, XK_u, setlayout, {.v = &layouts[5]} }, /* monocle */
{ MODKEY, XK_i, setlayout, {.v = &layouts[6]} }, /* centeredmaster */
@ -217,10 +54,10 @@
{ MODKEY | ShiftMask, XK_o, incnmaster, {.i = -1} },
{ MODKEY, XK_p, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} },
{ MODKEY | ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv") },
{ MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
{ MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
{ MODKEY, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
{ MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
{ MODKEY, XK_bracketleft, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
{ MODKEY | ShiftMask, XK_bracketleft, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
{ MODKEY, XK_bracketright, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
{ MODKEY | ShiftMask, XK_bracketright, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
{ MODKEY, XK_a, togglegaps, {0} },
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
/*{ MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
@ -236,16 +73,16 @@
/* J and K are automatically bound above in STACKEYS */
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
/*{ MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
/*{ MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_apostrophe, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_apostrophe, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_backslash, togglescratch, {.v = spqalc} },
/*{ MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
{ MODKEY | ShiftMask, XK_Return, spawnsshaware, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
/*{ MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_z, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_z, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
@ -261,8 +98,8 @@
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"mpc", "seek", "0%", NULL}} },
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
{ MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){"mpc", "repeat", NULL}} },
/*{ MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_slash, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_slash, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_space, zoom, {0} },
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
@ -323,20 +160,3 @@
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = (const char *[]){"xbacklight", "-inc", "15", NULL}} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = (const char *[]){"xbacklight", "-dec", "15", NULL}} },
};
/* 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} },
{ 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} },
};

View File

@ -4,6 +4,10 @@
#define TERMINAL "kitty"
/* appearance */
/* Settings */
#if !PERTAG_PATCH
static int enablegaps = 1;
#endif
static unsigned int borderpx = 2; /* border pixel of windows */
static unsigned int snap = 20; /* snap pixel */
static unsigned int gappih = 10; /* horiz inner gap between windows */
@ -14,7 +18,7 @@
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
static int showbar = 1; /* 0 means no bar */
static int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=10", "monospace:size=14", "monospace:size=20", "NotoColorEmoji:pixelsize=10:antialias=true:autohint=true" };
static const char *fonts[] = { "monospace:pixelsize=14", "monospace:pixelsize=20", "monospace:pixelsize=30", "Noto Color Emoji:pixelsize=14:antialias=true:autohint=true" };
static char color0[] = "#000000";
static char color1[] = "#7f0000";
@ -70,16 +74,18 @@
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h floatborderpx monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1, -1, -1, -1, -1, -1},
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1, -1},
{ NULL, "dropterm", NULL, 'd', 0, 1, 0, 0, 0, 0, 1, 1, 0, 1},
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .5, .5, -1, -1},
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .5, .5, -1, -1},
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1, -1, -1, -1, -1, -1},
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
* If X, Y, W or H are between 0 and 1 (inclusive), their values interpreted as percentages of the current monitor resolution.
* If X or Y are negative, they are subtracted from the current monitor resolution and then that value is interpreted.
class instance title scratch key tags mask isfloating isterminal noswallow x, y, w, h borderpx monitor */
{ "Gimp", NULL, NULL, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, -1},
{ "Qalculate-gtk", NULL, NULL, 'q', 0, 1, 0, 0, .5, .5, 722, 512, -1, -1},
{ NULL, "spterm", NULL, 't', 0, 1, 1, 0, 0, 0, 1, 1, 0, 0},
{ NULL, "splf", NULL, 'l', 0, 1, 0, 0, .5, .5, .8, .8, -1, -1},
{ NULL, "sphtop", NULL, 'h', 0, 1, 0, 0, .5, .5, .8, .8, -1, -1},
{ NULL, "spmix", NULL, 'm', 0, 1, 0, 0, -4, -4, 900, 600, -1, -1},
{ NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, -1},
};
@ -131,9 +137,11 @@
#define SHCMD(cmd) { .v = (const char*[]){"/bin/sh", "-c", cmd, NULL} }
/* commands */
static const char *spterm[] = { "t", "/bin/sh", "-c", "$TERMINAL --name spterm --config ~/.config/kitty/kitty.conf --config ~/.config/kitty/kittyfullscreen.conf" };
static const char *spqalc[] = { "q", "qalculate-gtk", NULL };
static const char *splf[] = { "l", "kitty", "--name", "splf", "-d", "~", "-e", "lf", NULL };
static const char *sphtop[] = { "h", "kitty", "--name", "sphtop", "-e", "htop", NULL };
static const char *splf[] = { "l", TERMINAL, "--name", "splf", "-d", "~", "-e", "lf", NULL };
static const char *sphtop[] = { "h", TERMINAL, "--name", "sphtop", "-e", "htop", NULL };
static const char *spmix[] = { "m", "/bin/sh", "-c", "$TERMINAL --name spmix -e pulsemixer; pkill -RTMIN+10 dwmblocks" };
/*
* Xresources preferences to load at startup
@ -166,7 +174,7 @@
/* modifier key function argument */
{ MODKEY, XK_F1, spawn, SHCMD("groff -mom /usr/local/share/dwm/keybinds.mom -Tpdf | zathura -") },
{ MODKEY, XK_F2, spawn, {.v = (const char *[]){TERMINAL, "-e", "deluge-console"}} },
{ MODKEY, XK_F3, spawn, SHCMD(TERMINAL "-e pulsemixer; kill -44 $(pidof dwmblocks)") },
{ MODKEY, XK_F3, togglescratch, {.v = spmix} },
/*{ MODKEY, XK_F4, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_F5, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_F6, spawn, {.v = (const char *[]){NULL}} },*/
@ -176,8 +184,8 @@
{ MODKEY, XK_F10, spawn, {.v = (const char *[]){"dmenuumount", NULL}} },
/*{ MODKEY, XK_F11, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_F12, spawn, {.v = (const char *[]){"remaps", NULL}} },
{ MODKEY, XK_grave, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
/*{ MODKEY | ShiftMask, XK_grave, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_asciicircum, spawn, {.v = (const char *[]){"dmenuunicode", NULL}} },
/*{ MODKEY | ShiftMask, XK_asciicircum, spawn, {.v = (const char *[]){NULL}} },*/
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
@ -189,10 +197,10 @@
TAGKEYS( XK_9, 8)
{ MODKEY, XK_0, view, {.ui = ~0} },
{ MODKEY | ShiftMask, XK_0, tag, {.ui = ~0} },
{ 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_ssharp, spawn, SHCMD("pamixer --allow-boost -d 5; pkill -RTMIN+10 dwmblocks)") },
{ MODKEY | ShiftMask, XK_ssharp, spawn, SHCMD("pamixer --allow-boost -d 15; pkill -RTMIN+10 dwmblocks)") },
{ MODKEY, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 5; pkill -RTMIN+10 dwmblocks)") },
{ MODKEY | ShiftMask, XK_acute, spawn, SHCMD("pamixer --allow-boost -i 15; pkill -RTMIN+10 dwmblocks)") },
{ MODKEY, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
{ MODKEY | ShiftMask, XK_BackSpace, spawn, {.v = (const char *[]){"sysact", NULL}} },
{ MODKEY, XK_Tab, view, {0} },
@ -207,8 +215,8 @@
{ MODKEY | ShiftMask, XK_r, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, /* tile */
{ MODKEY | ShiftMask, XK_t, setlayout, {.v = &layouts[1]} }, /* bstack */
{ MODKEY, XK_y, setlayout, {.v = &layouts[2]} }, /* spiral */
{ MODKEY | ShiftMask, XK_y, setlayout, {.v = &layouts[3]} }, /* dwindle */
{ MODKEY, XK_z, setlayout, {.v = &layouts[2]} }, /* spiral */
{ MODKEY | ShiftMask, XK_z, setlayout, {.v = &layouts[3]} }, /* dwindle */
{ MODKEY, XK_u, setlayout, {.v = &layouts[4]} }, /* deck */
{ MODKEY | ShiftMask, XK_u, setlayout, {.v = &layouts[5]} }, /* monocle */
{ MODKEY, XK_i, setlayout, {.v = &layouts[6]} }, /* centeredmaster */
@ -217,10 +225,10 @@
{ MODKEY | ShiftMask, XK_o, incnmaster, {.i = -1} },
{ MODKEY, XK_p, spawn, {.v = (const char *[]){"mpc", "toggle", NULL}} },
{ MODKEY | ShiftMask, XK_p, spawn, SHCMD("mpc pause ; pauseallmpv") },
{ MODKEY, XK_bracketleft, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
{ MODKEY | ShiftMask, XK_bracketleft, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
{ MODKEY, XK_bracketright, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
{ MODKEY | ShiftMask, XK_bracketright, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
{ MODKEY, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-10", NULL}} },
{ MODKEY | ShiftMask, XK_udiaeresis, spawn, {.v = (const char *[]){"mpc", "seek", "-60", NULL}} },
{ MODKEY, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+10", NULL}} },
{ MODKEY | ShiftMask, XK_plus, spawn, {.v = (const char *[]){"mpc", "seek", "+60", NULL}} },
{ MODKEY, XK_a, togglegaps, {0} },
{ MODKEY | ShiftMask, XK_a, defaultgaps, {0} },
/*{ MODKEY, XK_s, spawn, {.v = (const char *[]){NULL}} },*/
@ -233,19 +241,19 @@
/*{ MODKEY | ShiftMask, XK_g, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
/*{ MODKEY | ShiftMask, XK_h, spawn, {.v = (const char *[]){NULL}} },*/
/* J and K are automatically bound above in STACKEYS */
/* J and K are automatically bound above in STACKKEYS */
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
/*{ MODKEY | ShiftMask, XK_l, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_semicolon, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_apostrophe, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_apostrophe, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_backslash, togglescratch, {.v = spqalc} },
/*{ MODKEY | ShiftMask, XK_backslash, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_odiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_adiaeresis, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_numbersign, togglescratch, {.v = spqalc} },
/*{ MODKEY | ShiftMask, XK_numbersign, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_Return, spawn, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
{ MODKEY | ShiftMask, XK_Return, spawnsshaware, {.v = (const char *[]){TERMINAL, "-d", "~", NULL}} },
/*{ MODKEY, XK_z, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_z, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY | ShiftMask, XK_Return, togglescratch, {.v = spterm} },
/*{ MODKEY, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_y, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_x, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_c, spawn, {.v = (const char *[]){NULL}} },*/
@ -261,8 +269,8 @@
{ MODKEY | ShiftMask, XK_comma, spawn, {.v = (const char *[]){"mpc", "seek", "0%", NULL}} },
{ MODKEY, XK_period, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
{ MODKEY | ShiftMask, XK_period, spawn, {.v = (const char *[]){"mpc", "repeat", NULL}} },
/*{ MODKEY, XK_slash, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_slash, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_minus, spawn, {.v = (const char *[]){NULL}} },*/
{ MODKEY, XK_space, zoom, {0} },
{ MODKEY | ShiftMask, XK_space, togglefloating, {0} },
{ 0, XK_Print, spawn, SHCMD("maim ~/Photos/Screenshots/pic-full-$(date '+%y%m%d-%H%M-%S').png") },
@ -294,9 +302,9 @@
/*{ MODKEY, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
/*{ MODKEY | ShiftMask, XK_Down, spawn, {.v = (const char *[]){NULL}} },*/
{ 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_AudioMute, spawn, SHCMD("pamixer -t; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --allow-boost -i 3; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --allow-boost -d 3; pkill -RTMIN+10 dwmblocks") },
{ 0, XF86XK_AudioPrev, spawn, {.v = (const char *[]){"mpc", "prev", NULL}} },
{ 0, XF86XK_AudioNext, spawn, {.v = (const char *[]){"mpc", "next", NULL}} },
{ 0, XF86XK_AudioPause, spawn, {.v = (const char *[]){"mpc", "pause", NULL}} },
@ -310,18 +318,19 @@
{ 0, XF86XK_Calculator, spawn, {.v = (const char *[]){TERMINAL, "-e", "bc", "-l", NULL}} },
{ 0, XF86XK_Sleep, spawn, {.v = (const char *[]){"sudo", "-A", "zzz", NULL}} },
{ 0, XF86XK_WWW, spawn, {.v = (const char *[]){BROWSER, NULL}} },
{ 0, XF86XK_WLAN, spawn, SHCMD("sleep 0.1; pkill -RTMIN+4 dwmblocks") },
{ 0, XF86XK_DOS, spawn, {.v = (const char *[]){TERMINAL, NULL}} },
{ 0, XF86XK_ScreenSaver, spawn, SHCMD("xset s activate & mpc pause & pauseallmpv") },
{ 0, XF86XK_TaskPane, spawn, {.v = (const char *[]){TERMINAL, "-e", "htop", NULL}} },
{ 0, XF86XK_Mail, spawn, SHCMD("kitty -e neomutt; pkill -RTMIN+12 dwmblocks") },
{ 0, XF86XK_Mail, spawn, SHCMD("$TERMINAL -e neomutt; pkill -RTMIN+12 dwmblocks") },
{ 0, XF86XK_MyComputer, spawn, {.v = (const char *[]){TERMINAL, "-e", "lfub", "/", NULL}} },
/*{ 0, XF86XK_Battery, spawn, {.v = (const char *[]){NULL}} }, */
{ 0, XF86XK_Launch1, spawn, {.v = (const char *[]){"xset", "dpms", "force", "off", NULL}} },
{ 0, XF86XK_TouchpadToggle, spawn, SHCMD("(synclient | grep 'TouchpadOff.*1' && synclient TouchpadOff=0) || " "synclient TouchpadOff=1") },
{ 0, XF86XK_TouchpadOff, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=1", NULL}} },
{ 0, XF86XK_TouchpadOn, spawn, {.v = (const char *[]){"synclient", "TouchpadOff=0", NULL}} },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = (const char *[]){"xbacklight", "-inc", "15", NULL}} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = (const char *[]){"xbacklight", "-dec", "15", NULL}} },
{ 0, XF86XK_MonBrightnessUp, spawn, {.v = (const char *[]){"xbacklight", "-inc", "5", NULL}} },
{ 0, XF86XK_MonBrightnessDown, spawn, {.v = (const char *[]){"xbacklight", "-dec", "5", NULL}} },
};
/* button definitions */

2
drw.c
View File

@ -203,6 +203,8 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
DefaultColormap(drw->dpy, drw->screen),
clrname, dest))
die("error, cannot allocate color '%s'", clrname);
dest->pixel |= 0xff << 24;
}
/* Wrapper to create color schemes. The caller has to call free(3) on the

69
dwm.c
View File

@ -20,6 +20,9 @@
*
* To understand everything else, start reading main().
*/
// TODO: Update maximized spterm window when toggling bar
#include <errno.h>
#include <locale.h>
#include <signal.h>
@ -376,6 +379,9 @@ applyrules(Client *c)
&& (!r->class || strstr(class, r->class))
&& (!r->instance || strstr(instance, r->instance)))
{
for (m = mons; m && m->num != r->monitor; m = m->next);
if (m)
c->mon = m;
c->isterminal = r->isterminal;
c->noswallow = r->noswallow;
c->isfloating = r->isfloating;
@ -385,19 +391,28 @@ applyrules(Client *c)
c->floatborderpx = r->floatborderpx;
c->hasfloatbw = 1;
}
- (bh + m->by);
if (r->isfloating) {
if (r->floatw > 1 || r->floatw == 0) c->w = r->floatw;
else if (r->floatw > 0) c->w = (int)((float)c->mon->mw * r->floatw);
if (r->floath > 1 || r->floath == 0) c->h = r->floath;
else if (r->floath > 0) c->h = (int)((float)c->mon->mh * r->floath);
if (r->floatx > 1 || r->floatx == 0) c->x = c->mon->mx + r->floatx;
else if (r->floatx > 0) c->x = c->mon->mx + (int)((float)c->mon->mw * r->floatx - (float)c->w / 2);
if (r->floaty > 1 || r->floaty == 0) c->y = c->mon->my + r->floaty;
else if (r->floaty > 0) c->y = c->mon->my + (int)((float)c->mon->mh * r->floaty - (float)c->h / 2);
if (r->floatw > 1) c->w = r->floatw - c->floatborderpx * 2;
else if (r->floatw > 0) c->w = (int)((float)c->mon->mw * r->floatw - c->floatborderpx * 2);
if (r->floath > 1) c->h = r->floath - c->floatborderpx * 2 - (bh + m->by);
else if (r->floath > 0) c->h = (int)((float)c->mon->mh * r->floath - c->floatborderpx * 2) - (bh + m->by);
if (r->floatx > 1) c->x = c->mon->mx + r->floatx;
else if (r->floatx > 0) c->x = c->mon->mx + (int)((float)c->mon->mw * r->floatx - (float)c->w / 2);
else if (r->floatx == 0);
else if (r->floatx > -1) c->x = c->mon->mx + c->mon->mw + (int)((float)c->mon->mw * r->floatx - (float)c->w / 2);
else c->x = c->mon->mx + c->mon->mw + r->floatx - c->w;
if (r->floaty > 1) c->y = c->mon->my + r->floaty;
else if (r->floaty > 0) c->y = c->mon->my + (int)((float)c->mon->mh * r->floaty - (float)c->h / 2);
else if (r->floaty == 0);
else if (r->floaty > -1) c->y = c->mon->my + c->mon->mh + (int)((float)c->mon->mh * r->floaty - (float)c->h / 2);
else c->y = c->mon->my + c->mon->mh + r->floaty - c->h;
}
for (m = mons; m && m->num != r->monitor; m = m->next);
if (m)
c->mon = m;
}
}
if (ch.res_class)
@ -1471,7 +1486,10 @@ manage(Window w, XWindowAttributes *wa)
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
c->bw = borderpx;
if (c->hasfloatbw)
c->bw = c->floatborderpx;
else
c->bw = borderpx;
wc.border_width = c->bw;
XConfigureWindow(dpy, w, CWBorderWidth, &wc);
@ -2271,18 +2289,23 @@ togglescratch(const Arg *arg)
{
Client *c;
unsigned int found = 0;
for (c = selmon->clients; c && !(found = c->scratchkey == ((char**)arg->v)[0][0]); c = c->next);
Monitor *m;
for(m = mons; m; m = m->next) {
for (c = m->clients; c && !(found = c->scratchkey == ((char**)arg->v)[0][0]); c = c->next);
if (found)
break;
}
if (found) {
c->tags = ISVISIBLE(c) ? 0 : selmon->tagset[selmon->seltags];
focus(NULL);
arrange(selmon);
if (ISVISIBLE(c)) {
focus(c);
restack(selmon);
}
if(m != selmon);
else {
c->tags = ISVISIBLE(c) ? 0 : selmon->tagset[selmon->seltags];
focus(NULL);
arrange(selmon);
if (ISVISIBLE(c)) {
focus(c);
restack(selmon);
}
}
} else{
spawnscratch(arg);
}

View File

@ -25,11 +25,6 @@ static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int
static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr);
static void setgaps(int oh, int ov, int ih, int iv);
/* Settings */
#if !PERTAG_PATCH
static int enablegaps = 1;
#endif // PERTAG_PATCH
void
setgaps(int oh, int ov, int ih, int iv)
{
@ -806,4 +801,4 @@ tile(Monitor *m)
resize(c, sx, sy, sw - (2*c->bw), (sh / sfacts) + ((i - m->nmaster) < srest ? 1 : 0) - (2*c->bw), 0);
sy += HEIGHT(c) + ih;
}
}
}