diff options
Diffstat (limited to '.config/herbstluftwm/panel.sh')
| -rwxr-xr-x | .config/herbstluftwm/panel.sh | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 4e35d0d..ac06100 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh | |||
| @@ -13,11 +13,11 @@ monitor=${1:-0} | |||
| 13 | panel_height=$2 | 13 | panel_height=$2 |
| 14 | padding=$3 | 14 | padding=$3 |
| 15 | 15 | ||
| 16 | light=$(add_alpha_channel $4) | 16 | light=$(add_alpha_channel $WM_LIGHT) |
| 17 | llight=$(add_alpha_channel $5) | 17 | llight=$(add_alpha_channel $WM_LLIGHT) |
| 18 | accent=$(add_alpha_channel $6) | 18 | accent=$(add_alpha_channel $WM_ACCENT) |
| 19 | ldark=$(add_alpha_channel $7) | 19 | ldark=$(add_alpha_channel $WM_LDARK) |
| 20 | dark=$(add_alpha_channel $8) | 20 | dark=$(add_alpha_channel $WM_DARK) |
| 21 | 21 | ||
| 22 | font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" | 22 | font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" |
| 23 | #font="" | 23 | #font="" |
| @@ -36,6 +36,7 @@ fi | |||
| 36 | x=$(echo "${geometry[0]} + $padding" | bc) | 36 | x=$(echo "${geometry[0]} + $padding" | bc) |
| 37 | y=$(echo "${geometry[1]} + $padding" | bc) | 37 | y=$(echo "${geometry[1]} + $padding" | bc) |
| 38 | panel_width=$(echo "${geometry[2]} - (2 * $padding)" | bc) | 38 | panel_width=$(echo "${geometry[2]} - (2 * $padding)" | bc) |
| 39 | bar_opts="-g ${panel_width}x${panel_height}+${x}+${y} -f ${font} -u 2 -B ${normal_bg} -F ${normal_txt}" | ||
| 39 | 40 | ||
| 40 | hc pad $monitor $(echo "$panel_height + $padding" | bc) | 41 | hc pad $monitor $(echo "$panel_height + $padding" | bc) |
| 41 | 42 | ||
| @@ -102,14 +103,14 @@ fi | |||
| 102 | 103 | ||
| 103 | # Battery | 104 | # Battery |
| 104 | if $(test -e /sys/class/power_supply/BAT1) ; then | 105 | if $(test -e /sys/class/power_supply/BAT1) ; then |
| 105 | charge=$(cat /sys/class/power_supply/BAT1/capacity) | 106 | bat_lvl=$(cat /sys/class/power_supply/BAT1/capacity) |
| 106 | if [ $charge -lt 15 ] ; then | 107 | if [ $bat_lvl -lt 15 ] ; then |
| 107 | bat_color=$accent | 108 | bat_color=$accent |
| 108 | else | 109 | else |
| 109 | bat_color=$normal_txt | 110 | bat_color=$normal_txt |
| 110 | fi | 111 | fi |
| 111 | state=$(cat /sys/class/power_supply/BAT1/status) | 112 | state=$(cat /sys/class/power_supply/BAT1/status) |
| 112 | echo -e "battery\t%{F$normal_txt}$state: %{F$bat_color}$charge%{F$normal_txt}%%%{F-}" | 113 | echo -e "battery\t%{F$normal_txt}$state: %{F$bat_color}$bat_lvl%{F$normal_txt}%%%{F-}" |
| 113 | else | 114 | else |
| 114 | echo -e "battery\toff" | 115 | echo -e "battery\toff" |
| 115 | fi | 116 | fi |
| @@ -201,20 +202,14 @@ fi | |||
| 201 | ;; | 202 | ;; |
| 202 | esac | 203 | esac |
| 203 | done | 204 | done |
| 204 | } 2> /dev/null | \ | 205 | } 2> /dev/null | bar $bar_opts | { |
| 205 | bar -g $panel_width\x$panel_height\+$x+$y \ | ||
| 206 | -f "$font" \ | ||
| 207 | -u 2 \ | ||
| 208 | -B "$normal_bg" \ | ||
| 209 | -F "$normal_txt" | \ | ||
| 210 | { | ||
| 211 | #Handle clickable areas | 206 | #Handle clickable areas |
| 212 | while read line; do | 207 | while read line; do |
| 213 | IFS=',' read -a c <<< $(echo $line) | 208 | IFS=',' read -a c <<< $(echo $line) |
| 214 | case "${c[0]}" in | 209 | case "${c[0]}" in |
| 215 | tag) | 210 | tag) |
| 216 | herbstclient use "${c[1]}" | 211 | herbstclient use "${c[1]}" |
| 217 | echo "herbstclient use \"${c[1]}\"" | 212 | echo "herbstclient use \"${c[1]}\"" |
| 218 | ;; | 213 | ;; |
| 219 | *) | 214 | *) |
| 220 | echo "${c[0]}: not valid command" | 215 | echo "${c[0]}: not valid command" |
