guest@dotshare [~/groups/wms/herbstluft] $ ls codesym-hlwm/ | cat

codesym hlwm (scrot) (+1 likes)

milomouse Feb 09, 2014 (wms/herbstluft)

autostart(raw, dl)

SCROT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#! /bin/zsh
#######################################################
## locate: ${XDG_CONFIG_HOME}/herbstluftwm/autostart ##
## author: Vincent Z (github.com/milomouse)          ##
## detail: startup configuration for `herbstluftwm'  ##
#######################################################
## NOTE 1: [most] keybindings are handled by `sxhkd' ##
#######################################################

function _hc() { ex=(${ex} , ${@}) }

## GLOBAL:
#// scheme:
Mod=Mod4
TAG_NAMES=( Ⅰ Ⅱ Ⅲ ⅠV V VⅠ VⅡ VⅢ ⅠⅩ Ⅹ )
TAG_BINDS=( {1..10} )
#// reset:
herbstclient chain , emit_hook reload , keyunbind --all , mouseunbind --all , unsetenv HCT , set default_frame_layout 2 , load default '(clients max:0)' , rename default "${TAG_NAMES[1]}"
#// tags:
for ((i=1; i<$((${TAG_BINDS[-1]}+1)); i++)) ; do
  if [[ $i -gt ${TAG_BINDS[1]} ]] { herbstclient add ${TAG_NAMES[$i]} }
  herbstclient and , keybind $Mod-${i[-1]} use ${TAG_NAMES[$i]} , keybind $Mod-Shift-${i[-1]} move ${TAG_NAMES[$i]}
done
#// mouse:
_hc mousebind $Mod-Button1 move
_hc mousebind $Mod-Button2 zoom
_hc mousebind $Mod-Button3 resize

## SETTINGS:
#// behavioral:
_hc set focus_stealing_prevention 0
_hc set focus_follows_mouse 0
_hc set raise_on_focus 0
_hc set raise_on_click 1
_hc set mouse_recenter_gap 0
#// borders/gaps:
_hc set always_show_frame 1
_hc set frame_bg_transparent 0
_hc set frame_border_width 2
_hc set window_border_width 5
_hc set window_border_inner_width 0
_hc set gapless_grid 1
_hc set frame_gap -2
_hc set window_gap -2
_hc set frame_padding 2
_hc set smart_window_surroundings 0
_hc set smart_frame_surroundings 0
#// colors:
_hc set frame_border_active_color '#101010'
_hc set frame_border_normal_color '#101010'
_hc set frame_bg_active_color '#202020'
_hc set frame_bg_normal_color '#191919'
_hc set window_border_active_color '#343434'
_hc set window_border_normal_color '#161616'
_hc set window_border_urgent_color '#4cdcd4'
#// other:
_hc set tree_style '╾│ ├└╼─┐'
_hc unlock
_hc detect_monitors
_hc pad 0 30 0 0 0

# RULES:
#// global focus:
_hc unrule -F
_hc rule focus=on
#// move to tag:
_hc rule class=Firefox tag=VⅡ
_hc rule class=Dwb tag=VⅢ
_hc rule class=Gimp tag=ⅠⅩ
_hc rule class=Pavucontrol tag=#// management:
_hc rule title="Open Image" pseudotile=on
_hc rule title="Save As" pseudotile=on
_hc rule title="Save file" pseudotile=on
_hc rule class=Toplevel pseudotile=on
_hc rule instance=gcolor2 pseudotile=on
_hc rule class=XFontSel pseudotile=on
_hc rule class=tint2 manage=off focus=off
_hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
_hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off
_hc rule windowtype~'_NET_WM_WINDOW_TYPE_(FULLSCREEN|FS)' fullscreen=on

## RUNTIME:
#// external:
_hc spawn ${XDG_CONFIG_HOME:-$HOME}/herbstluftwm/dzen-post.zsh
_hc emit_hook complete
#// execute chain:
herbstclient chain ${ex}&

CLICK TO VIEW

x

