guest@dotshare [~/groups/wms/herbstluft] $ ls Dark-orange/ | cat

Dark & orange (scrot)

FireFly Jul 19, 2013 (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
 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#!/bin/bash

# this is a simple config for herbstluftwm

# Update the $PATH so that ~/.config/herbstluftwm and /etc/xdg/hebrstluftwm are
# searched (in that order) too.  Useful for splitting the config file into
# multiple scripts, and to include small utility scripts.
PATH="$XDG_CONFIG_HOME/herbstluftwm:$XDG_CONFIG_PATH/herbstluftwm:$PATH"

function hc() {
  herbstclient "$@"
}

hc emit_hook reload

export HC_BACKGROUND='#02080F'
xsetroot -solid "$HC_BACKGROUND"
#feh --bg-fill $HOME/annat/diverse/wallpapers/internet-nodes.jpg
#feh --bg-fill "$HOME/pics/copland-os/copland-os_768.png"


Mod=Mod4
Term=pangoterm

# tags
TAG_NAMES=( {1..9} )
TAG_KEYS=( {1..9} 0 )

hc rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do
    hc add "${TAG_NAMES[$i]}"
done

##-- Keybindings ----------------------------------------------------
# remove all existing keybindings
hc keyunbind --all

# General window management
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close

hc keybind $Mod-Return spawn "$Term"
hc keybind $Mod-r emit_hook toggle_runner

# Setup tag bindings
#hc rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do
#   hc add "${TAG_NAMES[$i]}"
    key="${TAG_KEYS[$i]}"
    if ! [ -z "$key" ] ; then
        hc keybind "$Mod-$key" use_index "$i"
        hc keybind "$Mod-Shift-$key" move_index "$i"
    fi
done

# cycling
#hc keybind $Mod-Right  use_index +1 --skip-visible
#hc keybind $Mod-Left   use_index -1 --skip-visible
hc keybind $Mod-c cycle

# layouting
hc keybind $Mod-d remove
hc keybind $Mod-space       cycle_layout +1
hc keybind $Mod-Shift-space cycle_layout -1
hc keybind $Mod-minus split vertical 0.5
hc keybind $Mod-v split horizontal 0.5

hc keybind $Mod-m fullscreen toggle
hc keybind $Mod-f floating   toggle
hc keybind $Mod-p pseudotile toggle

# resizing
RESIZESTEP=0.05
hc keybind $Mod-Control-h resize left +$RESIZESTEP
hc keybind $Mod-Control-t resize down +$RESIZESTEP
hc keybind $Mod-Control-n resize up +$RESIZESTEP
hc keybind $Mod-Control-s resize right +$RESIZESTEP

# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 resize
hc mousebind $Mod-Button3 zoom

# focus
hc keybind $Mod-BackSpace   cycle_monitor
hc keybind $Mod-Tab         use_previous
#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-t focus down
hc keybind $Mod-n focus up
hc keybind $Mod-s focus right

#hc keybind $Mod-i jumpto urgent
hc keybind $Mod-a jumpto urgent

hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-t shift down
hc keybind $Mod-Shift-n shift up
hc keybind $Mod-Shift-s shift right

### External/Etc
hc keybind XF86MonBrightnessDown spawn backlight.sh - 1
hc keybind XF86MonBrightnessUp   spawn backlight.sh + 1

hc keybind $Mod-F10              spawn scrotnow.sh
hc keybind XF86Display           detect_monitors

# Volume
hc keybind XF86AudioMute         spawn mute_toggle
hc keybind XF86AudioLowerVolume  spawn vol_down
hc keybind XF86AudioRaiseVolume  spawn vol_up

# XF86Display
# XF86Launch3

# Samsung
#hc keybind XF86Launch1 spawn \
#    samsung-tools --show-notify --quiet --backlight hotkey
#hc keybind XF86Launch2 spawn \
#    samsung-tools --show-notify --quiet --bluetooth hotkey

# MPC
hc keybind $Mod-Alt-h spawn mpc toggle
hc keybind $Mod-Alt-t spawn mpc prev
hc keybind $Mod-Alt-n spawn mpc next


##-- Options --------------------------------------------------------
# colors
#hc set frame_border_active_color '#994422'
#hc set frame_border_normal_color '#101010'
#hc set frame_bg_active_color '#345F0C'
#hc set window_border_normal_color '#454545'
#hc set window_border_active_color '#9fbc00'
#hc set window_border_active_color '#00ff00'

hc set frame_border_active_color   '#CC6600'
hc set window_border_active_color  '#CC6600'
hc set frame_bg_active_color       '#080808'
hc set frame_border_normal_color   '#222222'
hc set window_border_normal_color  '#222222'
hc set frame_bg_normal_color       '#111111'

#hc set frame_border_active_color   '#3366AA'
#hc set window_border_active_color  '#3366AA'
#hc set frame_bg_active_color       '#000000'
#hc set frame_border_normal_color   '#021433'
#hc set window_border_normal_color  '#222222'
#hc set frame_bg_normal_color       '#111111'

hc set focus_follows_shift 1

hc set frame_bg_transparent 1
hc set frame_border_width 1
hc set window_border_width 1
hc set window_border_inner_width 1
hc set always_show_frame 0
hc set frame_gap 8
# add overlapping window borders
hc set window_gap -1
hc set frame_padding 0
hc set smart_window_surroundings 1
hc set smart_frame_surroundings 0

# rules
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
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' tag=float
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off

# unlock, just to be sure
hc unlock

#herbstclient set tree_style '╾│ ├└╼─┐'
herbstclient set tree_style '⊙│ ├╰»─╮'

# do multi monitor setup here, e.g.:
# hc remove_monitor 1
# hc move_monitor 0 1280x1024+0+0
# hc add_monitor 1280x1024+1280+0

# auto-detect connected monitors
hc detect_monitors

# find the panel
panel=~/.config/herbstluftwm/panel.sh
#[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
    # start it on each monitor
    $panel $monitor &
done

# Prepare a (virtual) monitor + tag for floating windows (we do this after the
# panel etc. have been added, because we don't want these for the
# floating-windows monitor).
hc lock

hc tag float
hc floating float on
#hc remove_monitor 1
hc add_monitor 1366x768+0+0 float 16

hc unlock

CLICK TO VIEW

x

panel.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
 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/bin/bash

# Check which monitor this is
monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )

