aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-05-23 17:01:10 -0700
committerFuwn <[email protected]>2024-05-23 17:01:10 -0700
commit7122b817bdc4f56adb8d77b548477a6dc1089987 (patch)
treed69b4739acdf617b0bed96e98953df19352f403b
parentfeat(config.h): replace default programs (diff)
downloadseiwm-7122b817bdc4f56adb8d77b548477a6dc1089987.tar.xz
seiwm-7122b817bdc4f56adb8d77b548477a6dc1089987.zip
feat(config.h): reactive togglebar
-rw-r--r--config.h2
-rw-r--r--dwm.c18
-rw-r--r--vanitygaps.c2
3 files changed, 20 insertions, 2 deletions
diff --git a/config.h b/config.h
index 4bdc12b..d5f9be4 100644
--- a/config.h
+++ b/config.h
@@ -238,7 +238,7 @@ static const Key keys[] = {
/* { MODKEY, XK_c, spawn, {.v = (const char*[]){ TERMINAL, "-e", "profanity", NULL } } }, */
/* { MODKEY|ShiftMask, XK_c, spawn, SHCMD("") }, */
/* V is automatically bound above in STACKKEYS */
- { MODKEY, XK_b, togglebar, {0} },
+ { MODKEY, XK_b, togglebar, {.i = 2} },
/* { MODKEY|ShiftMask, XK_b, spawn, SHCMD("") }, */
/* { MODKEY, XK_n, spawn, {.v = (const char*[]){ TERMINAL, "-e", "nvim", "-c", "VimwikiIndex", NULL } } }, */
{ MODKEY|ShiftMask, XK_n, spawn, SHCMD(BROWSER " https://sumi.news ; pkill -RTMIN+6 dwmblocks") },
diff --git a/dwm.c b/dwm.c
index 21f770d..a7018f4 100644
--- a/dwm.c
+++ b/dwm.c
@@ -380,6 +380,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned int numlockmask = 0;
static int enablefullscreen = 0;
static int enableoutergaps = 1;
+static int manuallytoggledbar = 0;
static int lrpad; /* sum of left and right padding for text */
static void (*handler[LASTEvent]) (XEvent *) = {
[ButtonPress] = buttonpress,
@@ -2465,6 +2466,14 @@ tagmon(const Arg *arg)
void
togglebar(const Arg *arg)
{
+ if (arg != NULL && arg->i) {
+ if (manuallytoggledbar == 1 && arg->i == 2) {
+ manuallytoggledbar = 0;
+ } else if (manuallytoggledbar == 0 && arg->i == 2) {
+ manuallytoggledbar = 1;
+ }
+ }
+
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
updatebarpos(selmon);
resizebarwin(selmon);
@@ -2501,7 +2510,14 @@ togglefullscr(const Arg *arg)
{
if(selmon->sel) {
setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
- togglebar(NULL);
+
+ if (((!selmon->sel->isfullscreen
+ && !selmon->pertag->showbars[selmon->pertag->curtag])
+ || (selmon->sel->isfullscreen
+ && selmon->pertag->showbars[selmon->pertag->curtag]))
+ && manuallytoggledbar == 0) {
+ togglebar(NULL);
+ }
}
}
diff --git a/vanitygaps.c b/vanitygaps.c
index 4c98e69..0877d33 100644
--- a/vanitygaps.c
+++ b/vanitygaps.c
@@ -26,6 +26,8 @@ static void setgaps(int oh, int ov, int ih, int iv);
/* Settings */
static int enablegaps = 1;
+static const int vertpad_original = vertpad;
+static const int sidepad_original = sidepad;
static void
setgaps(int oh, int ov, int ih, int iv)