sxhkdrc(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#####################################################
## locate: ${XDG_CONFIG_HOME}/herbstluftwm/sxhkdrc ##
## author: Vincent Z (github.com/milomouse)        ##
## detail: keybinding(s) for `herbstluftwm'        ##
#####################################################
## NOTE 1: spawned and killed from "xinitrc"       ##
#####################################################

###############################
## Internal (herbstluftwm):  ##
###############################

#+ quit herbstluftwm
super + {_,shift +} q
    herbstclient {reload,chain - emit_hook quit_panel - quit}

#+ close focused window
super + control + Pause
    herbstclient close

#+ (lock|unlock) focused tag, with visual
super + x ; {l,u}
    herbstclient chain - set window_border_active_color {'#ab5278' - lock_tag,'#53475b' - unlock_tag}

#+ rotate desktop layout
super + c
    herbstclient rotate

#+ cycle frame layout(s)
super + shift + g
    herbstclient cycle_layout +1 max vertical horizontal grid

#+ choose frame layout(s)
super + shift + t ; {m,v,h,g}
    herbstclient set_layout {max,vertical,horizontal,grid}

#+ reset frame layout to max
super + t
    herbstclient set_layout max

#+ manually split frame at left or right
super + {minus,equal}
    herbstclient split {left,right} 0.5

#+ manually split frame at top or bottom
super + shift + {equal,minus}
    herbstclient split {top,bottom} 0.5

#+ automatically split, and/or shift window to new split (if available)
super + {_,shift +} BackSpace
    herbstclient split {explode,auto}

#+ resize window in direction
super + r : {h,shift + h,j,shift + j,k,shift + k,l,shift + l}
    herbstclient resize {left +,left -,down +,down -,up +,up -,right +,right -}0.01

#+ change focus or move window in direction
super + {_,shift +} {h,j,k,l}
    herbstclient {focus,shift} -e {left,down,up,right}

#+ shift window to edge of tag in direction
super + control + {h,j,k,l}
    herbstclient shift_edge -e {left,down,up,right}

#+ change window focus next/previous
super + {_,shift +} space
    herbstclient cycle {+,-}1

#+ change focus to next/prev desktop occupied with client
super + {n,p}
    /howl/conf/herbstluftwm/tagswitch.sh {next,prev}

#+ change focus to next/prev desktop
super + {period,comma}
    herbstclient use_index {+,-}1 --skip-visible

#+ move window to next/prev desktop
super + shift + {period,comma}
    herbstclient move_index {+,-}1 --skip-visible

#+ change focus between last desktop(s)
super + slash
    herbstclient use_previous

#+ focus or pull urgent window
super + {_,shift +} u
    herbstclient {jumpto,bring} urgent

#+ float/unfloat, fullscreen
super + {f,o}
    herbstclient {pseudotile,fullscreen} toggle

#+ remove frame
super + z
    herbstclient remove

########################
## External:          ##
########################

#+ reload sxhkd config
super + shift + s
    pkill -USR1 -x sxhkd

#+ spawn rxvt-unicode with tmux
super + Return
    urxvt -e tmux -S /tmp/user-keep/h/tmux/xorg

#+ spawn rxvt-unicode
super + shift + Return
    urxvt

#+ spawn application launcher
super + e
    interrobang

#+ disable/enable/hide/unhide the mouse
super + Escape
    zaprat --toggle

#+ refresh all windows
super + b
    xrefresh

#+ mplayer daemon (toggle|stop)
super + {_,shift +} d
    mifo {--toggle,--stop}

#+ mplayer daemon toggle, stop
XF86Audio{Play,Stop}
    mifo {--toggle,--stop}

#+ mplayer daemon randomize
super + shift + slash
    mifo --random

#+ mplayer daemon repeat (on|off)
super + {_,shift +} backslash
    mifo {--repeat off && mifo --repeat on,--repeat off}

#+ mplayer daemon (prev|next)
super + bracket{left,right}
    mifo {--prev,--next}

#+ mplayer daemon next, prev
XF86Audio{Next,Prev}
    mifo {--next,--prev}

#+ pulseaudio mute (toggle|on|off)
super + {_,shift +,ctrl +} m
    pulsevol {--mute,--mute on,--mute off}

#+ pulseaudio toggle
XF86AudioMute
    pulsevol --mute

#+ pulseaudio raise volume
XF86AudioRaiseVolume
    pulsevol --increase 1

#+ pulseaudio lower volume
XF86AudioLowerVolume
    pulsevol --decrease 1

#+ if found, focus on existing dwb instance, else exec dwb
super + w
    /bin/sh -c 'if [[ -n $(pidof dwb) ]] ; then if [[ ${(Q)$(herbstclient stack)[7]} != "VⅢ" ]] ; then herbstclient use VⅢ ; fi ; else exec dwb ; fi'

#+ simple clipboard in/out synchronizer
super + y
    /howl/code/zsh/xclip-wrapper

#+ yank screenshot of current desktop
super + shift + y
    import -window root /howl/foto/shot/$(date '+%Y_%m_%d-%H%M%S').png

# vim: set ft=sxhkdrc:
 

x

dzen-colors.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /bin/zsh
#############################################################
## locate: ${XDG_CONFIG_HOME}/herbstluftwm/dzen-colors.zsh ##
## author: Vincent Z (github.com/milomouse)                ##
## detail: sourced X color settings converted for `dzen2'  ##
#############################################################
## NOTE 1: variable must be set to a valid X settings file ##
## NOTE 2: this script will fail if no *colors are defined ##
#############################################################

XF="${XDG_CONFIG_HOME:-$HOME}/xorg/Xresources"

if [[ -s ${XF} ]]; then
  c_XX='^fg()'
  b_XX='^bg()'
  _XX=${c_XX}${b_XX}
  <${XF} | grep "^*" | while read c ; do
    case "${${(s. .)c:l}[1]}" {
      #'*background:') _bg=${${(s. .)c}[-1]} ; c_bg=^fg(${_bg}) ; b_bg=^bg(${_bg}) ;;
      '*background:') _bg='#191919' ; c_bg=^fg(${_bg}) ; b_bg=^bg(${_bg}) ;;
      '*foreground:') _fg=${${(s. .)c}[-1]} ; c_fg=^fg(${_fg}) ; b_fg=^bg(${_fg}) ;;
      '*color0:') _00=${${(s. .)c}[-1]} ; c_00=^fg(${_00}) ; b_00=^bg(${_00}) ;;  ## black
      '*color8:') _08=${${(s. .)c}[-1]} ; c_08=^fg(${_08}) ; b_08=^bg(${_08}) ;;  ## black:bold
      '*color1:') _01=${${(s. .)c}[-1]} ; c_01=^fg(${_01}) ; b_01=^bg(${_01}) ;;  ## red
      '*color9:') _09=${${(s. .)c}[-1]} ; c_09=^fg(${_09}) ; b_09=^bg(${_09}) ;;  ## red:bold
      '*color2:') _02=${${(s. .)c}[-1]} ; c_02=^fg(${_02}) ; b_02=^bg(${_02}) ;;  ## green
      '*color10:') _10=${${(s. .)c}[-1]} ; c_10=^fg(${_10}) ; b_10=^bg(${_10}) ;; ## green:bold
      '*color3:') _03=${${(s. .)c}[-1]} ; c_03=^fg(${_03}) ; b_03=^bg(${_03}) ;; ## yellow
      '*color11:') _11=${${(s. .)c}[-1]} ; c_11=^fg(${_11}) ; b_11=^bg(${_11}) ;; ## yellow:bold
      '*color4:') _04=${${(s. .)c}[-1]} ; c_04=^fg(${_04}) ; b_04=^bg(${_04}) ;; ## blue
      '*color12:') _12=${${(s. .)c}[-1]} ; c_12=^fg(${_12}) ; b_12=^bg(${_12}) ;; ## blue:bold
      '*color5:') _05=${${(s. .)c}[-1]} ; c_05=^fg(${_05}) ; b_05=^bg(${_05}) ;; ## magenta
      '*color13:') _13=${${(s. .)c}[-1]} ; c_13=^fg(${_13}) ; b_13=^bg(${_13}) ;; ## magenta:bold
      '*color6:') _06=${${(s. .)c}[-1]} ; c_06=^fg(${_06}) ; b_06=^bg(${_06}) ;; ## cyan
      '*color14:') _14=${${(s. .)c}[-1]} ; c_14=^fg(${_14}) ; b_14=^bg(${_14}) ;; ## cyan:bold
      '*color7:') _07=${${(s. .)c}[-1]} ; c_07=^fg(${_07}) ; b_07=^bg(${_07}) ;; ## white
      '*color15:') _15=${${(s. .)c}[-1]} ; c_15=^fg(${_15}) ; b_15=^bg(${_15}) ;; ## white:bold
    }
  done
