├── .gitignore ├── README ├── autostart ├── config ├── padding ├── panel ├── panel.sh ├── tags.sh └── tray.sh ├── sidebar.sh ├── sidebar_2.sh ├── solarized.Xres ├── split └── swap /.gitignore: -------------------------------------------------------------------------------- 1 | *.swp 2 | *.swo 3 | panel/conkyrc 4 | cache/* 5 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | == This is out of date == 2 | 3 | A collection of scripts and configs for herbsluftwm 4 | 5 | requires: 6 | herbsluftwm 7 | i3status ( I should change this to conky, all it's doing is getting the time) 8 | stalonetray 9 | dzen3-svn ( this is the name of the AUR package, it's the latest dzen with XMP and click support.) 10 | iceland font ( found in google fonts, you can change this to what ever you want in bar.sh 11 | awsetbg (this is only used in autostart to set the background, easily replaceable) 12 | 13 | colors are similar to the molokai theme for vim/sublime 14 | 15 | 16 | rename_tag 17 | launches a dmenu dialog where you can input a new name for 18 | the current tag. Keybindings are updated so that tags are 19 | still accessed by number ( the 2nd tag is accessed with 2, 20 | the 5th by 5 regardless of the name ) 21 | remembers names given to tags, lists them in order of last used. 22 | 23 | reset_bindings 24 | fixes keybindings on reload. 25 | 26 | bar.sh 27 | adds a clock and workspace switcher to each workspace 28 | adds a system tray to the first monitor 29 | for dzen to be clickable you must have the newest version of dzen (dzen-svn in the AUR) 30 | if you do now want this remove the ^ca line in ws_bar 31 | 32 | xrandr_set_monitor.sh 33 | This parses xrandr output for each monitor, then makes one herb monitor for each found. 34 | 35 | padding 36 | dmenu dialog to set the window padding 37 | 38 | -------------------------------------------------------------------------------- /autostart: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # this is a simple config for herbstluftwm 4 | 5 | dir=~/.config/herbstluftwm/ 6 | 7 | ~/.bin/wp change 8 | source ~/.colors 9 | source $dir/config 10 | 11 | function hc() { 12 | herbstclient "$@" 13 | } 14 | 15 | hc emit_hook reload 16 | 17 | # remove all existing keybindings 18 | hc keyunbind --all 19 | 20 | # tags 21 | TAG_NAMES=( z x c v b n m ) 22 | TAG_KEYS=( z x c v b n m ) 23 | 24 | 25 | hc set default_frame_layout $default_frame_layout 26 | 27 | hc rename default "${TAG_NAMES[0]}" || true 28 | for i in ${!TAG_NAMES[@]} ; do 29 | hc add "${TAG_NAMES[$i]}" 30 | key="${TAG_KEYS[$i]}" 31 | if ! [ -z "$key" ] ; then 32 | hc keybind "$Mod-$key" use "${TAG_NAMES[$i]}" 33 | hc keybind "$Mod-Shift-$key" move "${TAG_NAMES[$i]}" 34 | fi 35 | done 36 | 37 | # Quit or Reload 38 | hc keybind Control-Alt-Delete quit 39 | hc keybind $Mod-Control-r reload 40 | 41 | # Closing or opening programs 42 | hc keybind $Mod-w close_or_remove 43 | hc keybind $Mod-Return spawn $terminal 44 | dmenu="/usr/bin/dmenu -i -fn $font -nb '$COLOR0' -sb '$COLOR2' -sf '#000000'" 45 | hc keybind $Mod-d spawn j4-dmenu-desktop --dmenu="$dmenu" 46 | 47 | # cycle through tags 48 | hc keybind $Mod-period use_index +1 --skip-visible 49 | hc keybind $Mod-comma use_index -1 --skip-visible 50 | hc keybind $Mod-Right use_index +1 --skip-visible 51 | hc keybind $Mod-Left use_index -1 --skip-visible 52 | hc keybind $Mod-a use_previous 53 | 54 | # layouting 55 | hc keybind $Mod-r remove 56 | hc keybind $Mod-space cycle_layout 1 57 | 58 | hc keybind $Mod-u spawn $dir/split bottom $vertical_split 59 | hc keybind $Mod-o spawn $dir/split right $horizontal_split 60 | 61 | hc keybind $Mod-Shift-u spawn $dir/split top $vertical_split_i 62 | hc keybind $Mod-Shift-o spawn $dir/split left $horizontal_split_i 63 | 64 | hc keybind $Mod-s floating toggle 65 | hc keybind $Mod-f fullscreen toggle 66 | hc keybind $Mod-p pseudotile toggle 67 | hc keybind $Mod-i spawn $dir/sidebar.sh 68 | hc keybind $Mod-0 spawn $dir/padding 69 | 70 | # resizing 71 | RESIZESTEP=0.05 72 | hc keybind $Mod-Control-h resize left +$RESIZESTEP 73 | hc keybind $Mod-Control-j resize down +$RESIZESTEP 74 | hc keybind $Mod-Control-k resize up +$RESIZESTEP 75 | hc keybind $Mod-Control-l resize right +$RESIZESTEP 76 | 77 | # mouse 78 | hc mouseunbind --all 79 | hc mousebind $Mod-Button1 move 80 | hc mousebind $Mod-Button2 zoom 81 | hc mousebind $Mod-Button3 resize 82 | 83 | # focus 84 | hc keybind $Mod-BackSpace cycle_monitor 85 | hc keybind $Mod-slash cycle_monitor 86 | hc keybind $Mod-Tab cycle +1 87 | hc keybind $Mod-Shift-Tab cycle -1 88 | hc keybind $Mod-h focus left 89 | hc keybind $Mod-j focus down 90 | hc keybind $Mod-k focus up 91 | hc keybind $Mod-l focus right 92 | hc keybind $Mod-Shift-h shift left 93 | hc keybind $Mod-Shift-j shift down 94 | hc keybind $Mod-Shift-k shift up 95 | hc keybind $Mod-Shift-l shift right 96 | hc keybind $Mod-Shift-i rotate 97 | 98 | hc keybind $Mod-Alt-h spawn $dir/swap left 99 | hc keybind $Mod-Alt-j spawn $dir/swap down 100 | hc keybind $Mod-Alt-k spawn $dir/swap up 101 | hc keybind $Mod-Alt-l spawn $dir/swap right 102 | 103 | # Black Screen 104 | hc keybind $Mod-F4 spawn ~/.bin/darkness 105 | # Lock screen 106 | hc keybind $Mod-F3 spawn dm-tool lock 107 | 108 | # Lock screen 109 | hc keybind $Mod-F5 spawn ~/.bin/reconnect 110 | 111 | # Lower Backlight 112 | hc keybind $Mod-F8 spawn ~/.bin/backlight -15 113 | 114 | # Lower Backlight 115 | hc keybind $Mod-F9 spawn ~/.bin/backlight +15 116 | 117 | # Toggle workman and us standard layouts 118 | hc keybind $Mod-F6 spawn ~/.bin/toggle-workman 119 | 120 | # colors 121 | hc set window_border_active_color "$COLOR9" 122 | hc set window_border_normal_color '#444444' 123 | 124 | # settings 125 | hc set default_frame_layout $default_frame_layout 126 | 127 | hc set focus_follows_mouse $focus_follows_mouse 128 | hc set focus_stealing_prevention 0 129 | hc set raise_on_click $raise_on_click 130 | hc set raise_on_focus $raise_on_focus 131 | hc set raise_on_focus_temporarily $raise_on_focus_temporarily 132 | 133 | hc set window_gap $window_gap 134 | hc set frame_gap $frame_gap 135 | hc set frame_padding $frame_padding 136 | 137 | hc set frame_border_width $frame_border_width 138 | hc set window_border_width $window_border_width 139 | hc set window_border_inner_width $window_border_inner_width 140 | hc set frame_bg_transparent $frame_bg_transparent 141 | hc set frame_active_opacity $frame_active_opacity 142 | hc set frame_normal_opacity $frame_normal_opacity 143 | 144 | # rules 145 | hc unrule -F 146 | #hc rule class=XTerm tag=3 # move all xterms to tag 3 147 | hc rule focus=on # Focus new windows by default 148 | 149 | # focus and psudotile dialogs 150 | hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' \ 151 | pseudotile=on 152 | 153 | hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on 154 | hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off 155 | 156 | hc rule class=URxvt pseudotile=on 157 | 158 | # unlock, just to be sure 159 | hc unlock 160 | 161 | herbstclient set tree_style '╾│ ├└╼─┐' 162 | 163 | hc detect_monitors 164 | 165 | $dir/panel/panel.sh & 166 | -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export Mod=Mod4 4 | 5 | export font="terminus-10" 6 | export terminal="urxvt" 7 | export browser="chromium" 8 | 9 | 10 | export default_frame_layout=3 11 | 12 | export focus_follows_mouse=1 13 | export raise_on_click=1 14 | export raise_on_focus=0 15 | export raise_on_focus_temporarily=0 16 | 17 | export frame_border_width=0 18 | export window_border_width=3 19 | export window_border_inner_width=0 20 | 21 | export window_gap=6 22 | export frame_gap=0 23 | export frame_padding=0 24 | 25 | export frame_bg_transparent=0 26 | export frame_active_opacity=1 27 | export frame_normal_opacity=1 28 | 29 | export vertical_split=0.82 30 | export horizontal_split=0.62 31 | 32 | export vertical_split_i=0.18 33 | export horizontal_split_i=0.38 34 | -------------------------------------------------------------------------------- /padding: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ~/.colors 4 | 5 | dir=~/.config/herbstluftwm/ 6 | source ~/.colors 7 | 8 | function hc() { 9 | herbstclient "$@" 10 | } 11 | font="terminus-9" 12 | 13 | hc set window_gap `echo -e "0\n6\n10\n16\n" | dmenu -fn $font -nb "$COLOR0" -sb "$COLOR2" -sf '#000000'` 14 | -------------------------------------------------------------------------------- /panel/panel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ~/.colors 4 | 5 | [[ $0 == /* ]] && script="$0" || script="${PWD}/${0#./}" 6 | panelfolder=${script%/*} 7 | trap 'herbstclient emit_hook quit_panel' TERM 8 | herbstclient emit_hook quit_panel 9 | 10 | 11 | read -a mon <<< "$(hc list_monitors | head -n1 | sed 's/\([0-9]\)\+: \([0-9]\+\)x\([0-9]\+\)+\([0-9]\+\)+\([0-9]\+\).*/\1 \2 \3 \4 \5/')" 12 | # ^ ^ ^ ^ ^ 13 | # 0: mon_num 1: width 2: height 3: x_offset 4: y_offset 14 | 15 | herbstclient pad ${mon[0]} 16 16 | 17 | # Start conky first so it is in the background 18 | dzen_fn="-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*" 19 | dzen_fg="$COLOR11" 20 | dzen_bg="$COLOR0" 21 | 22 | fifo=$(mktemp -u) 23 | mkfifo $fifo 24 | conky -c "$panelfolder/conkyrc" >> $fifo & 25 | pids+=($!) 26 | 27 | dzen2 -fn "$dzen_fn" -x "${mon[3]}" -y "${mon[4]}" -h 16 -fg "$dzen_fg" -bg "$dzen_bg" -e 'button3=' < $fifo & 28 | pids+=($!) 29 | 30 | SLEEP 0.1 # dELAY THE START OF TRAY AND TAGS 31 | 32 | $panelfolder/tray.sh ${mon[@]} & 33 | pids+=($!) 34 | 35 | killall stalonetray # Why doesn't the captured PID kill the tray? 36 | $panelfolder/tags.sh ${mon[@]} & 37 | pids+=($!) 38 | 39 | echo ${pids[@]} 40 | 41 | herbstclient --wait '^(quit_panel|reload).*' 42 | logger "Got quit_panel or reload, killing children ${pids[@]}" 43 | kill -KILL "${pids[@]}" 44 | rm $fifo 45 | exit 0 46 | -------------------------------------------------------------------------------- /panel/tags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ~/.colors 4 | 5 | dzen_fn="-*-terminus-medium-*-*-*-14-*-*-*-*-*-*-*" 6 | dzen_fg="$COLOR11" 7 | dzen_bg="$COLOR0" 8 | normal_fg="$COLOR11" 9 | normal_bg="" 10 | 11 | this_fg="#000000" 12 | this_bg="$COLOR2" 13 | 14 | other_bg="$COLOR3" 15 | 16 | urgent_fg= 17 | urgent_bg="#df8787" 18 | used_fg="#ffffff" 19 | used_bg= 20 | 21 | mon=$1 22 | x=$4 23 | y=$5 24 | 25 | echo $mon 26 | 27 | herbstclient --idle 2>/dev/null | { 28 | tags=( $(herbstclient tag_status 0) ) 29 | while true; do 30 | for tag in "${tags[@]}" ; do 31 | case ${tag:0:1} in 32 | # This monitor 33 | '#') cstart="^fg($this_fg)^bg($this_bg)" ;; 34 | 35 | # Other monitor 36 | '-') cstart="^fg($this_fg)^bg($other_bg)" ;; 37 | 38 | ':') cstart="^fg($used_fg)^bg($used_bg)" ;; 39 | '!') cstart="^fg($urgent_fg)^bg($urgent_bg)" ;; 40 | *) cstart='' ;; 41 | esac 42 | dzenstring="${cstart}^ca(1,herbstclient use ${tag:1}) ${tag:1} " 43 | dzenstring+="^ca()^fg()^bg()" 44 | echo -n "$dzenstring" 45 | done 46 | echo 47 | read hook || exit 48 | case "$hook" in 49 | tag*) tags=( $(herbstclient tag_status) ) ;; 50 | quit_panel*) exit ;; 51 | reload*) exit ;; 52 | esac 53 | done 54 | } | dzen2 -h 16 -fn "$dzen_fn" -ta l -sa l \ 55 | -w 302 -fg "$dzen_fg" -bg "$dzen_bg" -e 'button3=' \ 56 | -x "$x" -y "$y" 57 | -------------------------------------------------------------------------------- /panel/tray.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source ~/.colors 4 | 5 | mon_num=${1:-0} 6 | width=${2:-0} 7 | height=${3:-0} 8 | x=${4:-0} 9 | y=${5:-0} 10 | 11 | let x_offset=$x+$width-16 12 | stalonetray -bg $COLOR0 --geometry 1x1+$x_offset+$y --grow-gravity NE \ 13 | --icon-size 16 --icon-gravity W --kludges force_icons_size 14 | -------------------------------------------------------------------------------- /sidebar.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # a q3-like (or yakuake-like) terminal for arbitrary applications. 4 | # 5 | # this lets a new monitor called "q3terminal" scroll in from the top into the 6 | # current monitor. There the "scratchpad" will be shown (it will be created if 7 | # it doesn't exist yet). If the monitor already exists it is scrolled out of 8 | # the screen and removed again. 9 | # 10 | # Warning: this uses much resources because herbstclient is forked for each 11 | # animation step. 12 | # 13 | # If a tag name is supplied, this is used instead of the scratchpad 14 | 15 | tag="${1:-sidebar}" 16 | cur_mon="${2:-0}" 17 | 18 | hc() { 19 | #echo "hc $@" >&2 ; 20 | herbstclient "$@" ; 21 | } 22 | 23 | mrect=( $(hc monitor_rect -p ${cur_mon} ) ) 24 | termwidth=$((${mrect[2]}*3/10)) 25 | termheight=${mrect[3]} 26 | 27 | rect=( 28 | $termwidth 29 | $termheight 30 | $((${mrect[2]}-$termwidth)) 31 | ${mrect[1]} 32 | ) 33 | 34 | 35 | x_line=$((${mrect[2]}-$termwidth)) 36 | 37 | 38 | hc add sidebar 39 | 40 | 41 | monitor=sidebar 42 | 43 | exists=false 44 | if ! hc add_monitor $(printf "%dx%d%+d%+d" "${rect[@]}") \ 45 | "$tag" $monitor 2> /dev/null ; then 46 | exists=true 47 | fi 48 | 49 | update_geom() { 50 | local geom=$(printf "%dx%d%+d%+d" "${rect[@]}") 51 | hc move_monitor "$monitor" $geom 52 | } 53 | 54 | steps=5 55 | interval=0.01 56 | 57 | animate() { 58 | progress=( "$@" ) 59 | for i in "${progress[@]}" ; do 60 | echo $i 61 | rect[2]=$((${x_line}+(i*termwidth)/$steps)) 62 | #echo ${rect[@]} 63 | update_geom 64 | sleep "$interval" 65 | done 66 | } 67 | 68 | show() { 69 | 70 | hc lock 71 | hc raise_monitor $monitor 72 | hc focus_monitor $monitor 73 | hc unlock 74 | hc lock_tag $monitor 75 | #animate $(seq $steps -1 0) 76 | update_geom 77 | } 78 | 79 | hide() { 80 | rect=( $(hc monitor_rect "$monitor" ) ) 81 | local tmp=${rect[0]} 82 | rect[0]=${rect[2]} 83 | rect[2]=${tmp} 84 | local tmp=${rect[1]} 85 | rect[1]=${rect[3]} 86 | rect[3]=${tmp} 87 | termheight=${rect[1]} 88 | 89 | #animate $(seq 0 +1 $steps) 90 | hc remove_monitor $monitor 91 | } 92 | 93 | [ $exists = true ] && hide || show 94 | 95 | -------------------------------------------------------------------------------- /sidebar_2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | tag="${1:-sidebar}" 4 | main_mon="${2:-0}" 5 | monitor=sidebar 6 | 7 | hc() { 8 | herbstclient "$@"; 9 | } 10 | 11 | 12 | show() { 13 | mrect=( $(hc monitor_rect -p ${cur_mon} ) ) 14 | # mrect 15 | # 0: x padding 16 | # 1: y padding 17 | # 2: width 18 | # 3: heigth 19 | termwidth=$((${mrect[2]}*3/10)) 20 | termheight=${mrect[3]} 21 | 22 | # rect 23 | # 0: width 24 | # 1: height 25 | # 2: x padding 26 | # 3: y padding 27 | 28 | side_rect=( 29 | $termwidth 30 | $termheight 31 | $((${mrect[2]}-$termwidth)) 32 | ${mrect[1]} 33 | ) 34 | main_rect=( 35 | $((${mrect[2]}-$termwidth)) 36 | ${mrect[3]} 37 | ${mrect[0]} 38 | ${mrect[1]} 39 | ) 40 | hc add "$tag" 41 | 42 | 43 | 44 | echo $(printf "%dx%d%+d%+d" "${side_rect[@]}") 45 | if hc add_monitor $(printf "%dx%d%+d%+d" "${side_rect[@]}") \ 46 | "$tag" $monitor 2> /dev/null ; then 47 | local geom=$(printf "%dx%d%+d%+d" "${main_rect[@]}") 48 | hc move_monitor "$main_mon" $geom 49 | fi 50 | local geom=$(printf "%dx%d%+d%+d" "${side_rect[@]}") 51 | hc move_monitor "$monitor" $geom 52 | 53 | } 54 | 55 | hide() { 56 | mrect=( $(hc monitor_rect -p ${cur_mon} ) ) 57 | srect=( $(hc monitor_rect -p ${monitor} ) ) 58 | termwidth=${srect[2]} 59 | termheight=${srect[3]} 60 | main_rect=( 61 | $((${mrect[2]}+$termwidth)) 62 | ${mrect[3]} 63 | ${mrect[0]} 64 | ${mrect[1]} 65 | ) 66 | local geom=$(printf "%dx%d%+d%+d" "${main_rect[@]}") 67 | hc move_monitor "$main_mon" $geom 68 | hc remove_monitor "$monitor" 69 | } 70 | hide 71 | -------------------------------------------------------------------------------- /solarized.Xres: -------------------------------------------------------------------------------- 1 | 2 | ! Solarized color scheme for the X Window System 3 | ! 4 | ! http://ethanschoonover.com/solarized 5 | 6 | 7 | ! Common 8 | 9 | #define S_yellow #b58900 10 | #define S_orange #cb4b16 11 | #define S_red #dc322f 12 | #define S_magenta #d33682 13 | #define S_violet #6c71c4 14 | #define S_blue #268bd2 15 | #define S_cyan #2aa198 16 | #define S_green #859900 17 | 18 | 19 | ! Dark 20 | 21 | #define S_base03 #002b36 22 | #define S_base02 #073642 23 | #define S_base01 #586e75 24 | #define S_base00 #657b83 25 | #define S_base0 #839496 26 | #define S_base1 #93a1a1 27 | #define S_base2 #eee8d5 28 | #define S_base3 #fdf6e3 29 | 30 | 31 | ! Light 32 | ! 33 | ! #define S_base03 #fdf6e3 34 | ! #define S_base02 #eee8d5 35 | ! #define S_base01 #93a1a1 36 | ! #define S_base00 #839496 37 | ! #define S_base0 #657b83 38 | ! #define S_base1 #586e75 39 | ! #define S_base2 #073642 40 | ! #define S_base3 #002b36 41 | 42 | 43 | ! To only apply colors to your terminal, for example, prefix 44 | ! the color assignment statement with its name. Example: 45 | ! 46 | ! URxvt*background: S_base03 47 | 48 | *transparent: false 49 | *background: S_base03 50 | *foreground: S_base0 51 | *cursorColor: S_base1 52 | *pointerColorBackground: S_base01 53 | *pointerColorForeground: S_base1 54 | 55 | *color0: S_base02 56 | *color1: S_red 57 | *color2: S_green 58 | *color3: S_yellow 59 | *color4: S_blue 60 | *color5: S_magenta 61 | *color6: S_cyan 62 | *color7: S_base2 63 | *color9: S_orange 64 | *color8: S_base03 65 | *color10: S_base01 66 | *color11: S_base00 67 | *color12: S_base0 68 | *color13: S_violet 69 | *color14: S_base1 70 | *color15: S_base3 71 | -------------------------------------------------------------------------------- /split: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Split Current window and shift the selected window into the new split 3 | 4 | function hc() { 5 | herbstclient "$@" 6 | } 7 | 8 | if [[ "$1" -ne "horizontal" && "$1" -ne "vertical" ]]; then 9 | exit 1 10 | fi 11 | 12 | if [[ "$1" == "bottom" ]]; then 13 | direction="down" 14 | elif [[ "$1" == "top" ]]; then 15 | direction="up" 16 | else 17 | direction="$1" 18 | fi 19 | 20 | hc chain , split $1 $2 , shift -e $direction 21 | -------------------------------------------------------------------------------- /swap: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Like hc's move command, but the moved window is replaced 3 | 4 | function hc() { 5 | herbstclient "$@" 6 | } 7 | 8 | function lock() { 9 | hc lock 10 | } 11 | function unlock() { 12 | hc unlock 13 | } 14 | 15 | if [[ "$1" != "left" && "$1" != "right" && "$1" != "up" && "$1" != "down" ]]; then 16 | exit 1 17 | fi 18 | 19 | lock 20 | trap unlock EXIT 21 | 22 | # Get id of current window 23 | prime_winid=$(hc attr clients.focus.winid) 24 | 25 | # focus window to switch with 26 | hc focus $1 27 | 28 | if [ $? -ne 0 ]; then 29 | exit 1 30 | fi 31 | 32 | next_winid=$(hc attr clients.focus.winid) 33 | 34 | layout=$(hc dump) 35 | echo "$layout" 36 | hc load "$(echo "$layout" | sed -e "s/$prime_winid/TOKEN/g; s/$next_winid/$prime_winid/g; s/TOKEN/$next_winid/g")" 37 | 38 | unlock 39 | --------------------------------------------------------------------------------