From 9700613d3ef8003df033f3f44239426946036bbb Mon Sep 17 00:00:00 2001 From: speediegq Date: Sat, 22 Oct 2022 21:09:56 +0200 Subject: [PATCH] Add keybind for resizing bar height --- docs/example.signal | 2 ++ docs/keybinds | 34 ++++++++++++++++++---------------- keybinds.h | 2 ++ speedwm.c | 17 +++++++++++++++++ 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/docs/example.signal b/docs/example.signal index 3d04aaa..0fe565d 100644 --- a/docs/example.signal +++ b/docs/example.signal @@ -76,4 +76,6 @@ - 76 | Toggle the sticky indicator area in the bar - 77 | Toggle the icon in the window title - 78 | Show all bar modules + - 79 | Increase bar height by 1 + - 80 | Decrease bar height by 1 diff --git a/docs/keybinds b/docs/keybinds index f195920..9174098 100644 --- a/docs/keybinds +++ b/docs/keybinds @@ -29,27 +29,17 @@ - Super+s | Show/hide the systray - Super+j/k | Move focus between visible windows - Super+m | Moves focus to the Master window (or back if Master is already focused) - - Super+Control+z/x | Increase/decrease gaps between windows by 5 - - Super+Control+j/k | Move focus between hidden windows (Can then 'Show') - Super+a/d | Increase/decrease size of each window + - Super+w/e | Resize the window keeping the aspect ratio of it. - Super+o | Hide a window - - Super+Control+o | Show a hidden focused window - - Super+Control+Shift+o | Show all hidden windows - - Super+Control+Shift+p | Hide all windows - - Super+Control+a/d | Move to the next/previous tag - - Super+Control+Shift+z/c | Move to the next/previous tag skipping any without windows open - Super+Minus | Show the scratchpad - Super+Equal | Remove the scratchpad - Super+Enter | Switch order of windows - - Super+Shift+q | Close the current window - Super+Colon | Open a list of desktop entries in dmenu + - Super+Tab | Switch between windows on the same tag. (Like Windows Alt+Tab) - Super+0 | Reset mfact - Super+r | Reset number of masters - - Super+Shift+Equal | Toggle scratchpads - - Super+Shift+Minus | Hide the scratchpad - - Super+Shift+Space | Toggle floating windows - Super+y | Make the current selected window sticky - - Super+Shift+Arrow | Resizes a window in floating mode - Super+1 | Move to tag 1 - Super+2 | Move to tag 2 - Super+3 | Move to tag 3 @@ -68,8 +58,14 @@ - Super+Shift+7 | Preview tag 7 - Super+Shift+8 | Preview tag 8 - Super+Shift+9 | Preview tag 9 + - Super+Shift+q | Close the current window - Super+Shift+h/j/k/l | Rotates a stack. + - Super+Shift+Arrow | Resizes a window in floating mode - Super+Shift+Escape | Ask the user if they want to shutdown or reboot or nothing + - Super+Shift+Tab | Switch between windows and tags in detail. + - Super+Shift+Equal | Toggle scratchpads + - Super+Shift+Minus | Hide the scratchpad + - Super+Shift+Space | Toggle floating windows - Super+Control+1 | Combine the current tag with tag 1 - Super+Control+2 | Combine the current tag with tag 2 - Super+Control+3 | Combine the current tag with tag 3 @@ -79,14 +75,21 @@ - Super+Control+7 | Combine the current tag with tag 7 - Super+Control+8 | Combine the current tag with tag 8 - Super+Control+9 | Combine the current tag with tag 9 - - Super+Control+Shift+Colon | Open a list of extra software in dmenu - Super+Control+q | Mutes your audio - Super+Control+w | Increases your volume - Super+Control+e | Decreases your volume - Super+Control+0 | Tag all tags at once. + - Super+Control+z/x | Increase/decrease gaps between windows by 5 + - Super+Control+j/k | Move focus between hidden windows (Can then 'Show') - Super+Control+Arrow | Moves a window to any corner of your screen (Arrow key) - Super+Control+Tab | Open a dmenu prompt asking the user what layout to switch to - Super+Control+h | Open a list of all keybinds in your terminal using less + - Super+Control+o | Show a hidden focused window + - Super+Control+a/d | Move to the next/previous tag + - Super+Control+Shift+o | Show all hidden windows + - Super+Control+Shift+p | Hide all windows + - Super+Control+Shift+Colon | Open a list of extra software in dmenu + - Super+Control+Shift+z/c | Move to the next/previous tag skipping any without windows open - Super+Control+Shift+a/d | Move between available layouts - Super+Control+Shift+1 | Move the focused window to tag 1 - Super+Control+Shift+2 | Move the focused window to tag 2 @@ -107,10 +110,9 @@ - Super+Control+Shift+w | Decreases your music volume - Super+Control+Shift+e | Increase your music volume - Super+Control+Shift+r | Restart speedwm - - Super+w/e | Resize the window keeping the aspect ratio of it. - - Super+Tab | Switch between windows on the same tag. (Like Windows Alt+Tab) - - Super+Shift+Tab | Switch between windows and tags in detail. - Super+Control+Shift+j/k | Change window size vertically (cfact) + - Super+Control+Shift+Equal | Increase bar height by 1 + - Super+Control+Shift+Minus | Decrease bar height by 1 -- Chained keybinds -- diff --git a/keybinds.h b/keybinds.h index 0f8a9b0..c6ea2dc 100644 --- a/keybinds.h +++ b/keybinds.h @@ -122,6 +122,8 @@ static Key keys[] = { { MODIFIER1, -1, XK_n, incmastercount, {.i = -1 } }, { MODIFIER1, -1, XK_i, incmastercount, {.i = +1 } }, { MODIFIER1, -1, XK_y, togglesticky, {0} }, + { MODIFIER1|CONTROL|SHIFT, -1, XK_equal, setbarheight, {.i = +1} }, + { MODIFIER1|CONTROL|SHIFT, -1, XK_minus, setbarheight, {.i = -1} }, /* Floating mode keybinds */ { MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} }, diff --git a/speedwm.c b/speedwm.c index 2bebc92..5188ef3 100644 --- a/speedwm.c +++ b/speedwm.c @@ -612,6 +612,7 @@ static void resetbar(const Arg *arg); static void toggleopacity(const Arg *arg); static void togglefullscr(const Arg *arg); +static void setbarheight(const Arg *arg); #if USEWINICON static void freeicon(Client *c); #endif @@ -3233,6 +3234,22 @@ togglewin(const Arg *arg) } #endif +void +setbarheight(const Arg *arg) +{ + if (altbar) + return; + + bh += arg->i; + + if (bh < drw->fonts->h) + bh = altbar ? 0 : drw->fonts->h; + + updatebarpos(selmon); + resizebarwin(selmon); + arrange(selmon); +} + void togglegaps(const Arg *arg) {