else
  exit 3
fi
 

x

dzen-init.zsh(raw, dl)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
#! /bin/zsh
###########################################################
## locate: ${XDG_CONFIG_HOME}/herbstluftwm/dzen-init.zsh ##
## author: Vincent Z (github.com/milomouse)              ##
## detail: wm-independent information for `dzen2'        ##
###########################################################
## NOTE 1: script should be ran from the "xinitrc" file  ##
## NOTE 2: needs to be started -before- `herbstluftwm'   ##
## NOTE 3: will NOT be reloaded by `herbstclient reload' ##
### dependencies: #########################################
##    i_mifo() == MIFO       (github.com/milomouse/mifo) ##
##    i_pvol() == PULSEVOL   (^^^^^^/milomouse/pulsevol) ##
##    i_mail() == [none]                                 ##
##    i_load() == [none]                                 ##
##    i_sbat() == [none]                                 ##
##    i_date() == DATE                       [coreutils] ##
###########################################################
## of course, you need ZSH and DZEN2 to exec this script ##
###########################################################

source ${XDG_CONFIG_DIR:-$HOME}/herbstluftwm/dzen-colors.zsh

## FUNCTIONS:
function i_mifo {
  m_=$(mifo -a)           ; [[ ${#m_} -eq 0 ]] && m_="/"
  m_B=${${m_:t:r}//_/ }   ; [[ ${#m_B} -eq 0 ]] && m_B='<unknown>'
  m_A=${${m_:h:h:t}//_/ } ; [[ ${#m_A} -eq 0 ]] && m_A='<unknown>'
  m_D=${${m_:h:t}//_/ }   ; [[ ${#m_D} -eq 0 ]] && m_D='<unknown>'

  T=60 ; t=${T} ; F="${m_B}${m_A}${m_D}"
  ac=${m_A[1,${T}]} ; dc=${m_D[1,${T}]} ; bc=${m_B[1,${T}]}

  # dynamically subtract total output until value <= ${T}
  until [[ ${#F} -le ${T} ]] {
    t=$(( ${t} - 1 ))
    case $x { ; m_D) x=m_B ;; ; m_B) x=m_A ;; ; *) x=m_D ;; ; }
    if [[ ${#${(P)x}} != ${#${${(P)x}[1,$((${t}-1))]% }} ]] {
      typeset ${x}="${${(P)x}[1,$((${t}-2))]}.."
    } else { typeset ${x}=${(P)x}
  } ; F="${m_B}${m_A}${m_D}" ; }

  print - "${c_XX}${b_08} ^bg(#333333)${c_07} ӎplayer2 ${c_08}${b_00}▒${_XX}\
$(mifo -a ${b_08} '^bg(#303030)'${c_12} ${m_A:-%D:2:} ${_XX}\
'^bg(#292929)^fg(#616161)' ${m_D:-%D} ${_XX}\
'^bg(#242424)'${c_13} ${m_B:-%B} ${_XX}\
'^bg(#292929)'${c_08} %e ${_XX}\
'^bg(#333333)'${c_04} %c ${c_XX}/ ${c_12}%C ${_XX})"
}

function i_pvol {
  VOLUME="${${${$(pulsevol -a volume)#0:}/1:/${c_07}ʆ^fg(#666666)}:gs/%/^fg(#484848)&}"
  MUTE="${${$(pulsevol -a mute)/yes/${c_01}}/no/${c_13}}•"
  print - "${c_XX}${b_08} ${c_07}^bg(#333333) ⩗olume ${_XX}\
^bg(#292929)^fg(#666666) ${VOLUME} ${_XX}\
^bg(#333333) ${MUTE} ${_XX}"
}

function i_mail {
  setopt NOnomatch
  ALL=(/howl/mail/*/*/new/*(D.om))
  if [[ $ALL == '/howl/mail/*/*/new/*(D.om)' ]] { unset ALL
  } else { unset N
    print ${(F)ALL} | while { read i } {
      if [[ ${#i} != ${#${i:l}/inbox} ]] { N=$((${N:-0} + 1)) }
  };}
  print - "${c_XX}${b_08} ^bg(#333333)${c_07} ӎailbox ${c_08}${b_00}▒${_XX}${b_08} \
^bg(#292929)^fg(#494949) unread ${_XX}\
^bg(#242424)${c_13} ${N:-0} ${_XX}\
^bg(#292929)^fg(#494949) $((${#ALL} - ${N:-0})) ${_XX}"
}

function i_load {
  LOAD=${${${${${${${${(s. .)$(</proc/loadavg)}[1]/0./${c_08}0.}/1./${c_07}1.}/2./${c_05}2.}/3./${c_04}3.}/4./${c_03}4.}/5./${c_11}5.}//./${c_13}.^fg(#616161)}
  print - "${c_XX}${b_08} ${c_07}^bg(#333333) ɭoadavg ${_XX}\
^bg(#292929)${c_01} ${LOAD} ${_XX}"
}

function i_sbat {
  D=/sys/class/power_supply/BAT0
  if [[ ! -d $D ]] { STATE="^fg(#444444)∼" ; CHARGE=' - '
  } else { STATE=${$(<${D}/status):l} ; CHARGE=$(<${D}/capacity) }
  STATE=${${${${STATE/full/${c_12}}/discharging/${c_01}}/charging/${c_03}}/unknown/^fg(#444444)∼}
  BAT="${b_08} ^bg(#292929) ${STATE} ${b_08}${c_07} ${CHARGE}^fg(#666666)%"
  print - "${c_XX}${b_08} ${c_07}^bg(#333333) Ϧattery ${c_08}${b_00}▒${_XX}${BAT} ${_XX}"
}

function i_date {
  date "+${c_XX}${b_08} ${c_07}${_XX}\
^bg(#292929) ^fg(#616161)%b %d ${_XX}\
^bg(#333333) ^fg(#585858)%a ${_XX}\
${b_08} ${c_07}%H:%M ${_XX}"
}

## RUNTIME:
_font='-misc-fixedzero-medium-r-semicondensed-*-12-110-75-75-c-60-iso10646-1'
_wide='1260'
function left { print - "$(i_mifo) $(i_pvol)" }
function right { print - "$(i_mail) $(i_load) $(i_sbat) $(i_date)${_XX} "}

while true ; do
  _rwide=$(( $(print - ${#${"$(right | sed 's.\^[^(]*([^)]*)..g')"}}) * 6 - 5))
  print - "$(left)^pa($((${_wide} - ${_rwide})))$(right)"
  sleep 1s
done | dzen2 -p -x 335 -y 0 -h 16 -w ${_wide} -ta l -bg ${_bg} -fg ${_fg} \
       -fn '-misc-fixedzero-medium-r-semicondensed-*-12-110-75-75-c-60-iso10646-1' \
       &>/dev/null || exit 7
 

x

dzen-post.zsh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#! /bin/zsh
###########################################################
## locate: ${XDG_CONFIG_HOME}/herbstluftwm/dzen-post.zsh ##
## author: Vincent Z (github.com/milomouse)              ##
## detail: hlwm specific tag(s) information for `dzen2'  ##
###########################################################
## NOTE 1: relies on `herbstluftwm' to be up and running ##
## NOTE 2: script is dynamic and only updates on changes ##
## NOTE 3: able to be reloaded by `herbstclient reload'  ##
### dependencies: #########################################
##    HERBSTLUFTWM                    (herbstluftwm.org) ##
##      `> HERBSTCLIENT                                  ##
## of course, you need ZSH and DZEN2 to exec this script ##
###########################################################

herbstclient getenv DISPLAY &>/dev/null || exit 1
source ${XDG_CONFIG_DIR:-$HOME}/herbstluftwm/dzen-colors.zsh

herbstclient --idle | while read i ; do
  if [[ $i == complete || $i =~ tag_ ]]; then
    tags=( $(herbstclient tag_status) ) || exit 2
    cnum="${(w)#${${${${"$(herbstclient stack)"}/*Normal Layer}/Frame Layer*}//[[:punct:][:blank:]]}}"
    case ${#cnum} {
      2) cnum=("^fg(#616161)${cnum[1,2]}") ;;
      1|0) cnum=("#^fg(#616161)${cnum}") ;;
      *) cnum=(">=") ;;
    }
    for i ( $tags ) {
      case ${i[1]} {
        '#') tags=("${tags/$i/${c_00}${b_07}${i#[[:graph:]]}${b_08} }") ;;
        '+') tags=("${tags/$i/^fg(#707070)${i#[[:graph:]]} }") ;;
        '%') tags=("${tags/$i/${c_04}${i#[[:graph:]]} }") ;;
        '-') tags=("${tags/$i/^fg(#707070)${i#[[:graph:]]} }") ;;
        '.') tags=("${tags/$i/^fg(#707070)${i#[[:graph:]]} }") ;;
        ':')
          _n=(${#${(M)${$(herbstclient layout ${i[2,-1]})}#0[[:alpha:]]}})
          case ${_n} {
            0) _N=' ' ;;
            1) _N='¹' ;;
            2) _N='²' ;;
            3) _N='³' ;;
            4) _N='⁴' ;;
            *) _N='֡' ;; #'keepforsyntax
          }
          tags=("${tags/$i/${c_fg}${i#[[:graph:]]}^fg(#696969)${_N}}")
        ;;
        '!') tags=("${tags/$i/${c_01}${i#[[:graph:]]} }") ;;
        *) tags=("${tags/$i/^fg(#707070)${i#[[:graph:]]} }") ;;
      }
    }
    print "${_XX}${b_08} ${c_XX}${b_00}${c_07} ɦerbstluftwm ${b_08} ${c_XX}^bg(#2a2a2a)${tags:-${c_08}$(repeat 12 { printf " · " })}^bg(#292929)${c_08} ${cnum} ${_XX}"
  elif [[ $i =~ quit || $i =~ reload ]]; then
    kill $!
    exit
  fi
done | dzen2 -p -x 5 -y 0 -w 332 -h 16 -ta l -bg ${_bg} -fg ${_fg} \
       -fn '-misc-fixedzero-medium-r-semicondensed-*-12-110-75-75-c-60-iso10646-1' \
       &>/dev/null || exit 5
 

x

tagswitch.sh(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#! /bin/bash
# vim: set fileencoding=utf-8 ts=4 sts=4 sw=4 tw=80 expandtab :

# Copyright (C) 2012 Florian Bruhin <me@the-compiler.org>

# tagswitch is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# tagswitch is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with tagswitch  If not, see <http://www.gnu.org/licenses/>.

# Changes herbstluftwm tags

checkuse() {
    if [[ "${tags[$1]}" != [.!]* ]]; then # tag is not unused
        herbstclient use "${tags[$1]:1}" # cutting off first char (.#:!)
        exit 0
    fi
}

tags=( $(herbstclient tag_status) )

# Find the currently active tag
for ((i=0; i<="${#tags[@]}"; i++)); do
    [[ "${tags[i]}" == "#"* ]] && activetag="$i"
done

if [[ "$1" == next ]]; then # next active tag
    for ((i="$((activetag+1))"; i<"${#tags[@]}"; i++)); do
        checkuse "$i"
    done
    # at the end of the taglist, wrap around
    for ((i=0; i<"$activetag"; i++)); do
        checkuse "$i"
    done
elif [[ "$1" == prev ]]; then # previous active tag
    for ((i="$((activetag-1))"; i>=0; i--)) do
        checkuse "$i"
    done
    # at the beginning of the taglist, wrap around
    for ((i=${#tags[@]}-1; i>$((activetag-1)); i--)) do
        checkuse "$i"
    done
else
    echo "Usage: $0 [next|prev]"
    exit 1
fi
 

x

xinitrc(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/zsh
##############################################
## locate: ${XDG_CONFIG_HOME}/xorg/xinitrc  ##
## author: milomouse (github.com/milomouse) ##
## detail: X.Org init configuration file    ##
##############################################

## RESOURCES:
/usr/bin/xrdb -load ${XDG_CONFIG_HOME:-$HOME}/xorg/Xresources

## KEYBOARD:
/usr/bin/xmodmap ${XDG_CONFIG_HOME:-$HOME}/keymaps/overlay-mods.xmodmap

## MOUSE:
/usr/bin/xsetroot -cursor_name left_ptr -solid '#151515'
/usr/local/bin/zaprat --disable

## BACKGROUND:
/usr/bin/display -window root -resize 1600x900! ${XDG_DATA_HOME:-~/share}/images/astrolithe-void.jpg

## WINDOW MANAGER:
exec ${XDG_CONFIG_HOME:-$HOME}/herbstluftwm/dzen-init.zsh &>/dev/null &
/usr/bin/sxhkd -c ${XDG_CONFIG_HOME:-$HOME}/herbstluftwm/sxhkdrc &
exec /usr/bin/herbstluftwm --locked -c ${XDG_CONFIG_HOME:-$HOME}/herbstluftwm/autostart &>/dev/null
 

x

.interrobangrc(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
## | ~/.interrobangrc
## | mostly centered, large display

# Cosmetics:
set font      = -artwiz-fkp-medium-r-normal-*-16-160-75-75-m-80-iso10646-1
set geometry  = 1000x16+300+28
set border    = 14px #363636
set colors    = #666666 #363636 #363636 #464646 #363636 #666666

# Behavior:
set bangchar  = !
set autocomp  = 1
set list      = true
set last      = true
set margin    = -30
set run_hook  = %s || (notify-send "interrobang" "command not valid or exit non-zero")

# !BANG syntax:
bang term     = urxvt -e %s
bang dwb      = dwb %s
bang ff       = firefox %s
bang firefox  = firefox %s
bang pdf      = mupdf %s
bang man      = urxvt -e man %s
bang calc     = notify-send "$(echo '%s' | bc -l)"
bang dic      = notify-send "$(sdcv -n --utf8-output -u WordNet '%s')"
bang ?        = echo "interrobang ignored \"%s\""

# Tab completion for !BANG(s):
tab default   = percontation "%s" %s | sort -u
tab ff        = [[ -n $(xclip -selection primary -o) ]] && sel=primary || sel=clipboard ; echo "%s%s$(xclip -selection ${sel} -o)"
tab firefox   = [[ -n $(xclip -selection primary -o) ]] && sel=primary || sel=clipboard ; echo "%s%s$(xclip -selection ${sel} -o)"
tab dwb       = [[ -n $(xclip -selection primary -o) ]] && sel=primary || sel=clipboard ; echo "%s%s$(xclip -selection ${sel} -o)"
tab calc      = str="%s%s"; echo "!calc $(echo ${str#\!calc} | bc -l)"
tab ?         = ignore="%s%s"; awk '/^bang/ {print $2;}' ~/.interrobangrc
 

x

Notes

Snapshot of my herbstluftwm setup.
This one is less distracting and has a lot of code cleanup.

Be sure to check out supplied xinitrc for more info on startup.

SETUP:

  • herbstluftwm
  • sxhkd
  • dzen2
  • interrobang
  • zsh

FILES:

  • herbstluftwm / autostart
  • herbstluftwm / sxhkdrc
  • herbstluftwm / dzen-colors.zsh
  • herbstluftwm / dzen-init.zsh
  • herbstluftwm / dzen-post.zsh
  • herbstluftwm / tagswitch.sh
  • .interrobang
  • xinitrc

( some minor details may have changed since screenshot )
( for latest configs visit: https://github.com/milomouse/dotfiles )