Commits

firefly  committed 57f5e75

Update HLWM panel.sh to not use fixed widths and assume clickable-area support
in dzen2.

  • Participants
  • Parent commits f463101

Comments (0)

Files changed (4)

File herbstluftwm/autostart

 
 hc emit_hook reload
 
-xsetroot -solid '#111111'
+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"
+#feh --bg-fill "$HOME/pics/copland-os/copland-os_768.png"
 
 
 Mod=Mod4
 #hc set window_border_active_color '#9fbc00'
 #hc set window_border_active_color '#00ff00'
 
-#hc set frame_border_active_color   '#AA5500'
-#hc set window_border_active_color  '#AA5500'
-#hc set frame_bg_active_color       '#080808'
-#hc set frame_border_normal_color   '#222222'
+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 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 2
+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

File herbstluftwm/panel.sh

 #panel_width=${geometry[2]}
 panel_height=14
 
-panel_left_width=600
-panel_right_width=$((${geometry[2]} - $panel_left_width))
+font="Envy Code R-6"
+bgcolor="$HC_BACKGROUND"
+fgcolor='#EFEFEF'
+selbg="$(herbstclient get window_border_active_color)"
+selfg="$fgcolor"
 
-#font="-misc-fixed-medium-*-*-*-10-*-*-*-*-*-*-*"
-#font="DejaVu Sans Mono:pixelsize=10"
-font="Envy Code R:pixelsize=10"
-bgcolor=$(herbstclient get frame_border_normal_color)
-selbg=$(herbstclient get window_border_active_color)
-selfg='#CCC'
 
-####
-# true if we are using the svn version of dzen2
-dzen2_version=$(dzen2 -v 2>&1 | head -n 1 | cut -d , -f 1|cut -d - -f 2)
-if [ -z "$dzen2_version" ] ;then
-  dzen2_svn="true"
-else
-  dzen2_svn=""
-fi
+# Output is piped through this function before reaching the panel
+function pre_filter {
+  cat
+}
 
 function uniq_linebuffered() {
   awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
 # Begin actual bar implementation
 herbstclient pad $monitor $panel_height
 {
-  #### Emit events here
+  ##-- Event emitters -----------------
   # player (mpd)
   mpc idleloop player &
   mpc_pid=$!
   windowtitle=""
 
   Default="^fg()--"
- #sep="^bg()^fg($selbg)│"
-  sep=" "
+  sep="^bg()^fg($selbg) "
 
   # fields of the right panel
   date="$Default"
   traypadding=0
 
   while true; do
-    #### Draw panels here
+    ##-- Draw panel -------------------
     # First, draw tags to left panel
     for i in "${TAGS[@]}"; do
       case ${i:0:1} in
-        '#')  echo -n "^bg($selbg)^fg($selfg)"    ;;
-        '+')  echo -n "^bg(#9CA668)^fg(#141414)"  ;;
-        ':')  echo -n "^bg()^fg(#ffffff)"         ;;
-        '!')  echo -n "^bg(#FF0675)^fg(#141414)"  ;;
-        *)    echo -n "^bg()^fg(#ababab)"         ;;
+      # '.')                                      ;; # 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
 
-      if [ ! -z "$dzen2_svn" ] ; then
-        echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
-      else
-        echo -n " ${i:1} "
-      fi
+      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 "^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 $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
 
-    # Wait for next event
+    ##-- Listen for events ------------
     read line || break
     cmd=( $line )
     # branch on event origin
         ;;
 
       quit_panel|reload)
-        exit ;;
+        exit
+        ;;
 
       togglehidepanel)
         echo "^togglehide()"
 
       # ...then, custom events
       toggle_runner)
-        dmenu_run -fn "$font" -nb "$bgcolor" -nf "#efefef" \
+        dmenu_run -fn "$font" -nb "$bgcolor" -nf "$fgcolor" \
                   -sb "$selbg" -sf "$selfg"
         ;;
 
 
                       color=$( ([ "$percent" -le 10 ] && echo '^bg(#CC3333)') ||
                                ([ "$percent" -le 25 ] && echo '^bg(#AA8800)') ||
-                               (true                  && echo '') )
+                               (true                  && echo '^bg()') )
 
                       case $status in
                         Full|Unknown)  printf '^fg(#909090)%s' $status ;;
-                        *)  printf '^fg(#909090)%s: %s^fg() %d%% ^bg()' $status $bg $percent ;;
+                        *)  printf '^fg(#909090)%s:^fg()%s %d%% ^bg()' $status $color $percent ;;
                       esac )"
 
         thermstatus="$( t='/sys/class/thermal/thermal_zone0'
 
       mpd_player|player)
         nowplaying="$(mpc current -f '^fg()[%artist% - ][%title%|%file%]')"
-      # nowplaying="$(mpc current -f '^fg()%artist% - %title%')"
         ;;
 
       stalonetray_geometry)
     esac
   done
 } 2>/dev/null \
-  1> >(dzen2 -fn "$font" -y $y -h $panel_height -fg '#efefef' -bg "$bgcolor" \
-             -ta l  -x $x  -w $panel_left_width) \
-  3> >(dzen2 -fn "$font" -y $y -h $panel_height -fg '#efefef' -bg "$bgcolor" \
-             -ta r  -x $panel_left_width  -w $panel_right_width)
+  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")
 
 ## Aliases
 try_alias  ls    ls --color=auto
 #try_alias  grep  grep -P --color=auto
-try_alias  sed   ssed -R
+#try_alias  sed   ssed -R
 try_alias  grepall  grep --color=always -C9999
 # not ready yet--the word wrapping is too bad :(
 #try_export PAGER "$HOME/.vim/macros/less.sh"
 "let g:airline_right_sep              = '〈' "<▐
 let g:airline_theme                  = 'simple'
 
-set laststatus=2
-
 
 call pathogen#infect()