summaryrefslogtreecommitdiff
path: root/herbstluftwm/panel.sh
diff options
context:
space:
mode:
Diffstat (limited to 'herbstluftwm/panel.sh')
-rwxr-xr-xherbstluftwm/panel.sh49
1 files changed, 35 insertions, 14 deletions
diff --git a/herbstluftwm/panel.sh b/herbstluftwm/panel.sh
index b17eb6d..ad7efbe 100755
--- a/herbstluftwm/panel.sh
+++ b/herbstluftwm/panel.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+source ${HOME}/.config/herbstluftwm/fn.sh
+
hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )
@@ -12,12 +14,25 @@ x=${geometry[0]}
y=${geometry[1]}
panel_width=${geometry[2]}
panel_height=16
-#font="-Misc-Termsyn.Icons-Medium-R-Normal--11-79-100-100-C-60-ISO8859-1"
#font="-*-envy code r-*-*-*-*-11-*-*-*-*-*-*-*"
-font="-*-fira mono-*-*-*-*-10-*-*-*-*-*-*-*"
-bgcolor=$(hc get frame_border_normal_color)
-selbg=$(hc get window_border_active_color)
-selfg='#efefef'
+xfont=$(get_xresources font)
+echo "${xfont}" > log
+escaped="${xfont//[a-z 0-9\*-]/}"
+if [[ ${#escaped} -gt 0 ]]
+then
+ font="-Misc-Termsyn.Icons-Medium-R-Normal--11-79-100-100-C-60-ISO8859-1"
+else
+ font="${xfont}"
+
+ if [[ "${xfont}" =~ fixed ]]
+ then
+ font="${xfont/13/12}"
+ fi
+fi
+bgcolor=$(get_xresources background)
+fgcolor=$(get_xresources foreground)
+selbg=$(get_xresources color12)
+selfg=$(get_xresources background)
popups="/home/matias/.config/herbstluftwm/popups.sh"
####
@@ -74,7 +89,7 @@ hc pad $monitor $panel_height
while true ; do
# "date" output is checked once a second, but an event is only
# generated if the output changed compared to the previous run.
- date +$'date\t^fg(#efefef)%H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'
+ date +$'date\t^fg('"$fgcolor"')%H:%M^fg(#707070), %Y-%m-^fg('"$fgcolor"')%d'
sleep 3 || break
done > >(uniq_linebuffered) &
childpid=$!
@@ -106,19 +121,24 @@ hc pad $monitor $panel_height
for i in "${tags[@]}" ; do
case ${i:0:1} in
'#')
+ # Current tag
echo -n "^bg($selbg)^fg($selfg)"
;;
'+')
+ # Dunno
echo -n "^bg(#9CA668)^fg(#141414)"
;;
':')
- echo -n "^bg()^fg(#ffffff)"
+ # with something
+ echo -n "^bg()^fg($fgcolor)"
;;
'!')
+ # urgent
echo -n "^bg(#FF0675)^fg(#141414)"
;;
*)
- echo -n "^bg()^fg(#ababab)"
+ # Empty
+ echo -n "^bg()^fg(#797979)"
;;
esac
if [ ! -z "$dzen2_svn" ] ; then
@@ -139,22 +159,23 @@ hc pad $monitor $panel_height
if [ "$battery" = "/" ] ;then
right="$separator^bg($hintcolor) $date $separator"
else
- right="^bg($hintcolor) ^fg(#efefef)$song $separator "
+ right="^bg($hintcolor) ^fg($fgcolor)$song $separator "
if [[ $battery -lt 20 ]]
then
- right="$right^fg(#ef7f7f)$battery%% $separator $date"
+ right="$right^fg($(get_xresources color1))$battery%% $separator $date"
elif [[ $battery -lt 50 ]]
then
- right="$right^fg(#e1e17f)$battery%% $separator $date"
+ right="$right^fg($(get_xresources color3))$battery%% $separator $date"
else
- right="$right^fg(#efefef)$battery%% $separator $date"
+ right="$right^fg($fgcolor)$battery%% $separator $date"
fi
fi
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
# get width of right aligned text.. and add some space..
width=$($textwidth "$font" "$right_text_only ")
- echo -n "^pa($(($panel_width - $width + 4)))$(printf "$right")"
+ echo "panel width: $panel_width and widht $width for '$font' and '$right_text_only'" >> log
+ echo -n "^pa($(($panel_width - $width + 175)))$(printf "$right")"
echo
### Data handling ###
@@ -220,4 +241,4 @@ hc pad $monitor $panel_height
} 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
-e 'button3=;button4=exec:herbstclient use_index -1;button5=exec:herbstclient use_index +1' \
- -ta l -bg "$bgcolor" -fg '#efefef'
+ -ta l -bg "$bgcolor" -fg "$fgcolor"