dotfiles/herbstluftwm/autostart.fish

176 lines
4.0 KiB
Fish
Raw Normal View History

#!/usr/local/bin/fish
alias hc=herbstclient
hc emit_hook reload
xsetroot -solid black
hc keyunbind --all
# set -l Mod Mod1 # alt
set -g Mod Mod4
set -g AltMod Mod1
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-s spawn "flameshot" gui
hc keybind $Mod-Return spawn "dmenu_run"
hc keybind $Mod-Delete spawn "alacritty"
# basic movement in tiling and floating mode
# focusing clients
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
# Move frames
hc keybind $Mod-Shift-Right shift right
hc keybind $Mod-Shift-Left shift left
# frames
#hc keybind $Mod-u split bottom 0.5
hc keybind $Mod-o split right 0.5
hc keybind $Mod-r remove
hc keybind $Mod-f fullscreen toggle
# Cycle layouts
hc keybind $Mod-space or , and . compare tags.focus.curframe_wcount = 2 . cycle_layout +1 vertical horizontal max vertical grid , cycle_layout +1
set -l resize_step
hc keybind $Mod-Control-Left resize left +$resize_step
hc keybind $Mod-Control-Down resize down +$resize_step
hc keybind $Mod-Control-Up resize up +$resize_step
hc keybind $Mod-Control-Right resize right +$resize_step
set -l tag_names 1 2 3 4
set -l secondary_tags 1 2 3 4
hc rename default "$tag_names[1]" || true
for tag in $tag_names
hc add "$tag"
hc keybind $Mod-$tag use_index (math $tag-1)
hc keybind $Mod-Shift-$tag move_index (math $tag-1)
end
for tag in $secondary_tags
set -l actual_tag (math $tag+$tag_names[-1])
set -l actual_index (math $actual_tag-1)
hc add "$actual_tag"
hc keybind $AltMod-$tag use_index $actual_index
hc keybind $AltMod-Shift-$tag move_index $actual_index
end
# focus
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-i jumpto urgent
# mus
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
#############################
# Theming #
#############################
set -l ACTIVE "#800080"
set -l NORMAL "#330033"
set -l URGENT "#7811A1"
alias hcs="hc set"
#alias hct=hc attr theme
function hct
hc attr theme.$argv[1] $argv[2]
end
function on
hcs $argv[1] on
end
function off
hcs $argv[1] off
end
hct tiling.reset 1
hct floating.reset 1
hcs frame_border_active_color $ACTIVE
hcs frame_border_normal_color black
#hcs frame_bg_normal_color $ACTIVE
hcs frame_bg_active_color black
hcs frame_border_width 2
hcs show_frame_decorations 'focused_if_multiple'
on frame_bg_transparent
off smart_window_surroundings
on smart_frame_surroundings
hcs frame_transparent_width 5
hcs frame_gap 3
hcs window_gap 0
hcs frame_padding 0
hcs mouse_recenter_gap 0
hct title_height 15
hct title_when multiple_tabs
hct title_font 'Dejavu Sans:pixelsize=12'
hct title_depth 3
hct inner_width 0
hct inner_color black
hct border_width 1
hct floating.border_width 4
hct floating.outer_width 1
hct tiling.outer_width 1
hct background_color black
# Active
hct active.color $ACTIVE
hct active.inner_color $ACTIVE
# Normal
hct normal.color $NORMAL
hct normal.inner_color $NORMAL
# Urgent
hct urgent.color $URGENT
hct urgent.inner_color $URGENT
# Text
hct title_color white
hct normal.title_color '#898989'
for state in active urgent normal
hc substitute C theme.$state.inner_color \
attr theme.$state.outer_color C
end
# Rules
hc unrule -F
function rule
hc rule $argv[1]=$argv[2..]
end
function ruletype
hc rule windowtype~"\"_NET_WM_WINDOW_TYPE_$argv[1]\"" $argv[2]=$argv[3..]
end
rule focus on
rule floatplacement smart
ruletype '(DIALOG|UTILITY|SPLASH)' floating on
ruletype 'DIALOG' focus on
ruletype '(NOTIFICATION|DOCK|DESKTOP)' manage off
hc rule fixedsize floating=on
hcs tree_style '╾│ ├└╼─┐'
hc unlock
# Start services
echo 'Starting services'
./start_svcs.fish
echo 'Services start script complete'
# For now, still use bash panel.sh
for monitor in (hc list_monitors | cut -d: -f1)
bash ./panel.sh "$monitor" &
end