diff --git a/autostart b/autostart index ea3160c..8958527 100755 --- a/autostart +++ b/autostart @@ -1,39 +1,44 @@ #!/usr/bin/env bash +exec 2>&1 > >(tee -i /tmp/hlwm-autostart.log) -CFGDIR=$HOME/.config/herbstluftwm +PIDS_FILE=/tmp/hlwm-autostart-pids -# kill old instances, perhaps I should do this with pids? -pkill dzen2 -pkill lemonbar -pkill stalonetray -pkill conky -pkill urxvtd -pkill udiskie +hc() { + herbstclient "$@" +} -herbstclient emit_hook reload +store_pid() { + echo $! >> $PIDS_FILE +} -${CFGDIR}/bindings.sh -${CFGDIR}/rules.sh -${CFGDIR}/styling.sh +OLD_PIDS=$(cat $PIDS_FILE) +rm $PIDS_FILE -herbstclient set tree_style '╾│ ├└╼─┐' -herbstclient unlock -herbstclient detect_monitors +kill $OLD_PIDS + +hc emit_hook reload + +~/.config/herbstluftwm/bindings.sh +~/.config/herbstluftwm/rules.sh +~/.config/herbstluftwm/styling.sh + +hc set tree_style '╾│ ├└╼─┐' +hc unlock +hc detect_monitors panel_height=20 statusbar_height=20 -for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do +for monitor in $(hc list_monitors | cut -d: -f1) ; do # start it on each monitor - herbstclient pad $monitor $panel_height 0 $statusbar_height 0 - ${CFGDIR}/panel.sh $monitor & - ${CFGDIR}/statusbar.sh $monitor & + hc pad $monitor $panel_height 0 $statusbar_height 0 + ~/.config/herbstluftwm/panel.sh $monitor & store_pid + ~/.config/herbstluftwm/statusbar.sh $monitor & store_pid done -${CFGDIR}/tray.sh & +~/.config/herbstluftwm/tray.sh & store_pid +udiskie --tray & store_pid -urxvtd & -udiskie --tray & systemctl --user restart sxhkd systemctl --user restart xautolock diff --git a/bindings.sh b/bindings.sh index a567724..8c64fab 100755 --- a/bindings.sh +++ b/bindings.sh @@ -1,77 +1,84 @@ -#!/bin/bash -herbstclient keyunbind --all +#!/usr/bin/env bash +set -e + +hc() { + herbstclient "$@" +} + +hc keyunbind --all # keybindings Mod=Mod4 -herbstclient keybind $Mod-Control-q quit -herbstclient keybind $Mod-Shift-q close -herbstclient keybind $Mod-Shift-r reload + +hc keybind $Mod-Control-q quit +hc keybind $Mod-Shift-q close +hc keybind $Mod-Shift-r reload # tags TAG_NAMES=( {1..9} 0 ) TAG_KEYS=( {1..9} 0 ) -herbstclient rename default "${TAG_NAMES[0]}" || true +hc rename default "${TAG_NAMES[0]}" || true for i in ${!TAG_NAMES[@]} ; do - herbstclient add "${TAG_NAMES[$i]}" + hc add "${TAG_NAMES[$i]}" key="${TAG_KEYS[$i]}" if ! [ -z "$key" ] ; then - herbstclient keybind "$Mod-$key" use_index "$i" - herbstclient keybind "$Mod-Shift-$key" move_index "$i" + hc keybind "$Mod-$key" use_index "$i" + hc keybind "$Mod-Shift-$key" move_index "$i" fi done # cycle through tags -herbstclient keybind $Mod-period use_index +1 --skip-visible -herbstclient keybind $Mod-comma use_index -1 --skip-visible -herbstclient keybind $Mod-Right use_index +1 --skip-visible -herbstclient keybind $Mod-Left use_index -1 --skip-visible -herbstclient keybind $Mod-minus use_previous +hc keybind $Mod-period use_index +1 --skip-visible +hc keybind $Mod-comma use_index -1 --skip-visible +hc keybind $Mod-Right use_index +1 --skip-visible +hc keybind $Mod-Left use_index -1 --skip-visible +hc keybind $Mod-minus use_previous # layouting -herbstclient keybind $Mod-r remove +hc keybind $Mod-r remove -herbstclient keybind $Mod-space cycle_layout 1 +hc keybind $Mod-space cycle_layout 1 -herbstclient keybind $Mod-e split explode +hc keybind $Mod-e split explode -herbstclient keybind $Mod-u split vertical 0.5 -herbstclient keybind $Mod-Shift-u split vertical 0.66 +hc keybind $Mod-u split vertical 0.5 +hc keybind $Mod-Shift-u split vertical 0.66 -herbstclient keybind $Mod-o split horizontal 0.5 -herbstclient keybind $Mod-Shift-o split horizontal 0.666 +hc keybind $Mod-o split horizontal 0.5 +hc keybind $Mod-Shift-o split horizontal 0.666 -herbstclient keybind $Mod-s floating toggle -herbstclient keybind $Mod-f fullscreen toggle -herbstclient keybind $Mod-p pseudotile toggle +hc keybind $Mod-s floating toggle +hc keybind $Mod-f fullscreen toggle +hc keybind $Mod-p pseudotile toggle # resizing RESIZESTEP=0.02 -herbstclient keybind $Mod-Control-h resize left +$RESIZESTEP -herbstclient keybind $Mod-Control-j resize down +$RESIZESTEP -herbstclient keybind $Mod-Control-k resize up +$RESIZESTEP -herbstclient keybind $Mod-Control-l resize right +$RESIZESTEP +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 # mouse in floating mode -herbstclient mouseunbind --all -herbstclient mousebind $Mod-Button1 move -herbstclient mousebind $Mod-Button2 zoom -herbstclient mousebind $Mod-Button3 resize +hc mouseunbind --all +hc mousebind $Mod-Button1 move +hc mousebind $Mod-Button2 zoom +hc mousebind $Mod-Button3 resize # focus -herbstclient set focus_follows_mouse 1 -herbstclient rule focus=on -herbstclient keybind $Mod-BackSpace cycle_monitor -herbstclient keybind $Mod-Tab cycle_all +1 -herbstclient keybind $Mod-Shift-Tab cycle_all -1 -herbstclient keybind $Mod-c cycle -herbstclient keybind $Mod-h focus left -herbstclient keybind $Mod-j focus down -herbstclient keybind $Mod-k focus up -herbstclient keybind $Mod-l focus right -herbstclient keybind $Mod-i jumpto urgent -herbstclient keybind $Mod-Shift-h shift left -herbstclient keybind $Mod-Shift-j shift down -herbstclient keybind $Mod-Shift-k shift up -herbstclient keybind $Mod-Shift-l shift right +hc set focus_follows_mouse 1 +hc rule focus=on +hc keybind $Mod-BackSpace cycle_monitor +hc keybind $Mod-Tab cycle_all +1 +hc keybind $Mod-Shift-Tab cycle_all -1 +hc keybind $Mod-c cycle +hc keybind $Mod-h focus left +hc keybind $Mod-j focus down +hc keybind $Mod-k focus up +hc keybind $Mod-l focus right +hc keybind $Mod-i jumpto urgent +hc keybind $Mod-Shift-h shift left +hc keybind $Mod-Shift-j shift down +hc keybind $Mod-Shift-k shift up +hc keybind $Mod-Shift-l shift right diff --git a/rules.sh b/rules.sh index eb8fc48..9da640d 100755 --- a/rules.sh +++ b/rules.sh @@ -1,13 +1,16 @@ #!/usr/bin/env bash - set -e +hc() { + herbstclient "$@" +} + # rules -herbstclient unrule -F -#herbstclient rule class=XTerm tag=3 # move all xterms to tag 3 -herbstclient rule focus=off # normally do not focus new clients +hc unrule -F +#hc rule class=XTerm tag=3 # move all xterms to tag 3 +hc rule focus=off # normally do not focus new clients # give focus to most common terminals -herbstclient rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on -herbstclient rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on -herbstclient rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on -herbstclient rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off +hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on +hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on +hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on +hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off diff --git a/settings.sh b/settings.sh index 4893e1b..ebaf9f0 100755 --- a/settings.sh +++ b/settings.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash #font="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*" font="DejaVu Sans Mono for Powerline:pixelsize=11" @@ -12,8 +12,3 @@ activeOnMontior="2aa198" notempty="#fdf6e3" notused="#657b83" urgent="#dc322f" - -function uniq_linebuffered() { - awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" -} - diff --git a/statusbar.sh b/statusbar.sh index 1e9cdda..7960684 100755 --- a/statusbar.sh +++ b/statusbar.sh @@ -1,9 +1,12 @@ #!/usr/bin/env bash source ~/.config/herbstluftwm/settings.sh +function uniq_linebuffered() { + awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" +} + # disable path name expansion or * will be expanded in the line # cmd=( $line ) -set -f statusbar_height=20 monitor=${1:-0} diff --git a/styling.sh b/styling.sh index 5efe009..404f515 100755 --- a/styling.sh +++ b/styling.sh @@ -1,28 +1,47 @@ -#!/bin/bash -x -CFGDIR=$HOME/.config/herbstluftwm +#!/usr/bin/env bash +set -e -$CFGDIR/wallpaper.sh +hc() { + herbstclient "$@" +} + +./wallpaper.sh # frame/window styling +hc attr theme.tiling.reset 1 +hc attr theme.floating.reset 1 -herbstclient set frame_border_active_color '#eee8d5' -herbstclient set frame_border_normal_color '#475152' -herbstclient set frame_bg_transparent 1 -herbstclient set frame_border_width 1 -herbstclient set frame_active_opacity 80 -herbstclient set frame_normal_opacity 80 -herbstclient set frame_gap 4 -herbstclient set frame_padding 0 -herbstclient set always_show_frame 1 -herbstclient set smart_frame_surroundings 1 +hc attr theme.active.color '#9fbc00' +hc attr theme.normal.color '#454545' +hc attr theme.urgent.color orange +hc attr theme.inner_width 1 +hc attr theme.inner_color black +hc attr theme.border_width 3 +hc attr theme.floating.border_width 4 +hc attr theme.floating.outer_width 1 +hc attr theme.floating.outer_color black +hc attr theme.active.inner_color '#3E4A00' +hc attr theme.active.outer_color '#3E4A00' +hc attr theme.background_color '#141414' -herbstclient set window_border_width 2 -herbstclient set window_border_inner_width 0 -herbstclient set window_border_normal_color '#0a1b22' -herbstclient set window_border_active_color '#d9e5e7' -herbstclient set window_gap 0 -herbstclient set smart_window_surroundings 1 +hc set frame_border_active_color '#eee8d5' +hc set frame_border_normal_color '#475152' +hc set frame_bg_transparent 1 +hc set frame_border_width 1 +hc set frame_active_opacity 80 +hc set frame_normal_opacity 80 +hc set frame_gap 4 +hc set frame_padding 0 +hc set always_show_frame 1 +hc set smart_frame_surroundings 1 + +hc set window_border_width 2 +hc set window_border_inner_width 0 +hc set window_border_normal_color '#0a1b22' +hc set window_border_active_color '#d9e5e7' +hc set window_gap 0 +hc set smart_window_surroundings 1 -herbstclient set mouse_recenter_gap 0 +hc set mouse_recenter_gap 0