Skip to content

Instantly share code, notes, and snippets.

@jmcblane
Created April 3, 2019 21:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmcblane/4d7e2e6936e018cebb77028985158b0b to your computer and use it in GitHub Desktop.
Save jmcblane/4d7e2e6936e018cebb77028985158b0b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
####################
# Pre-config stuff #
####################
pkill herbstclient
hc() {
herbstclient "$@"
}
hc emit_hook reload
#xsetroot -solid '#2f2f2f'
source ~/.fehbg
hc keyunbind --all
############
# Keybinds #
############
Mod=Mod1
hc keybind $Mod-Shift-q spawn herbstclient quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Shift-Return spawn termite
hc keybind $Mod-F9 spawn /home/jake/scripts/nkjv/nkjv-menu.sh rwv
hc keybind $Mod-F10 spawn /home/jake/scripts/nkjv/nkjv-menu.sh
hc keybind $Mod-F11 spawn /home/jake/scripts/nkjv/nkjv-menu.sh md
hc keybind $Mod-F12 spawn /home/jake/scripts/nkjv/nkjv-menu.sh marp
hc keybind $Mod-F3 load "(split horizontal:0.625000:0 (clients max:0) (split vertical:0.500000:0 (clients max:0) (clients max:0)))"
hc keybind $Mod-F4 load "(split vertical:0.500000:0 (clients horizontal:0) (clients horizontal:0))"
hc keybind $Mod-F5 cycle_value frame_gap 0 15 30
hc keybind $Mod-o spawn /home/jake/scripts/www/www-menu.sh
hc keybind $Mod-Shift-o spawn /home/jake/scripts/www/www-copy.sh
hc keybind $Mod-y spawn /home/jake/scripts/tmux/tmuxtoclipboard.sh
hc keybind $Mod-p spawn dmenu_run -p "Run:" -y 22
hc keybind Mod4-w spawn termite -e ~/scripts/weelaunch.sh
hc keybind Mod4-m spawn termite -e mutt
hc keybind Mod4-h spawn termite -e gotop
hc keybind Mod4-r spawn termite -e rtv
hc keybind Mod4-g spawn termite -e ddgr
hc keybind Mod4-e spawn termite -e elinks
hc keybind Mod4-y spawn termite -e mpsyt
hc keybind Mod4-v spawn termite -e nvim
hc keybind Mod4-f spawn termite -e vifm
hc keybind Mod4-a spawn termite -e ncpamixer
hc keybind Mod4-c spawn termite -e bc
hc keybind Mod4-b spawn firefox
hc keybind Mod4-Shift-Return spawn termite -e tmux
hc keybind Mod4-p spawn termite -e ssh -p 4002 jake@voidpi
hc keybind $Mod-q chain . set_layout max . emit_hook focus_changed
hc keybind $Mod-w chain . cycle_layout 1 vertical horizontal . emit_hook focus_changed
hc keybind $Mod-e chain . set_layout grid . emit_hook focus_changed
hc keybind $Mod-Left focus left
hc keybind $Mod-Down focus down
hc keybind $Mod-Up focus up
hc keybind $Mod-Right focus right
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
# Taken from https://herbstluftwm.org/faq.html
# Allows windows to cross monitor boundaries
hc keybind $Mod-Shift-h or / shift left / \
chain , lock , shift_to_monitor -l , focus_monitor -l , unlock
hc keybind $Mod-Shift-j or / shift down / \
chain , lock , shift_to_monitor -d , focus_monitor -d , unlock
hc keybind $Mod-Shift-k or / shift up / \
chain , lock , shift_to_monitor -u , focus_monitor -u , unlock
hc keybind $Mod-Shift-l or / shift right / \
chain , lock , shift_to_monitor -r , focus_monitor -r , unlock
hc keybind $Mod-u split bottom 0.5
hc keybind $Mod-i split right 0.5
hc keybind $Mod-Control-space split explode
resizestep=0.025
hc keybind $Mod-Control-h resize left +$resizestep
hc keybind $Mod-Control-j resize down +$resizestep
hc keybind $Mod-Control-k resize up +$resizestep
hc keybind $Mod-Control-l resize right +$resizestep
hc keybind $Mod-Control-Left resize left +$resizestep
hc keybind $Mod-Control-Down resize down +$resizestep
hc keybind $Mod-Control-Up resize up +$resizestep
hc keybind $Mod-Control-Right resize right +$resizestep
tag_names=( {1..4} )
tag_keys=( {1..4} 0 )
hc rename default "${tag_names[0]}" || true
for i in ${!tag_names[@]} ; do
hc add "${tag_names[$i]}"
key="${tag_keys[$i]}"
if ! [ -z "$key" ] ; then
hc keybind "$Mod-$key" use_index "$i"
hc keybind "$Mod-Shift-$key" move_index "$i"
fi
done
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma use_index -1 --skip-visible
hc keybind $Mod-c remove
hc keybind $Mod-t floating toggle
hc keybind $Mod-m fullscreen toggle
hc keybind $Mod-f pseudotile toggle
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle
hc keybind $Mod-Shift-Tab cycle_all -1
############
# Settings #
############
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set frame_border_active_color '#7a8f65'
hc set frame_border_normal_color '#3a3a3a'
hc set frame_bg_normal_color '#2f2f2f'
hc set frame_bg_active_color '#7a8f65'
hc set frame_border_width 3
hc set always_show_frame 1
hc set frame_bg_transparent 1
hc set frame_transparent_width 0
hc set frame_gap 0
hc set default_frame_layout 2
hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings 1
hc set smart_frame_surroundings 1
hc set mouse_recenter_gap 0
hc set focus_follows_mouse 1
hc set tree_style '╾│ ├└╼─┐'
# hc set swap_monitors_to_get_tag 0 #Switch to monitor where tag is displayed
hc attr theme.active.color '#7a8f65'
hc attr theme.normal.color '#3a3a3a'
hc attr theme.urgent.color orange
hc attr theme.inner_width 1
hc attr theme.inner_color "#3a3a3a"
hc attr theme.border_width 1
hc attr theme.floating.border_width 3
hc attr theme.floating.outer_width 1
hc attr theme.floating.outer_color "#1a1a1a"
hc attr theme.active.inner_color '#7a8f65'
hc attr theme.active.outer_color '#7a8f65'
hc attr theme.background_color '#141414'
#########
# Rules #
#########
hc unrule -F
hc rule focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
#hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' manage=off
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
##################
# Monitor Config #
##################
hc pad 0 22 0 0 0
hc unlock
hc spawn /home/jake/.config/polybar/launch.sh &
hc spawn /home/jake/.config/herbstluftwm/check_for_vga.sh &
#########
# Hooks #
#########
herbstclient -i focus_changed | \
while read hook name winid
do
case $hook in
focus_changed) \
tag=$(herbstclient list_monitors | grep "FOCUS" | cut -d' ' -f5 | sed "s/\"//g")
herbstclient attr theme.active.color "#7a8f65"
hc attr theme.active.inner_color '#7a8f65'
hc attr theme.active.outer_color '#7a8f65'
hc set frame_border_active_color '#7a8f65'
[[ -n $(herbstclient layout | grep "FOCUS" | grep "max") ]] &&
herbstclient compare tags.by-name.$tag.curframe_wcount gt 1 &&
herbstclient attr theme.active.color "#715464" &&
hc attr theme.active.inner_color '#715464' &&
hc attr theme.active.outer_color '#715464' &&
hc set frame_border_active_color '#715464' &
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment