From f7e22401b1bf3f802b0968ee6acad5efc0419022 Mon Sep 17 00:00:00 2001 From: speedie Date: Wed, 18 Jan 2023 17:53:12 +0100 Subject: [PATCH] add keybinds for layout stuff --- README.md | 88 +++++++++++++++++++------------- docs/keybinds | 18 +++++++ keybinds.h | 21 ++++++-- speedwm.1 | 138 ++++++++++++++++++++++++++++++-------------------- speedwm.c | 16 +++--- toggle.h | 1 - 6 files changed, 181 insertions(+), 101 deletions(-) diff --git a/README.md b/README.md index bdd6349..f33faa1 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## What is speedwm? -speedwm is a window manager forked from suckless.org's dwm or dynamic window manager. It manages the user's open windows and tiles them according to a set layout (dynamic). +speedwm is a window manager forked from dwm or dynamic window manager. It manages the user's open windows and tiles them according to a set layout (dynamic). Just like dwm, speedwm also tries to be minimal but also has functionality and aesthetics as a goal. Tiling window managers (unlike floating window managers that you may be used to) tile windows based on a set layout making them easy to get productive on. They also encourage the user to use their keyboard instead of the mouse so that the user doesn't have to move his hands much but there are also mouse binds and more can be added by the user if desired. ## Installation @@ -149,12 +149,10 @@ These keybinds are for navigating speedwm - 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 the man page for speedwm in dmenu. - 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 @@ -181,8 +179,7 @@ These keybinds are for navigating speedwm Chained keybinds -- Super+r & s - Run screenkey if it is installed -- Super+r & d - Kill screenkey +- Super+r & s - Run screenkey if its not running, otherwise kill it. - Super+t & r - Reorganize tags and move windows - Super+t & t - Toggle tag area in the bar - Super+t & y - Toggle empty tag area in the bar @@ -203,6 +200,24 @@ Chained keybinds - Super+p & r - Reset bar padding to default - Super+p & t - Toggle bar padding on/off - Super+, & r - Reset powerline options +- Super+l & q - Rotate forward in the layout axis +- Super+l & w - Rotate forward in the master axis +- Super+l & e - Rotate forward in the stack axis +- Super+l & r - Rotate forward in the secondary stack axis +- Super+l & q - Rotate backwards in the layout axis +- Super+l & w - Rotate backwards in the master axis +- Super+l & e - Rotate backwards in the stack axis +- Super+l & r - Rotate backwards in the secondary stack axis +- Super+l & 1 - Set layout to layout 0 +- Super+l & 2 - Set layout to layout 1 +- Super+l & 3 - Set layout to layout 2 +- Super+l & 4 - Set layout to layout 3 +- Super+l & 5 - Set layout to layout 4 +- Super+l & 6 - Set layout to layout 5 +- Super+l & 7 - Set layout to layout 6 +- Super+l & 8 - Set layout to layout 7 +- Super+l & 9 - Set layout to layout 8 +- Super+l & 0 - Set layout to layout 9 - Super+Shift+g & i - Decrease inner gaps by 1 - Super+Shift+g & o - Decrease outer gaps by 1 - Super+Shift+e & a - Open the virtual keyboard @@ -244,55 +259,60 @@ These binds can be activated using your mouse ## Dependencies +### Required + These are absolutely necessary, speedwm will NOT compile without them - libxft + - Used for rendering text - pango + - Used to markup text - libXinerama + - Used for multi-monitor support. - Can be disabled through editing toggle.mk if you're not interested in multiple monitors. - imlib2 - - Tag previews, Window icons. Can be disabled through editing toggle.mk and toggle.h if you don't want these features. + - Used for tag previews, window icons. + - Can be disabled through editing toggle.mk and toggle.h if you don't want these features. - yajl - - Required for the IPC patch. If the IPC patch is disabled, you do not need this. + - Used to interact with speedwm through a sock. + - Required for the IPC patch. If the IPC patch is disabled through toggle.mk and toggle.h, you do not need this. - tcc - - Very minimal C compiler that speedwm uses to speed up compile times. If you don't want this dependency, edit host.mk and set CC to 'cc' (or what you prefer). + - Very minimal C compiler that speedwm uses to greatly speed up compile times. If you do not want this dependency, edit host.mk and set CC to 'cc' (or what C99 compiler you prefer). -## Features +### Features These are necessary for certain features and keybinds. If you want to use an alternative, change it in options.h and/or keybinds.h and mouse.h. - dmenu - - NOTE: dmenu is required for most scripts included with this build of speedwm. My build is required for proper Pywal support. -- picom - - Optional but speedwm looks sort of ugly without a compositor. -- xrdb (Install if you want .Xresources support) -- pywal (Install if you want pywal support. Requires swal (the default way to set wallpapers) or a tool that supports the correct signal for instant reloading) -- j4-dmenu-desktop - - Required for dmenu desktop entries.. - -## Software + - dmenu is required for many keybinds included with this build of speedwm. It is also recommended that your build supports grids (-g argument) +- xrdb + - xrdb is used for external speedwm configuration (ie. after compiling). It is **not** mandatory if you don't need this. -This build of speedwm comes with binds for software. -You can add, change and remove keybinds by editing 'keybinds.h' and running 'make clean install'. +### Software + +This build of speedwm comes with keybinds for software. +You can add, change and remove keybinds by editing `keybinds.h` and `mouse.h` and running `make clean install`. - libspeedwm + - Dependency for speedwm-extras allowing you to perform actions externally. - speedwm-extras - Important metapackage containing extra scripts that speedwm makes use of. (https://codeberg.org/speedie/speedwm-extras) -- st (Terminal) -- Chromium (Web browser) -- htop (Status monitor) -- newsboat (RSS reader) -- zathura (PDF reader) -- cmus (Default music player) - - Default status bar also has support for moc (Music On Console) -- neovim (Text editor) -- neomutt (Email client) -- lf (File manager) -- slock (Lock screen) -- weechat (IRC client) -- tmux (Used for the music player and IRC client) +- st - Default terminal +- Chromium - Default web browser +- htop - Status monitor +- sfeed - RSS reader +- rssread - RSS frontend +- cmus - Music player + - Default status bar also has support for moc/mocp (Music On Console) +- neovim - Text editor +- neomutt - Email client +- lf - File manager +- slock - Lock screen +- weechat - IRC client +- tmux - Used for the music player and IRC client +- j4-dmenu-desktop - Listing .desktop entries -And everything under 'Features'. +And everything under `Features`. ## Important diff --git a/docs/keybinds b/docs/keybinds index 48ea865..80bf0ee 100644 --- a/docs/keybinds +++ b/docs/keybinds @@ -143,6 +143,24 @@ Chained keybinds - Super+p & r - Reset bar padding to default - Super+p & t - Toggle bar padding on/off - Super+, & r - Reset powerline options +- Super+l & q - Rotate forward in the layout axis +- Super+l & w - Rotate forward in the master axis +- Super+l & e - Rotate forward in the stack axis +- Super+l & r - Rotate forward in the secondary stack axis +- Super+l & q - Rotate backwards in the layout axis +- Super+l & w - Rotate backwards in the master axis +- Super+l & e - Rotate backwards in the stack axis +- Super+l & r - Rotate backwards in the secondary stack axis +- Super+l & 1 - Set layout to layout 0 +- Super+l & 2 - Set layout to layout 1 +- Super+l & 3 - Set layout to layout 2 +- Super+l & 4 - Set layout to layout 3 +- Super+l & 5 - Set layout to layout 4 +- Super+l & 6 - Set layout to layout 5 +- Super+l & 7 - Set layout to layout 6 +- Super+l & 8 - Set layout to layout 7 +- Super+l & 9 - Set layout to layout 8 +- Super+l & 0 - Set layout to layout 9 - Super+Shift+g & i - Decrease inner gaps by 1 - Super+Shift+g & o - Decrease outer gaps by 1 - Super+Shift+e & a - Open the virtual keyboard diff --git a/keybinds.h b/keybinds.h index ab875e0..e620a7c 100644 --- a/keybinds.h +++ b/keybinds.h @@ -198,7 +198,24 @@ static Key keys[] = { { KeyPress, MODIFIER1, XK_p, XK_r, resetbarpadding, {0} }, /* Chained layout keybinds */ - { KeyPress, MODIFIER1, XK_q, XK_1, togglebartags, {0} }, + { KeyPress, MODIFIER1, XK_l, XK_q, rotatelayoutaxis, {.i = +1 } }, /* layout axis */ + { KeyPress, MODIFIER1, XK_l, XK_w, rotatelayoutaxis, {.i = +2 } }, /* master axis */ + { KeyPress, MODIFIER1, XK_l, XK_e, rotatelayoutaxis, {.i = +3 } }, /* stack axis */ + { KeyPress, MODIFIER1, XK_l, XK_r, rotatelayoutaxis, {.i = +4 } }, /* secondary stack axis */ + { KeyPress, MODIFIER1, XK_l, XK_a, rotatelayoutaxis, {.i = -1 } }, /* layout axis */ + { KeyPress, MODIFIER1, XK_l, XK_s, rotatelayoutaxis, {.i = -2 } }, /* master axis */ + { KeyPress, MODIFIER1, XK_l, XK_d, rotatelayoutaxis, {.i = -3 } }, /* stack axis */ + { KeyPress, MODIFIER1, XK_l, XK_f, rotatelayoutaxis, {.i = -4 } }, /* secondary stack axis */ + { KeyPress, MODIFIER1, XK_l, XK_1, setlayout, {.v = &layouts[0]} }, + { KeyPress, MODIFIER1, XK_l, XK_2, setlayout, {.v = &layouts[1]} }, + { KeyPress, MODIFIER1, XK_l, XK_3, setlayout, {.v = &layouts[2]} }, + { KeyPress, MODIFIER1, XK_l, XK_4, setlayout, {.v = &layouts[3]} }, + { KeyPress, MODIFIER1, XK_l, XK_5, setlayout, {.v = &layouts[4]} }, + { KeyPress, MODIFIER1, XK_l, XK_6, setlayout, {.v = &layouts[5]} }, + { KeyPress, MODIFIER1, XK_l, XK_7, setlayout, {.v = &layouts[6]} }, + { KeyPress, MODIFIER1, XK_l, XK_8, setlayout, {.v = &layouts[7]} }, + { KeyPress, MODIFIER1, XK_l, XK_9, setlayout, {.v = &layouts[8]} }, + { KeyPress, MODIFIER1, XK_l, XK_0, setlayout, {.v = &layouts[9]} }, /* Chained toggle keybinds */ { KeyPress, MODIFIER1, XK_t, XK_t, togglebartags, {0} }, @@ -233,7 +250,6 @@ static Key keys[] = { { KeyPress, MODIFIER1|SHIFT, XK_g, XK_k, incrgaps, {.i = -1 } }, /* Media buttons */ - #if USEMEDIA { KeyPress, 0, -1, XF86XK_AudioMute, spawn, cmd( "speedwm-audioctrl -mute" ) }, { KeyPress, 0, -1, XF86XK_AudioRaiseVolume, spawn, cmd( "speedwm-audioctrl -raise" ) }, { KeyPress, 0, -1, XF86XK_AudioLowerVolume, spawn, cmd( "speedwm-audioctrl -lower" ) }, @@ -248,5 +264,4 @@ static Key keys[] = { { KeyPress, 0, -1, XF86XK_TaskPane, spawn, cmd( TERMINAL "htop" ) }, { KeyPress, 0, -1, XF86XK_WLAN, spawn, cmd( "speedwm-netctrl disconnect" ) }, { KeyPress, 0, -1, XF86XK_Music, spawn, cmd( TERMINAL "tmux new-session -A -D -s cmus $(which --skip-alias cmus)" ) }, - #endif }; diff --git a/speedwm.1 b/speedwm.1 index dd0b357..d6c1339 100644 --- a/speedwm.1 +++ b/speedwm.1 @@ -19,8 +19,7 @@ .SH speedwm .SS What is speedwm? .PP -speedwm is a window manager forked from suckless.org\[cq]s dwm or -dynamic window manager. +speedwm is a window manager forked from dwm or dynamic window manager. It manages the user\[cq]s open windows and tiles them according to a set layout (dynamic). .PP @@ -311,8 +310,6 @@ key) Super+Control+Tab - Open a dmenu prompt asking the user what layout to switch to .IP \[bu] 2 -Super+Control+h - Open the man page for speedwm in dmenu. -.IP \[bu] 2 Super+Control+o - Show a hidden focused window .IP \[bu] 2 Super+Control+a/d - Move to the next/previous tag @@ -321,8 +318,6 @@ Super+Control+Shift+o - Show all hidden windows .IP \[bu] 2 Super+Control+Shift+p - Hide all windows .IP \[bu] 2 -Super+Control+Shift+Colon - Open a list of extra software in dmenu -.IP \[bu] 2 Super+Control+Shift+z/c - Move to the next/previous tag skipping any without windows open .IP \[bu] 2 @@ -374,9 +369,7 @@ Super+Control+Shift+Minus - Decrease bar height by 1 .PP Chained keybinds .IP \[bu] 2 -Super+r & s - Run screenkey if it is installed -.IP \[bu] 2 -Super+r & d - Kill screenkey +Super+r & s - Run screenkey if its not running, otherwise kill it. .IP \[bu] 2 Super+t & r - Reorganize tags and move windows .IP \[bu] 2 @@ -418,6 +411,42 @@ Super+p & t - Toggle bar padding on/off .IP \[bu] 2 Super+, & r - Reset powerline options .IP \[bu] 2 +Super+l & q - Rotate forward in the layout axis +.IP \[bu] 2 +Super+l & w - Rotate forward in the master axis +.IP \[bu] 2 +Super+l & e - Rotate forward in the stack axis +.IP \[bu] 2 +Super+l & r - Rotate forward in the secondary stack axis +.IP \[bu] 2 +Super+l & q - Rotate backwards in the layout axis +.IP \[bu] 2 +Super+l & w - Rotate backwards in the master axis +.IP \[bu] 2 +Super+l & e - Rotate backwards in the stack axis +.IP \[bu] 2 +Super+l & r - Rotate backwards in the secondary stack axis +.IP \[bu] 2 +Super+l & 1 - Set layout to layout 0 +.IP \[bu] 2 +Super+l & 2 - Set layout to layout 1 +.IP \[bu] 2 +Super+l & 3 - Set layout to layout 2 +.IP \[bu] 2 +Super+l & 4 - Set layout to layout 3 +.IP \[bu] 2 +Super+l & 5 - Set layout to layout 4 +.IP \[bu] 2 +Super+l & 6 - Set layout to layout 5 +.IP \[bu] 2 +Super+l & 7 - Set layout to layout 6 +.IP \[bu] 2 +Super+l & 8 - Set layout to layout 7 +.IP \[bu] 2 +Super+l & 9 - Set layout to layout 8 +.IP \[bu] 2 +Super+l & 0 - Set layout to layout 9 +.IP \[bu] 2 Super+Shift+g & i - Decrease inner gaps by 1 .IP \[bu] 2 Super+Shift+g & o - Decrease outer gaps by 1 @@ -494,19 +523,24 @@ Dragging (SuperControl+Right click) - Increase/decrease cfact Root window (Right click) - List .desktop entries and open them (requires j4-dmenu-desktop) .SS Dependencies +.SS Required .PP These are absolutely necessary, speedwm will NOT compile without them - -libxft - pango - libXinerama - Can be disabled through editing toggle.mk -if you\[cq]re not interested in multiple monitors. -- imlib2 - Tag previews, Window icons. -Can be disabled through editing toggle.mk and toggle.h if you don\[cq]t -want these features. -- yajl - Required for the IPC patch. -If the IPC patch is disabled, you do not need this. -- tcc - Very minimal C compiler that speedwm uses to speed up compile -times. -If you don\[cq]t want this dependency, edit host.mk and set CC to `cc' -(or what you prefer). +libxft - Used for rendering text - pango - Used to markup text - +libXinerama - Used for multi-monitor support. +- Can be disabled through editing toggle.mk if you\[cq]re not interested +in multiple monitors. +- imlib2 - Used for tag previews, window icons. +- Can be disabled through editing toggle.mk and toggle.h if you +don\[cq]t want these features. +- yajl - Used to interact with speedwm through a sock. +- Required for the IPC patch. +If the IPC patch is disabled through toggle.mk and toggle.h, you do not +need this. +- tcc - Very minimal C compiler that speedwm uses to greatly speed up +compile times. +If you do not want this dependency, edit host.mk and set CC to `cc' (or +what C99 compiler you prefer). .SS Features .PP These are necessary for certain features and keybinds. @@ -516,35 +550,29 @@ keybinds.h and mouse.h. dmenu .RS 2 .IP \[bu] 2 -NOTE: dmenu is required for most scripts included with this build of -speedwm. -My build is required for proper Pywal support. +dmenu is required for many keybinds included with this build of speedwm. +It is also recommended that your build supports grids (-g argument) .RE .IP \[bu] 2 -picom +xrdb .RS 2 .IP \[bu] 2 -Optional but speedwm looks sort of ugly without a compositor. -.RE -.IP \[bu] 2 -xrdb (Install if you want .Xresources support) -.IP \[bu] 2 -pywal (Install if you want pywal support. -Requires swal (the default way to set wallpapers) or a tool that -supports the correct signal for instant reloading) -.IP \[bu] 2 -j4-dmenu-desktop -.RS 2 -.IP \[bu] 2 -Required for dmenu desktop entries.. +xrdb is used for external speedwm configuration (ie. +after compiling). +It is \f[B]not\f[R] mandatory if you don\[cq]t need this. .RE .SS Software .PP -This build of speedwm comes with binds for software. -You can add, change and remove keybinds by editing `keybinds.h' and -running `make clean install'. +This build of speedwm comes with keybinds for software. +You can add, change and remove keybinds by editing \f[V]keybinds.h\f[R] +and \f[V]mouse.h\f[R] and running \f[V]make clean install\f[R]. .IP \[bu] 2 libspeedwm +.RS 2 +.IP \[bu] 2 +Dependency for speedwm-extras allowing you to perform actions +externally. +.RE .IP \[bu] 2 speedwm-extras .RS 2 @@ -554,35 +582,37 @@ of. (https://codeberg.org/speedie/speedwm-extras) .RE .IP \[bu] 2 -st (Terminal) +st - Default terminal .IP \[bu] 2 -Chromium (Web browser) +Chromium - Default web browser .IP \[bu] 2 -htop (Status monitor) +htop - Status monitor .IP \[bu] 2 -newsboat (RSS reader) +sfeed - RSS reader .IP \[bu] 2 -zathura (PDF reader) +rssread - RSS frontend .IP \[bu] 2 -cmus (Default music player) +cmus - Music player .RS 2 .IP \[bu] 2 -Default status bar also has support for moc (Music On Console) +Default status bar also has support for moc/mocp (Music On Console) .RE .IP \[bu] 2 -neovim (Text editor) +neovim - Text editor .IP \[bu] 2 -neomutt (Email client) +neomutt - Email client .IP \[bu] 2 -lf (File manager) +lf - File manager .IP \[bu] 2 -slock (Lock screen) +slock - Lock screen .IP \[bu] 2 -weechat (IRC client) +weechat - IRC client .IP \[bu] 2 -tmux (Used for the music player and IRC client) +tmux - Used for the music player and IRC client +.IP \[bu] 2 +j4-dmenu-desktop - Listing .desktop entries .PP -And everything under `Features'. +And everything under \f[V]Features\f[R]. .SS Important .PP If you\[cq]re used to dwm, speedwm might be a little unfamiliar to you diff --git a/speedwm.c b/speedwm.c index cd494ca..5b5f8d6 100644 --- a/speedwm.c +++ b/speedwm.c @@ -938,9 +938,7 @@ static xcb_connection_t *xcon; #define SUPERR Mod5Mask /* Media controls */ -#if USEMEDIA #include /* Enable multimedia button support */ -#endif /* Configuration */ #include "options.h" /* Include options */ @@ -958,13 +956,6 @@ static const char *clickstatus[] = { shell, "-c", NULL, NULL }; /* for running c #if USEXRESOURCES #include "xresources.h" /* Include .Xresources/Pywal support */ #endif -#include "keybinds.h" /* Include keybinds */ - -/* Mouse support */ -#if USEMOUSE -#include "mouse.h" /* Include mouse support */ -#include "status.h" /* Include mouse clickstatus support */ -#endif /* IPC support */ #if USEIPC @@ -974,6 +965,13 @@ static const char *clickstatus[] = { shell, "-c", NULL, NULL }; /* for running c #endif #include "text.h" /* Include tags and layouts */ +#include "keybinds.h" /* Include keybinds */ + +/* Mouse support */ +#if USEMOUSE +#include "mouse.h" /* Include mouse support */ +#include "status.h" /* Include mouse clickstatus support */ +#endif /* Signals */ #include "signal.h" /* Include signal support */ diff --git a/toggle.h b/toggle.h index 3bfa4cc..4407816 100644 --- a/toggle.h +++ b/toggle.h @@ -20,7 +20,6 @@ Not compatible with BSDs so for those, set this to 0. */ /* Miscellanious */ #define USESWITCHER 1 /* Include the switcher */ #define USESYSTRAY 1 /* Include the systray */ -#define USEMEDIA 1 /* Include media keys */ #define USEMOUSE 1 /* Include mouse binds */ #define USEXRESOURCES 1 /* Include .Xresources support. */