if [ -z "$geometry" ]; then
  echo >&2 "Invalid monitor: $monitor"
  exit 1
fi

# Config stuff
x=${geometry[0]}
y=${geometry[1]}
#panel_width=${geometry[2]}
panel_height=14

font="Envy Code R-6"
bgcolor="$HC_BACKGROUND"
fgcolor='#EFEFEF'
selbg="$(herbstclient get window_border_active_color)"
selfg="$fgcolor"


# Output is piped through this function before reaching the panel
function pre_filter {
  cat
}

function uniq_linebuffered() {
  awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

function run_stalonetray {
  stalonetray -bg "$bgcolor" --geometry '1x1-0+0' --grow-gravity E \
              -i 16 --log-level info 2>&1                          \
    | tee /tmp/bleh3 \
    | grep '' \
    | tee /tmp/bleh
   #| sed -nr '/^geometry:/ {s/^geometry:/stalonetray_geometry/; s/[-+x]/ /g; p}' \
}

# Begin actual bar implementation
herbstclient pad $monitor $panel_height
{
  ##-- Event emitters -----------------
  # player (mpd)
  mpc idleloop player &
  mpc_pid=$!

# run_stalonetray &
# stalonetray_pid=$(pidof stalonetray)

  # tick
  while true; do echo tick; sleep 20; done &
  tick_pid=$!

  # date
  while true; do
    date +'date ^fg()%H^fg(#909090):^fg()%M^fg(#909090), %Y-%m-^fg()%d'
    sleep 1 || break
  done > >(uniq_linebuffered) &
  date_pid=$!

  # hlwm events
  herbstclient --idle

  # exiting; kill stray event-emitting processes
  kill $date_pid $mpc_pid $tick_pid $stalonetray_pid

} 2>/dev/null | {
  # Default values for the panel-drawing part
  TAGS=( $(herbstclient tag_status $monitor) )
  visible=true

  windowtitle=""

  Default="^fg()--"
  sep="^bg()^fg($selbg) "

  # fields of the right panel
  date="$Default"
  brightstatus="$Default"
  batstatus="$Default"
  thermstatus="$Default"
  nowplaying="$Default"
  wicdstatus="$Default"

  traypadding=0

  while true; do
    ##-- Draw panel -------------------
    # First, draw tags to left panel
    for i in "${TAGS[@]}"; do
      case ${i:0:1} in
      # '.')                                      ;; # Empty
        ':')  echo -n "^bg()^fg(#ffffff)"         ;; # Not empty
        '+')  echo -n "^bg(#9CA668)^fg(#141414)"  ;; # Viewed on this monitor, not focused
        '#')  echo -n "^bg($selbg)^fg($selfg)"    ;; # Viewed on this monitor, is focused
      # '-')                                      ;; # Viewed on other monitor, not focused
      # '%')                                      ;; # Viewed on other monitor, is focused
        '!')  echo -n "^bg(#FF0675)^fg(#141414)"  ;; # Contains urgent window
         * )  echo -n "^bg()^fg(#ababab)"         ;; # Default
      esac

      echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
    done

    # Then, draw the rest of the left panel
    echo -n "$sep"
    echo "^bg()^fg() ${windowtitle//^/^^}"

    # Then, the right panel
    echo >&3 -n " $sep $brightstatus"  # ☀
    echo >&3 -n " $sep $thermstatus"   # ♨
    echo >&3 -n " $sep $batstatus"     # ⚡
    echo >&3 -n " $sep $nowplaying"    # ♫
    echo >&3 -n " $sep $wicdstatus"    # ⌬
    echo >&3 -n " $sep $date"          # ⌚
    echo >&3 -n " $sep "
    echo >&3

    ##-- Listen for events ------------
    read line || break
    cmd=( $line )
    # branch on event origin
    case "${cmd[0]}" in
      # First, herbstluft's built-in events...
      tag*)
        #echo "reseting tags" >&2
        TAGS=( $(herbstclient tag_status $monitor) )
        ;;

      quit_panel|reload)
        exit
        ;;

      togglehidepanel)
        echo "^togglehide()"
        if $visible ; then
            visible=false
            herbstclient pad $monitor 0
        else
            visible=true
            herbstclient pad $monitor $panel_height
        fi
        ;;

      focus_changed|window_title_changed)
        windowtitle="${cmd[@]:2}"
        ;;

      # ...then, custom events
      toggle_runner)
        dmenu_run -fn "$font" -nb "$bgcolor" -nf "$fgcolor" \
                  -sb "$selbg" -sf "$selfg"
        ;;

      date)
        #echo "reseting date" >&2
        date="${cmd[@]:1}"
        ;;

      brightness)
        brightstatus="$(printf '^fg()%d^fg(#909090)%%' $(backlight.sh '?'))"
        ;;

      tick)
        batstatus="$( t='/sys/class/power_supply/BAT1/'
                      curr=$(cat $t/charge_now)
                      full=$(cat $t/charge_full_design)
                      status=$(cat $t/status)
                      percent=$(printf '100 * %d / %d\n' $curr $full | bc)

                      color=$( ([ "$percent" -le 10 ] && echo '^bg(#CC3333)') ||
                               ([ "$percent" -le 25 ] && echo '^bg(#AA8800)') ||
                               (true                  && echo '^bg()') )

                      case $status in
                        Full|Unknown)  printf '^fg(#909090)%s' $status ;;
                        *)  printf '^fg(#909090)%s:^fg()%s %d%% ^bg()' $status $color $percent ;;
                      esac )"

        thermstatus="$( t='/sys/class/thermal/thermal_zone0'
                        curr=$(cat $t/temp)
                        degrees=$(printf '%d / 1000\n' $curr | bc)
                        printf '^fg()%d^fg(#909090)°C' $degrees )"

        wicdstatus="$( essid=$(wicd-cli -d --wireless \
                             | grep Essid | cut -d' ' -f2-)
                       [ -z "$essid" ] && essid='--'
                       printf '^fg()%s' $essid )"
        ;;

      mpd_player|player)
        nowplaying="$(mpc current -f '^fg()[%artist% - ][%title%|%file%]')"
        ;;

      stalonetray_geometry)
        traypadding="${cmd[@]:1}"
        ;;
    esac
  done
} 2>/dev/null \
  1> >(pre_filter | dzen2  -fn "$font"  -y $y  -h $panel_height  -expand right \
          -fg "$fgcolor" -bg "$bgcolor") \
  3> >(pre_filter | dzen2  -fn "$font"  -y $y  -h $panel_height  -expand left \
          -fg "$fgcolor" -bg "$bgcolor")
 

x

Notes

My current herbstluftwm setup. Uses dark colours with bright orange to highlight currently selected {tag,window}.