From ffac7062a84028277558fb0110b31b825e42dfa2 Mon Sep 17 00:00:00 2001 From: Tom van der Lee Date: Thu, 27 Aug 2015 12:37:05 +0200 Subject: Fixed indentation of hlwm code --- herbstluftwm/.config/herbstluftwm/panel.sh | 145 ++++++++++++--------- .../.config/herbstluftwm/panel_indicators.sh | 3 +- herbstluftwm/.config/herbstluftwm/theme | 1 - 3 files changed, 82 insertions(+), 67 deletions(-) (limited to 'herbstluftwm/.config') 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 @@ #!/bin/bash -dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd) hc() { - "${herbstclient_command[@]:-herbstclient}" "$@" ; + "${herbstclient_command[@]:-herbstclient}" "$@" } source "$dir/theme" @@ -11,16 +11,18 @@ source "$dir/panel_indicators.sh" monitor=${1:-0} -geometry=( $(herbstclient monitor_rect "$monitor") ) +geometry=($(herbstclient monitor_rect "$monitor")) if [ -z "$geometry" ] ;then echo "Invalid monitor $monitor" exit 1 fi -# geometry has the format W H X Y + +# Geometry has the format W H X Y x=$(echo "${geometry[0]} + $window_p" | bc) y=$(echo "${geometry[1]} + $window_p" | bc) + panel_width=$(echo "${geometry[2]} - (2 * $window_p)" | bc) -bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font,$font_sec -u 2 -B $acolor_bg -F $acolor_fg" +bar_opts="-g ${panel_width}x${panel_h}+${x}+${y} -f $font -f $icon_font -u 2 -B $acolor_bg -F $acolor_fg" hc pad $monitor $(echo "$panel_h + $window_p" | bc) @@ -28,13 +30,13 @@ if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then # mawk needs "-W interactive" to line-buffer stdout correctly # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504 uniq_linebuffered() { - awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" + awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@" } else # other awk versions (e.g. gawk) issue a warning with "-W interactive", so # we don't want to use it there. uniq_linebuffered() { - awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" + awk '$0 != l { print ; l=$0 ; fflush(); }' "$@" } fi @@ -43,29 +45,36 @@ fi # \t [...] # e.g. # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29 + while true ; do - music - volume - network - battery - clock + music & + volume & + network & + battery & + clock & sleep 1 || break done > >(uniq_linebuffered) & + childpid=$! hc --idle kill $childpid + } 2> /dev/null | { IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" + visible=true + date="" - volume="" - battery="" - net="" + volume="" + battery="" + net="" windowtitle="" + + separator="%{F$acolor_accent}|%{F-}" + while true ; do - separator="%{F$acolor_accent}|%{F-}" - # draw tags + for i in "${tags[@]}" ; do case ${i:0:1} in '#') @@ -86,15 +95,16 @@ fi esac echo -n "%{A:tag,${i:1}:} ${i:1} %{A}%{F-}%{U-u}%{B-}" done + echo -n "$separator%{F-}%{B-} " echo -n "${windowtitle//^/^^}" - #Right part of panel + # Right part of panel right="$music$volume$net$battery$date " echo -n "%{r}$right" - #DO NOT REMOVE THIS ECHO - echo + #DO NOT REMOVE THIS ECHO + echo # wait for next event IFS=$'\t' read -ra cmd || break @@ -103,38 +113,38 @@ fi #echo "resetting tags" >&2 IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)" ;; - music) - music="${cmd[@]:1}" - if [ $music == "off" ] ; then - music="" - else - music="$music $separator%{B-} " - fi - ;; - volume) - volume="${cmd[@]:1}" - if [ $volume == "off" ] ; then - volume="" - else - volume="$volume $separator%{B-} " - fi - ;; - net) - net="${cmd[@]:1}" - if [ $net = "off" ] ; then - net="" - else - net="$net $separator%{B-} " - fi - ;; - battery) - battery="${cmd[@]:1}" - if [ $battery == "off" ] ; then - battery="" - else - battery="$battery $separator%{B-} " - fi - ;; + music) + music="${cmd[@]:1}" + if [ $music == "off" ] ; then + music="" + else + music="$music $separator%{B-} " + fi + ;; + volume) + volume="${cmd[@]:1}" + if [ $volume == "off" ] ; then + volume="" + else + volume="$volume $separator%{B-} " + fi + ;; + net) + net="${cmd[@]:1}" + if [ $net = "off" ] ; then + net="" + else + net="$net $separator%{B-} " + fi + ;; + battery) + battery="${cmd[@]:1}" + if [ $battery == "off" ] ; then + battery="" + else + battery="$battery $separator%{B-} " + fi + ;; date) #echo "resetting date" >&2 date="${cmd[@]:1}" @@ -144,18 +154,23 @@ fi ;; esac done + } 2> /dev/null | lemonbar $bar_opts | { - #Handle clickable areas - while read line; do - IFS=',' read -a c <<< $(echo $line) - case "${c[0]}" in - tag) - herbstclient use "${c[1]}" - echo "herbstclient use \"${c[1]}\"" - ;; - *) - echo "${c[0]}: not valid command" - ;; - esac - done + + #Handle clickable areas + while read line; do + IFS=',' read -a c <<< $(echo $line) + case "${c[0]}" in + tag) + herbstclient use "${c[1]}" + echo "herbstclient use \"${c[1]}\"" + ;; + *) + echo "${c[0]}: not valid command" + ;; + esac + done + } + +# vim: set ts=4 sw=4 tw=80 et : diff --git a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh index e450337..a433e3a 100644 --- a/herbstluftwm/.config/herbstluftwm/panel_indicators.sh +++ b/herbstluftwm/.config/herbstluftwm/panel_indicators.sh @@ -1,6 +1,7 @@ #!/bin/bash +icon_font="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*" battery_icon=("\ue113" "\ue114" "\ue115" "\ue116" "\ue042") -network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "\ue0af") +network_icon=("\ue0f1" "\ue0f2" "\ue0f3" "%{T2}\ue0af%{T-}") music_icon="\ue05c" music() diff --git a/herbstluftwm/.config/herbstluftwm/theme b/herbstluftwm/.config/herbstluftwm/theme index 3192abb..d0e48da 100644 --- a/herbstluftwm/.config/herbstluftwm/theme +++ b/herbstluftwm/.config/herbstluftwm/theme @@ -22,7 +22,6 @@ window_p=20 # Panel panel_h=24 font="-*-fixed-medium-*-*-*-14-*-*-*-*-*-*-*" -font_sec="-*-stlarch-medium-*-*-*-10-*-*-*-*-*-*-*" # Colors color_fg=$(get_x_color 15) -- cgit v1.2.3