aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xherbstluftwm/.config/herbstluftwm/panel.sh145
-rw-r--r--herbstluftwm/.config/herbstluftwm/panel_indicators.sh3
-rw-r--r--herbstluftwm/.config/herbstluftwm/theme1
3 files changed, 82 insertions, 67 deletions
diff --git a/herbstluftwm/.config/herbstluftwm/panel.sh b/herbstluftwm/.config/herbstluftwm/panel.sh
index b1ecebe..70e8154 100755
--- a/herbstluftwm/.config/herbstluftwm/panel.sh
+++ b/herbstluftwm/.config/herbstluftwm/panel.sh
@@ -1,9 +1,9 @@
1#!/bin/bash 1#!/bin/bash
2 2
3dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 3dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
4 4
5hc() { 5hc() {
6 "${herbstclient_command[@]:-herbstclient}" "$@" ; 6 "${herbstclient_command[@]:-herbstclient}" "$@"
7} 7}
8 8
9source "$dir/theme" 9source "$dir/theme"
@@ -11,16 +11,18 @@ source "$dir/panel_indicators.sh"
11 11
12monitor=${1:-0} 12monitor=${1:-0}
13 13
14geometry=( $(herbstclient monitor_rect "$monitor") ) 14geometry=($(herbstclient monitor_rect "$monitor"))
15if [ -z "$geometry" ] ;then 15if [ -z "$geometry" ] ;then
16 echo "Invalid monitor $monitor" 16 echo "Invalid monitor $monitor"
17 exit 1 17 exit 1
18fi 18fi
19# geometry has the format W H X Y 19
20# Geometry has the format W H X Y
20x=$(echo "${geometry[0]} + $window_p" | bc) 21x=$(echo "${geometry[0]} + $window_p" | bc)
21y=$(echo "${geometry[1]} + $window_p" | bc) 22y=$(echo "${geometry[1]} + $window_p" | bc)
23
22panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc) 24panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc)
23bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font,$font_sec -u 2 -B $acolor_bg -F $acolor_fg" 25bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font -f $icon_font -u 2 -B $acolor_bg -F $acolor_fg"
24 26
25hc pad $monitor $(echo "$panel_h + $window_p" | bc) 27hc pad $monitor $(echo "$panel_h + $window_p" | bc)
26 28
@@ -28,13 +30,13 @@ if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
28 # mawk needs "-W interactive" to line-buffer stdout correctly 30 # mawk needs "-W interactive" to line-buffer stdout correctly
29 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 31 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
30 uniq_linebuffered() { 32 uniq_linebuffered() {
31 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" 33 awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
32 } 34 }
33else 35else
34 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so 36 # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
35 # we don't want to use it there. 37 # we don't want to use it there.
36 uniq_linebuffered() { 38 uniq_linebuffered() {
37 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" 39 awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
38 } 40 }
39fi 41fi
40 42
@@ -43,29 +45,36 @@ fi
43 # <eventname>\t<data> [...] 45 # <eventname>\t<data> [...]
44 # e.g. 46 # e.g.
45 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 47 # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
48
46 while true ; do 49 while true ; do
47 music 50 music &
48 volume 51 volume &
49 network 52 network &
50 battery 53 battery &
51 clock 54 clock &
52 sleep 1 || break 55 sleep 1 || break
53 done > >(uniq_linebuffered) & 56 done > >(uniq_linebuffered) &
57
54 childpid=$! 58 childpid=$!
55 hc --idle 59 hc --idle
56 kill $childpid 60 kill $childpid
61
57} 2> /dev/null | { 62} 2> /dev/null | {
58 63
59 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" 64 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
65
60 visible=true 66 visible=true
67
61 date="" 68 date=""
62 volume="" 69 volume=""
63 battery="" 70 battery=""
64 net="" 71 net=""
65 windowtitle="" 72 windowtitle=""
73
74 separator="%{F$acolor_accent}|%{F-}"
75
66 while true ; do 76 while true ; do
67 separator="%{F$acolor_accent}|%{F-}" 77
68 # draw tags
69 for i in "${tags[@]}" ; do 78 for i in "${tags[@]}" ; do
70 case ${i:0:1} in 79 case ${i:0:1} in
71 '#') 80 '#')
@@ -86,15 +95,16 @@ fi
86 esac 95 esac
87 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" 96 echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}"
88 done 97 done
98
89 echo -n "$separator%{F-}%{B-} " 99 echo -n "$separator%{F-}%{B-} "
90 echo -n "${windowtitle//^/^^}" 100 echo -n "${windowtitle//^/^^}"
91 101
92 #Right part of panel 102 # Right part of panel
93 right="$music$volume$net$battery$date " 103 right="$music$volume$net$battery$date "
94 echo -n "%{r}$right" 104 echo -n "%{r}$right"
95 105
96 #DO NOT REMOVE THIS ECHO 106 #DO NOT REMOVE THIS ECHO
97 echo 107 echo
98 108
99 # wait for next event 109 # wait for next event
100 IFS=$'\t' read -ra cmd || break 110 IFS=$'\t' read -ra cmd || break
@@ -103,38 +113,38 @@ fi
103 #echo "resetting tags" >&2 113 #echo "resetting tags" >&2
104 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" 114 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
105 ;; 115 ;;
106 music) 116 music)
107 music="${cmd[@]:1}" 117 music="${cmd[@]:1}"
108 if [ $music == "off" ] ; then 118 if [ $music == "off" ] ; then
109 music="" 119 music=""
110 else 120 else
111 music="$music $separator%{B-} " 121 music="$music $separator%{B-} "
112 fi 122 fi
113 ;; 123 ;;
114 volume) 124 volume)
115 volume="${cmd[@]:1}" 125 volume="${cmd[@]:1}"
116 if [ $volume == "off" ] ; then 126 if [ $volume == "off" ] ; then
117 volume="" 127 volume=""
118 else 128 else
119 volume="$volume $separator%{B-} " 129 volume="$volume $separator%{B-} "
120 fi 130 fi
121 ;; 131 ;;
122 net) 132 net)
123 net="${cmd[@]:1}" 133 net="${cmd[@]:1}"
124 if [ $net = "off" ] ; then 134 if [ $net = "off" ] ; then
125 net="" 135 net=""
126 else 136 else
127 net="$net $separator%{B-} " 137 net="$net $separator%{B-} "
128 fi 138 fi
129 ;; 139 ;;
130 battery) 140 battery)
131 battery="${cmd[@]:1}" 141 battery="${cmd[@]:1}"
132 if [ $battery == "off" ] ; then 142 if [ $battery == "off" ] ; then
133 battery="" 143 battery=""
134 else 144 else
135 battery="$battery $separator%{B-} " 145 battery="$battery $separator%{B-} "
136 fi 146 fi
137 ;; 147 ;;
138 date) 148 date)
139 #echo "resetting date" >&2 149 #echo "resetting date" >&2
140 date="${cmd[@]:1}" 150 date="${cmd[@]:1}"
@@ -144,18 +154,23 @@ fi
144 ;; 154 ;;
145 esac 155 esac
146 done 156 done
157
147} 2> /dev/null | lemonbar $bar_opts | { 158} 2> /dev/null | lemonbar $bar_opts | {
148 #Handle clickable areas 159
149 while read line; do 160 #Handle clickable areas
150 IFS=',' read -a c <<< $(echo $line) 161 while read line; do
151 case "${c[0]}" in 162 IFS=',' read -a c <<< $(echo $line)
152 tag) 163 case "${c[0]}" in
153 herbstclient use "${c[1]}" 164 tag)
154 echo "herbstclient use \"${c[1]}\"" 165 herbstclient use "${c[1]}"
155 ;; 166 echo "herbstclient use \"${c[1]}\""
156 *)