#!/usr/bin/env bash # # source colors # . "${HOME}/.cache/wal/colors.sh" # # initial settings # # hc is shorter than herbstclient :) hc() { herbstclient "$@" } # set mod keys C=Control S=Shift M=Mod4 A=Mod1 # reset hooks and bindings hc emit_hook reload hc keyunbind --all scripts="$XDG_CONFIG_HOME/herbstluftwm/scripts" # # variables # terminal=kitty browser=firefox calculator="rofi -show calc" feed_reader="$terminal -e newsboat" file_manager=thunar launcher="rofi -show run" music_player="$terminal -e ncmpcpp" screen_locker="i3lock -c 000000" # # movement and control # # basics hc keybind "$M-w" close_and_remove hc keybind "$M-e" close hc keybind "$M-$C-r" reload hc keybind "$M-q" spawn exitmenu # focus hc keybind "$M-h" focus left hc keybind "$M-j" focus down hc keybind "$M-k" focus up hc keybind "$M-l" focus right # shift hc keybind "$M-$S-h" shift left hc keybind "$M-$S-j" shift down hc keybind "$M-$S-k" shift up hc keybind "$M-$S-l" shift right # split focused frame hc keybind "$M-y" chain , split left 0.5 , focus left hc keybind "$M-u" chain , split bottom 0.5 , focus down hc keybind "$M-i" chain , split top 0.5 , focus up hc keybind "$M-o" chain , split right 0.5 , focus right # split root frame hc keybind "$M-$S-y" chain , split left 0.5 '' , focus left hc keybind "$M-$S-u" chain , split bottom 0.5 '' , focus down hc keybind "$M-$S-i" chain , split top 0.5 '' , focus up hc keybind "$M-$S-o" chain , split right 0.5 '' , focus right # frame splitting hc keybind "$M-p" split explode hc keybind "$M-r" remove # resize resizestep=0.04 hc keybind "$M-$C-h" resize left $resizestep hc keybind "$M-$C-j" resize down $resizestep hc keybind "$M-$C-k" resize up $resizestep hc keybind "$M-$C-l" resize right $resizestep # cycle hc keybind "$M-n" cycle +1 hc keybind "$M-m" cycle_monitor # cycle layouts hc keybind "$M-Tab" \ or , and . compare tags.focus.curframe_wcount = 2 \ . cycle_layout +1 vertical horizontal max vertical grid \ , cycle_layout +1 # rotate and mirror hc keybind "$M-apostrophe" mirror vertical hc keybind "$M-semicolon" mirror horizontal hc keybind "$M-slash" rotate # window attributes hc keybind "$M-$C-e" floating toggle hc keybind "$M-$C-w" fullscreen toggle hc keybind "$M-$C-q" set_attr clients.focus.floating toggle # toggles hc keybind "$M-$S-w" spawn sh $scripts/togglemaster # media keys hc keybind XF86AudioMute spawn pulsemixer --toggle-mute hc keybind XF86AudioLowerVolume spawn pulsemixer --change-volume -5 hc keybind XF86AudioRaiseVolume spawn pulsemixer --change-volume +5 hc keybind XF86MonBrightnessDown spawn light -U 5 hc keybind XF86MonBrightnessUp spawn light -A 5 # mouse hc mouseunbind all hc mousebind "$M-Button1" move hc mousebind "$M-Button2" zoom hc mousebind "$M-Button3" resize # # application launchers # hc keybind "$M-Return" spawn $terminal hc keybind "$M-space" spawn $launcher hc keybind "$M-grave" spawn flameshot gui hc keybind "$M-1" spawn $file_manager hc keybind "$M-2" spawn $browser hc keybind "$M-3" spawn $calculator hc keybind "$M-4" spawn $music_player hc keybind "$M-6" spawn virt-manager hc keybind "$M-0" spawn $screen_locker # # tags # tag_names=(a s d f g z x c v b) tag_keys=(a s d f g z x c v b) 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 "$M-$key" use_index $i hc keybind "$M-$S-$key" move_index $i fi done # # theme # hc attr theme.tiling.reset 1 hc attr theme.floating.reset 1 hc set frame_border_active_color $color8 hc set frame_border_normal_color $color0 hc set frame_border_width 0 hc set frame_transparent_width 0 hc set frame_gap 12 hc set always_show_frame off hc set frame_bg_transparent on hc attr theme.active.color $color8 hc attr theme.normal.color $color0 hc attr theme.urgent.color $color1 hc attr theme.inner_color black hc attr theme.floating.outer_color black hc attr theme.border_width 2 hc attr theme.floating.border_width 2 hc set window_gap 0 hc set frame_padding 0 hc set mouse_recenter_gap 0 hc set smart_window_surroundings off hc set smart_frame_surroundings off # # rules # hc unrule -F hc rule focus=on hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off hc rule class=Cadence floating=on hc rule class=Lxpolkit floating=on hc rule class=Dragon-drop floating=on # # settings # hc set focus_follows_mouse 1 # # autolaunch # # panel hc detect_monitors # ps aux | grep panel.sh | grep -v grep | awk '{print $2}' | xargs kill # panel=~/.config/herbstluftwm/panel/panel.sh # for monitor in $(hc list_monitors | cut -d: -f1); do # "$panel" "$monitor" & # done # pidof dunst || dunst & pidof mpd || mpd & pidof flameshot || flameshot & pidof lxpolkit || lxpolkit & pidof picom || picom --experimental-backends & wal -R ~/.fehbg ${HOME}/.config/herbstluftwm/panel.sh