Git Repos / dotfiles / config / herbstluftwm / autostart.fix
Last update to this file was on 2024-01-09 at 11:16.
Show autostart.fix
#!/bin/sh
#
# Copyright (c) 2015-2021, Cameron Vanderzanden. Available under the
# terms of the 2-clause BSD license. Please see the file "LICENSE" in
# the root dir of this repository for more information.
#
#- config/herbstluftwm/autostart 2015/01/06 cev, last updated 2021/12/08
#
# configuration script for herbstluftwm.
# Based on the standard/example script shipped with the wm, available at:
# /usr/local/etc/xdg/herbstluftwm/autostart or share/autostart of the
# herbstluftwm tarball. Also available at:
# https://github.com/herbstluftwm/herbstluftwm/blob/master/share/autostart
printf 'config/herbstluftwm/autostart: running...\n'
hc() { herbstclient "$@"; }
# not fast, but this script isn't executed often, so...
nameforidx() {
# let's abuse the field seperator.
idx=$1; shift; count=0; names=$@; zIFS="$IFS"; IFS=":"
for name in $names; do
count=$((count + 1))
if [ $count -eq $idx ]; then echo $name && break; fi
done
IFS="$zIFS" && return $count
}
hc emit_hook reload
hc keyunbind --all
mod=Super # capslock will be set to super below
thirds=0.75 # not really.
# set up tags. "tagnames" variable is a list of tag names seperated by colon.
cvert="clients vertical:0"
tagnames="F1:F2:F3:F4"
tagi=1; tagcount="$(nameforidx 0 $tagnames; echo $?)"
hc rename default "$(nameforidx $tagi $tagnames)" 2>/dev/null || true
while [ $tagi -le $tagcount ]; do
tagname="$(nameforidx $tagi $tagnames)"
hc add "$tagname"
hc load "$tagname" "(clients max:0)"
hc keybind "$mod-F$tagi" use_index $(($tagi - 1))
hc keybind "$mod-Shift-F$tagi" move_index $(($tagi - 1))
hc keybind "$mod-F$(($tagi + 4))" use_index $(($tagi - 1))
hc keybind "$mod-Shift-F$(($tagi + 4))" move_index $(($tagi - 1))
tagi=$(($tagi + 1))
done
# set up monitors
hc detect_monitors
# keyboard bindings
hc keybind $mod-Shift-q quit
hc keybind $mod-Shift-r reload
hc keybind $mod-space spawn /usr/local/bin/jgmenu_run
hc keybind $mod-Return spawn $HOME/.local/bin/xvt.sh -n
hc keybind $mod-Delete close
hc keybind $mod-End spawn picom-trans -c 85
hc keybind $mod-Home spawn picom-trans -c 100
hc keybind $mod-Page_Up jumpto last-minimized
hc keybind $mod-Page_Down spawn herbstclient attr clients.focus.minimized true
hc keybind Pause spawn $HOME/.local/bin/fix_clip.sh
hc keybind $mod-period use_index +1 --skip-visible
hc keybind $mod-comma use_index -1 --skip-visible
hc keybind $mod-BackSpace cycle_monitor
hc keybind $mod-m cycle +1
hc keybind $mod-Shift-m cycle -1
hc keybind $mod-c cycle +1
hc keybind $mod-Shift-c cycle -1
hc keybind $mod-n cycle +1
hc keybind $mod-Shift-n cycle -1
hc keybind $mod-i jumpto urgent
hc keybind $mod-Tab use_previous
hc keybind $mod-Shift-Tab use_previous
# keyboard bindings / layouting
hc keybind $mod-r remove
hc keybind $mod-z cycle_layout
hc keybind $mod-u split vertical $thirds
hc keybind $mod-o split horizontal $thirds
hc keybind $mod-s floating toggle
hc keybind $mod-f fullscreen toggle
hc keybind $mod-p pseudotile toggle
hc keybind $mod-backslash rotate
# keyboard bindings / directional arrows, keypad arrows, keypad nums, hjkl
keys_left='Left KP_Left KP_4 h'
keys_down='Down KP_Down KP_2 j'
keys_up='Up KP_Up KP_8 k'
keys_right='Right KP_Right KP_6 l'
for keys in "$keys_left" "$keys_down" "$keys_up" "$keys_right"; do
dir=$(echo ${keys%%' '*} | tr '[:upper:]' '[:lower:]')
for key in $keys; do
hc keybind $mod-$key focus $dir
hc keybind $mod-Control-$key resize $dir +0.05
hc keybind $mod-Shift-$key shift $dir
hc keybind $mod-Mod1-$key spawn hc_swap.sh $dir
done
done
# common layouts
l_m="clients max:0"
l_h3="split vertical:0.333300:0"
l_h3335="split horizontal:0.33350:0"; l_h667="split horizontal:0.667000:0"
l_v="clients vertical:0"; l_v25="split vertical:0.250000:0"
l_v50="split vertical:0.500000:0"; l_v75="split vertical:0.750000:0"
l_v_lower="($l_v75 ($l_m) ($l_m))"
l_v_upper="($l_v25 ($l_m) ($l_m))"
l_v_three="($l_v75 ($l_v25 ($l_m) ($l_m)) ($l_m))"
l_h_left="(split horizontal:0.714:0 ($l_m) ($l_v))"
# l_h_left="(split horizontal:0.733000:0 ($l_m) ($l_v))"
l_h_right="(split horizontal:0.286:0 ($l_v) ($l_m))"
l_h_three="($l_hz3335 ($l_h667 ($l_v) ($l_m)) ($l_v))"
l_vh_1="($l_v75 ($l_h667 ($l_m) ($l_v)) ($l_m))"
l_vh_2="($l_v75 ($l_h667 ($l_m) ($l_v50 ($l_m) ($l_m))) ($l_m))"
l_vh_3="($l_v75 ($l_h667 ($l_m) ($l_h3 ($l_m) ($l_v50 ($l_m) ($l_m)))) ($l_m))"
# bindings for common layouts
hc keybind $mod-KP_0 load "($l_m)"
hc keybind $mod-KP_Insert load "($l_m)"
hc keybind $mod-KP_1 load "$l_v_lower"
hc keybind $mod-KP_End load "$l_v_lower"
hc keybind $mod-KP_2 load "$l_v_upper"
hc keybind $mod-KP_Down load "$l_v_upper"
hc keybind $mod-KP_3 load "$l_v_three"
hc keybind $mod-KP_Page_Down load "$l_v_three"
hc keybind $mod-KP_4 load "$l_h_left"
hc keybind $mod-KP_Left load "$l_h_left"
hc keybind $mod-KP_5 load "$l_h_three"
hc keybind $mod-KP_6 load "$l_h_right"
hc keybind $mod-KP_Right load "$l_h_right"
hc keybind $mod-KP_7 load "$l_vh_1"
# TODO CEV
# hc keybind $mod-KP_HOME load "$l_vh_1"
hc keybind $mod-KP_8 load "$l_vh_2"
hc keybind $mod-KP_Up load "$l_vh_2"
hc keybind $mod-KP_9 load "$l_vh_3"
hc keybind $mod-KP_Page_Up load "$l_vh_3"
# preload some layouts
hc floating "F1" on
hc floating "F2" on
hc floating "F3" on
hc floating "F4" on
# mouse bindings
hc mouseunbind --all
hc mousebind $mod-Button1 move
hc mousebind $mod-Button2 zoom
hc mousebind $mod-Button3 resize
# settings / attributes
hc attr settings.auto_detect_panels 'true'
hc attr settings.default_frame_layout 2
hc attr settings.frame_bg_transparent 'true'
hc attr settings.frame_border_width 0
hc attr settings.frame_normal_opacity 0
hc attr settings.frame_active_opacity 0
hc attr settings.frame_gap 16
hc attr settings.frame_padding 0
hc attr settings.window_gap 0
hc attr settings.snap_gap 16
hc attr settings.smart_window_surroundings 0
hc attr settings.smart_frame_surroundings 0
hc attr settings.mouse_recenter_gap 0
hc attr settings.focus_follows_mouse 0
hc attr settings.tree_style '*| +`--.'
hc attr theme.tiling.reset 0
hc attr theme.floating.reset 0
hc attr theme.border_width 0 # 8
hc attr theme.inner_width 0 # 0
hc attr theme.outer_width 0 # 4 (?)
hc attr theme.padding_top 0 # for a not-titelbar
hc attr theme.padding_left 0
hc attr theme.padding_bottom 4 # like WindowMaker
hc attr theme.padding_right 0
hc attr theme.title_align 'left' # 'center'
hc attr theme.title_depth 0 # 8 is good
hc attr theme.title_height 0 # 22 is good
hc attr theme.title_font 'Inconsolata-20'
hc attr theme.title_when 'never'
# colors
hc attr theme.background_color 'xDK0h'
hc attr theme.color 'xDK0s'
hc attr theme.inner_color 'xDK0s'
hc attr theme.outer_color 'xDK1'
hc attr theme.title_color 'xDK4'
hc attr theme.active.background_color 'xDK1'
hc attr theme.active.color 'xDK0h'
hc attr theme.active.inner_color 'xDK0h'
hc attr theme.active.outer_color 'xDK0'
hc attr theme.active.title_color 'xLT4'
hc attr theme.urgent.background_color 'xORNf'
hc attr theme.urgent.color 'xORNn'
hc attr theme.urgent.inner_color 'xORNn'
hc attr theme.urgent.outer_color 'xORNb'
hc attr theme.urgent.title_color 'xDK0'
hc attr theme.floating.active.color 'xGRNf'
hc attr theme.floating.active.inner_color 'xGRNf'
hc attr theme.floating.active.outer_color 'xGRNn'
hc attr theme.tiling.active.color 'xAQUf'
hc attr theme.tiling.active.inner_color 'xAQUf'
hc attr theme.tiling.active.outer_color 'xAQUn'
hc attr settings.frame_bg_normal_color 'xDK0h'
hc attr settings.frame_bg_active_color 'xDK0h'
hc attr settings.frame_border_normal_color 'xDK0'
hc attr settings.frame_border_active_color 'xDK2'
# generic high-level rules
hc unrule -F
hc rule fixedsize floating=on
hc rule focus=off floatplacement=smart
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on floatplacement=none
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc rule class~'(.*[Ee][Xx][Ee])' floating=on
# specific classes: consoles and terminals
hc rule class=Alacritty focus=on
hc rule class=Mate-terminal focus=on
hc rule class=qterminal focus=on
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule class=XConsole focus=off tag="$(nameforidx 3 $tagnames)" index=0
hc rule class=xterm-256color focus=on
# specific classes: desktop applications, desktop environment features
hc rule class=Caja hook=undecorate
hc rule class=Dock_applet.py manage=off
hc rule class=Com.github.jmoerman.go-for-it hook=undecorate
hc rule class=Mate-notification-daemon manage=off
hc rule class=pinentry-qt5 floating=on focus=on floatplacement=center
# specific classes: games
hc rule title=Dragonfall floating=on
hc rule class=SDL_App focus=on floating=on
hc rule class=steam_proton floating=on
# specific classes: media editors, players, and viewers
hc rule class=Eom focus=on
hc rule class=Gimp-2.10 focus=on
hc rule class=Io.github.celluloid_player.Celluloid focus=on
hc rule class=lximage-qt focus=on
hc rule class=mpv focus=off pseudotile=off
hc rule class=obs floating=on
hc rule class=Sxiv focus=on
# specific classes; system utilities
hc rule class=Cpu-x floating=on
hc rule class=Vncviewer focus=on tag="$(nameforidx 2 $tagnames)" index=0
# specific classes: web browsers
hc rule class=Chromium-browser focus=off tag="$(nameforidx 4 $tagnames)"
hc rule class=Falkon focus=off tag="$(nameforidx 4 $tagnames)"
hc rule class=Firefox-esr focus=on
hc rule class=Navigator focus=off tag="$(nameforidx 4 $tagnames)"
hc rule class=QupZilla focus=off tag="$(nameforidx 4 $tagnames)"
# final setup
hc unlock
hc pad 0 32 0 0 0
printf 'config/herbstluftwm/autostart: ...complete\n'
Return to the top of this page or return to the overview of this repo.
Log autostart.fix
Date | Commit Message | Author | + | - |
---|---|---|---|---|
2024-01-09 | herbs config changes, move lc.sh, update README | cev | +38 | -27 |
2024-01-02 | Change from FreeBSD to Linux, other minor changes | cev | +41 | -26 |
2023-04-15 | jgmenu.csv, misc. small changes | cev | +16 | -10 |
2022-09-10 | New (prelim) Q1 config + a number of minor changes | cev | +12 | -6 |
2022-01-29 | Upgraded software & that required updating configs | cev | +9 | -9 |
2021-12-13 | Expanded redshift background.sh, misc. changes | cev | +13 | -11 |
2021-12-08 | Initial commit. Dotfiles, scripts, basic Makefile. | cev | +217 |
Return to the top of this page or return to the overview of this repo.