Skip to content

Instantly share code, notes, and snippets.

@thugcee
Created April 12, 2020 09:27
Show Gist options
  • Save thugcee/14c7b193edd603ca19771a5acf73df8b to your computer and use it in GitHub Desktop.
Save thugcee/14c7b193edd603ca19771a5acf73df8b to your computer and use it in GitHub Desktop.
dotfiles: .config/sxhkd/sxhkdrc
## launchers and selectors
# show help on key bindings
super + F1
st -g 150x30 -c terminal_keys_help -e ~/.config/sxhkd/show_help.sh
# start terminal emulator
super + Return
alacritty
# start rofi launcher
super + r
rofi -show run
# start rofi launcher
super + grave
rofi -show run
# start rofi window selector
super + shift r
rofi -show window
# start rofi window selector
mod3 + w
rofi -show window
# start rofi window selector
super + Escape
rofi -show window
# start dmenu launcher
super + e
dmenu_run
# start dmenu launcher for .desktop files
super + shift + e
j4-dmenu-desktop
## bspwm hotkeys
# quit bspwm normally
super + alt + BackSpace
pkill -x polybar; bspc quit
# make sxhkd reload its configuration files
super + shift + Escape
pkill -USR1 -x sxhkd; \
notify-send -t 2000 -a "sxhkd" "Configuration reloaded"
# make sxhkd reload its configuration files
mod3 + l
pkill -USR1 -x sxhkd; \
notify-send -t 2000 -a "sxhkd" "Configuration reloaded"
# toggle mouse pointer follow window focus
mod3 + f; w
F=$(bspc config pointer_follows_focus); if [ $F = "true" ]; then NEW='false' else NEW='true'; fi; bspc config pointer_follows_focus $NEW; \
notify-send -a sxhkd BSPWM "Pointer Follow Focus is now <b>$NEW</b>"
# Change window gap
super + {KP_Subtract,KP_Add}
bspc config -d focused window_gap $((`bspc config -d focused window_gap` {-,+} 10 ))
###### manipulate windows
# close/kill a window
super + {_,shift + }F4
bspc node -{c,k}
# close a window
super + alt + q
bspc node -{c}
# set window mode to tiled,pseudo_tiled,floating,fullscreen
super + {t,shift + t,f,shift + f}
bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
# set all windows of the desktop to tile mode
super + ctrl + t
bspcp tile
# set all windows of the desktop to float mode and arrange them
super + ctrl + f
bspcp float
# set the window flags locked,private
super + Menu; {l,p}
bspc node -g {locked,private}; \
notify-send -t 1000 "window [un]{locked,private}"
## focus/swap
# focus or swap window/node in the given direction
super + {_,shift + }{Left,Down,Up,Right}
bspc node -{f,s} {west,south,north,east}
# focus window/node for the given path jump (parent,brother,first,second)
super + {p,b,comma,period}
bspc node -f @{parent,brother,first,second}
# focus the next/previous window/node in the current desktop
super + {Next, Prior}
bspc node -f {next,prev}.local
#super + button{4,5}
# bspc node -f {prev,next}.local
# focus the next/previous desktop in the current monitor
super + bracket{left,right}
bspc desktop -f {prev,next}.local
# focus the last used widnow/node on current desktop
super + Tab
bspc node -f last.local
# focus the older or newer node in the focus history
super + {i,o}
bspc wm -h off; \
bspc node {older,newer} -f; \
bspc wm -h on
# focus or send window to the given desktop by its number
super + {_,shift + }{1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
# focus or send window to the given desktop by its name
super + {_,shift + }{q,w,a,s,z,x}
bspc {desktop -f,node -d} '{I,II,III,IV,V,VI}'
# alternate between the tiled and monocle layout (maximize)
super + m
bspc desktop -l next
# if the current node is automatic, send it to the last manual, otherwise pull the last leaf
#super + y
# bspc query -N -n focused.automatic && bspc node -n last.!automatic || bspc node last.leaf -n focused
# move node/window to preselected space
super + y
bspc node -n last.!automatic
# swap the current node and the biggest node
super + g
bspc node -s biggest
# move windows into preselected position
super + ctrl + shift + {Left,Down,Up,Right}
bspc node -s {west,south,north,east}
## preselect
# preselect the direction
super + ctrl + {Left,Down,Up,Right}
bspc node -p {west,south,north,east}
# preselect the ratio
super + ctrl + {1-9}
bspc node -o 0.{1-9}
## cancel the preselection for the focused node
##super + ctrl + space
## bspc node -p cancel
# cancel the preselection for the focused desktop
super + ctrl + space
bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
## change layout
# rotate whole desktop or the parent of current window
mod3 + {_,shift +} {bracketleft, bracketright}
bspc node @{/,parent} -R {-90,90}
# hide window
super + h
bspc node -g hidden
# unhide window
super + shift + h
bspc node $(bspc query -N -n .hidden | tail -n1) -g hidden=off
## move/resize
# # window resize: expand a window by moving one of its side outward
# mod3 + r: {Left,Down,Up,Right}
# bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
# # window resize: contract a window by moving one of its side inward
# mod3 + R: {Left,Down,Up,Right}
# bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
# window resize: expand window in all directions
mod3 + {KP_Add,KP_Subtract}
{v1=20;v2=-20,v1=-20;v2=20}; \
bspc node -z right $v1 0; \
bspc node -z top 0 $v2; \
bspc node -z bottom 0 $v1; \
bspc node -z left $v2 0
# window resize: move top/bottom edge
mod3 + shift + {Up,Down}: {Up,Down}
bspc node -z {top,bottom} 0 {-30,30}
# window resize: move left/right edge
mod3 + shift + {Left,Right}: {Left,Right}
bspc node -z {left,right} {-30,30} 0
# # window resize: expand/shrink window in horizontal direction
# mod3 + shift + {Left,Right}
# h={-30,30};\
# bspc node -z right $h 0 || bspc node -z left $h 0
# # window resize: expand/shrink window in vertical direction
# mod3 + shift + {Up,Down}
# v={-30,30};\
# bspc node -z bottom 0 $v || bspc node -z top 0 $v
# window resize: change parent's split ratio
mod3 + bar: {Up,Down,Left,Right}
bspc node @parent -r {-,+,-,+}.02
## window resize: change split ratio (select parent first)
#mod3 + bar: {Left,Right}
# bspc node @parent -r {-,+}.02
## floating window control
# move a floating window
mod3 + {Left,Down,Up,Right}
bspc node -v {-20 0,0 20,0 -20,20 0}
# resize a floating window
#mod3 + shift + {Left,Down,Up,Right}
# bspc node -z {right -20 0,bottom 0 20,bottom 0 -20,right 20 0}
# raise focused window
super + button5
xdo raise $(pfw)
## utilities
# run fix-desktop-sew.sh script
super + semicolon; f; d
fix-desktop-sew.sh; \
notify-send -a sxhkd Fix-desktop "Desktop has been fixed"
# change background
XF86Search
change_background.sh
# change background nsfw
shift + XF86Search
change_background.sh nude
# Show clipboard history
super + c
rofi-copyq
# Lock screen
XF86Favorites
i3lock -c 000000
# MOC/music pause
super + Pause
mocp -G
# MOC/music pause
XF86AudioPlay
mocp -G
# MOC/music stop
XF86AudioStop
mocp -s
# MOC/music prev/next track
{XF86AudioPrev,XF86AudioNext}
mocp {-r,-f}
# MOC/music rewind track
shift + {XF86AudioPrev,XF86AudioNext}
mocp -k {-10,10}
# put machine to sleep
XF86Mail
sudo pm-suspend
# put machine to sleep
super + Menu; s; s
sudo pm-suspend
# Lock screen
super + Menu; s; l
i3lock -c 000000
# Lock screen
ctrl + Menu; s; l
i3lock -c 000000
# Lock screen
ctrl + Scroll_Lock
i3lock -c 000000
# Pulse Audio volume control
{XF86AudioLowerVolume,XF86AudioRaiseVolume}
pactl set-sink-volume @DEFAULT_SINK@ {-,+}3%
# Pulse Audio toggle mute
XF86AudioMute
pactl set-sink-mute @DEFAULT_SINK@ toggle
# make screenshot of window
Print
scrot -u ~/lab/graf/raster/screenshots/%Y-%m-%d_%H%M%S_\$wx\$h_scrot.png \
-e 'notify-send -t 7000 -a scrot "Window screenshot taken" "Saved to: $f"'
# make screenshot of rectable selection
mod1 + Print
scrot -s ~/lab/graf/raster/screenshots/%Y-%m-%d_%H%M%S_\$wx\$h_scrot.png \
-e 'notify-send -t 7000 -a scrot "Rectangle screenshot taken" "Saved to: $f"'
# make screenshot of screen
shift + Print
scrot ~/lab/graf/raster/screenshots/%Y-%m-%d_%H%M%S_\$wx\$h_scrot.png \
-e 'notify-send -t 7000 -a scrot "Screenshot taken" "Saved to: $f"'
# make screenshot of all screens
super + Print
scrot -m ~/lab/graf/raster/screenshots/%Y-%m-%d_%H%M%S_\$wx\$h_scrot.png \
-e 'notify-send -t 7000 -a scrot "All screens shot taken" "Saved to: $f"'
# Remove current tab from tabbed
super + mod1 + t; r
~/.config/sxhkd/tabc.sh $(bspc query -N -n focused) remove
# At given direction: join two windows into a new tabbed or add window to a existing tabbed
super + mod1 + t; {Left,Down,Up,Right}
~/.config/sxhkd/tabc.sh $(bspc query -N -n {west,south,north,east}) add $(bspc query -N -n focused)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment