Add bspwm / sxhkd

This commit is contained in:
Ian Keane 2025-06-28 10:45:33 -04:00
parent fbc8d2e857
commit 6f38b9f2bc

View file

@ -412,9 +412,150 @@ EndSection
- Must be installed from the repo, doesn't work from nix repos
- Must be moved to /usr/local/bin and given same permissions that come from make install
* TODO Desktop Environment
* Window Manager
** BSPWM
BSPWM is a tiling window manager that represents windows as the leaves of a binary tree.
*** Workspace and Monitor Configuration
- Defines workspaces (desktops)
- Sets window rules for specific applications
- Configures border colors using Flavours theme integration
- Sets core window manager behavior (gaps, border width, etc)
#+begin_src sh :tangle ~/.config/bspwm/bspwmrc-new
#! /bin/sh
bspc monitor -d 1 2 3 4
bspc rule -a Gimp desktop='^8' state=floating follow=on
bspc rule -a Chromium desktop='^2'
bspc rule -a mplayer2 state=floating
bspc rule -a Kupfer.py focus=on
bspc rule -a Screenkey manage=off
bspc rule -a Screenkey manage=off
# start flavours
@ bspc config normal_border_color "#343D46"
@ bspc config active_border_color "#99C794"
@ bspc config focused_border_color "#99C794"
@ bspc config presel_feedback_color "#5FB3B3"
# end flavours
bspc config border_width 2
bspc config window_gap 12
bspc config split_ratio 0.52
bspc config borderless_monocle true
bspc config gapless_monocle true
export PATH = $PATH:~/scripts
autorandr &
polybar &
sleep 3 && sxhkd &
#+end_src
** SXHKD
Simple X Hotkey Daemon (SXHKD) handles keyboard input and executes commands.
Configuration is organized into sections for different types of functionality.
*** Floating Windows and (t|n)drops
Windows I want to be able to access at any time (usually fullscreen), often facilitated by tdrop or ndrop
- TODO notes here about configuring tdrop to make this work
- TODO calcurse window command
- Right now these don't start the process necessarily that they list
#+begin_src conf :tangle ~/.config/sxhkd/sxhkdrc
# Persistent terminal window with tmux session
super + Return
tdrop -n 1 wezterm start --always-new-process -- tmux
super + c
tdrop -n 2 wezterm start --always-new-process -- tmux
super + m
tdrop -n 2 wezterm start --always-new-process -- ncmpcpp
super + r
tdrop -n secondmux wezterm --class secondmux && xdotool getwindowfocus getwindowclassname | grep -q secondmux && bspc node -t fullscreen
super + e
tdrop emacsclient -c
super + shift + n
{bspc rule -a \* -o state=floating && st -e nmtui}
#+end_src
*** Drop-down selectors (dmenu)
#+begin_src conf :tangle ~/.config/sxhkd/sxhkdrc
super + d
dmenu_run
super + @space
dmenu_run -l 15 -i -nf $norm_fg -nb $norm_bg -sb $sel_bg -sf $sel_fg
#+end_src
*** DE management
#+begin_src conf :tangle ~/.config/sxhkd/sxhkdrc
# make sxhkd reload its configuration files:
super + Escape
pkill -USR1 -x sxhkd
# quit/restart bspwm
super + alt + {q,r}
bspc {quit,wm -r}
#+end_src
*** Simple one-off keybinds
#+begin_src conf :tangle ~/.config/sxhkd/sxhkdrc
# close and kill
super + q
bspc node -c
# screenshot
super + s
sleep .2 && scrot -s -e 'xclip -selection clipboard -t image/png -i $f'
# change language (borked due to the key changing once in a different language)
super + x
languagecycle
#+end_src
*** Window Management
#+begin_src conf :tangle ~/.config/sxhkd/sxhkdrc
# set the window state
super + {t,shift + t,shift + f,f}
bspc node -t {tiled,floating,pseudo_tiled,~fullscreen}
# focus the node in the given direction
super + {_,shift + }{h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last node/desktop
super + {grave,Tab}
bspc {node,desktop} -f last
# focus the older or newer node in the focus history
super + {o,i}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send to the given desktop
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
# preselect the direction
super + ctrl + {h,j,k,l}
bspc node -p {west,south,north,east}
# Resize windows
super + alt + {h,j,k,l}
{bspc node @parent/second -z left -20 0; \
bspc node @parent/first -z right -20 0, \
bspc node @parent/second -z top 0 +20; \
bspc node @parent/first -z bottom 0 +20, \
bspc node @parent/first -z bottom 0 -20; \
bspc node @parent/second -z top 0 -20, \
bspc node @parent/first -z right +20 0; \
bspc node @parent/second -z left +20 0}
# move a floating window
super + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
super + w
gapcycle
super + shift + w
layoutcycle && sleep .1
#+end_src
* Desktop Environment
- .fehbg
- bspwm/sxhkd/initrc
- polybar
* TODO Media
- mpv