Revert "Remove sxhkd"

Similar to the other revert commits, keeping my sxhkd config is useful
if I want to use bspwm in the future, since I won't have to re-create
it later.
This commit is contained in:
Donovan Glover 2021-05-14 10:17:10 -04:00
parent c01f79ffcc
commit a33c3b0f7b
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
4 changed files with 139 additions and 0 deletions

24
sxhkd/.config/sxhkd/dropdown.sh Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2018 Donovan Glover
DROPDOWN_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
DROPDOWN_SCALE=$(($DROPDOWN_DPI / 96))
c='kitty' # Class
i='dropdown' # Instance
x='kitty --name' # Executable
# Note: This solution will not work with termite since it registers two ids.
# See https://github.com/thestinger/termite/issues/634 for more information.
id=$(xdo id -n $i)
rectangle=$((1700 * $DROPDOWN_SCALE))x$((600 * $DROPDOWN_SCALE))
offset=+$((110 * $DROPDOWN_SCALE))+$((100 * $DROPDOWN_SCALE))
bspc rule -r $c:$i
bspc rule -a $c:$i sticky=on state=floating rectangle=$rectangle$offset
([ -z "$id" ]) && ($x $i) ||
([[ $(xprop -id "$id" | awk '/window state: / {print $3}') == 'Withdrawn' ]] &&
xdo show -n $i || xdo hide -n $i)

View File

@ -0,0 +1,10 @@
#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
SCREENSHOT_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
SCREENSHOT_SCALE=$(($SCREENSHOT_DPI / 96))
DATETIME=`date +%F_%H%M%S`
shotgun ~/$DATETIME.png
feh ~/$DATETIME.png --geometry $((1600 * $SCREENSHOT_SCALE))x$((900 * $SCREENSHOT_SCALE)) --scale-down

View File

@ -0,0 +1,89 @@
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2017-2018 Donovan Glover
# Reload sxhkd / Quit bspwm
super + {_, alt} + Escape
{pkill -USR1 -x sxhkd,bspc quit}
# Take a screenshot
super + p
~/.config/sxhkd/screenshot.sh
# Open a new terminal window
super + {_,shift} + Return
kitty {_,--name floating}
# Toggle a dropdown terminal
super + backslash
~/.config/sxhkd/dropdown.sh
# toggle polybar: top_padding depends on the height you set in polybar/config
super + o
(xdotool search --class --onlyvisible "Polybar" && \
(xdo hide -N "Polybar" && bspc config top_padding 0)) || \
(xdo show -N "Polybar" && bspc config top_padding $(cat ~/.cache/polybar/bspwm_top_padding))
# Change the wal color scheme
alt + m
wal -o ~/.config/wal/done.sh -i ~/Pictures/Wallpapers
alt + z
~/.config/rofi/launch.sh
# ====================
# ======= Node =======
# ====================
# Close the focused window
super + {_,shift} + q
bspc node -{c,k}
# Switch to / Swap with the node in the specified direction
super + {_,shift} + {h,j,k,l}
bspc node -{f,s} {west,south,north,east}
# Switch to the next / previous node (includes monocle layout)
super + {_,shift} + n
bspc node -f {next,prev}
# FLAGS: Toggle between node flags
super + {x,y}
bspc node -g {sticky,private}
# FLAGS: Push and pop windows from the hidden stack
super + {_,shift} + b
bspc node {-g hidden,$(bspc query -N -n .hidden | tail -n 1) -g hidden=off}
# STATES: Toggle between node states
super + {t,r,f,space}
bspc node focused -t ~{tiled,pseudo_tiled,fullscreen,floating}
# PRESELECT: The direction to create a new node
super + ctrl + {h,j,k,l,space}
bspc node -p {west,south,north,east,cancel}
# RATIO: The size of a new node
super + ctrl + {1-9}
bspc node -o 0.{1-9}
# =======================
# ======= Desktop =======
# =======================
# Focus a certain desktop / Send a node to a certain desktop
super + {_,shift} + {1-9,0}
bspc {desktop -f,node -d} '^{1-9,10}'
# Move to the next desktop on the current monitor
alt + {_, shift} + Tab
bspc desktop -f {next,prev}.local
# Easily go back and forth between the last desktop used
alt + a
bspc desktop -f last
# Switch between tiled and monocle desktop layouts
super + c
bspc desktop -l next
# vim:ft=sxhkdrc

16
sxhkd/README.md Normal file
View File

@ -0,0 +1,16 @@
# sxhkd
[sxhkd][sxhkd] is a hotkey daemon for X11.
## Use Cases
sxhkd can be used to:
- Bind any key combination to whatever shell command you want
- Control windows in [bspwm](/bspwm) through `bspc`
You should not use sxhkd if:
- You use a desktop environment that sets keybinds for you
[sxhkd]: https://github.com/baskerville/sxhkd