expand tab
This commit is contained in:
parent
e0a2aa986f
commit
a0a71cdcec
1 changed files with 76 additions and 76 deletions
|
@ -30,102 +30,102 @@ monitors=( )
|
|||
i=0
|
||||
while read -r _ resolution
|
||||
do
|
||||
monitors[$i]="$(herbstclient list_monitors | grep "$resolution" | cut -d":" -f1)"
|
||||
i=$((i+1))
|
||||
monitors[$i]="$(herbstclient list_monitors | grep "$resolution" | cut -d":" -f1)"
|
||||
i=$((i+1))
|
||||
done < <(xrandr| awk '/ connected/ { FS=" " ; $0=$0 ; if ($3 == "primary") { res=$4 } else {res=$3} ; FS="+" ; $0=$0 ; print $2" "res }' | sort -n)
|
||||
|
||||
first_loop=1
|
||||
|
||||
notify() {
|
||||
if [[ "$first_loop" != 1 ]]
|
||||
then
|
||||
#twmnc "$@"
|
||||
notify-send "$@"
|
||||
fi
|
||||
if [[ "$first_loop" != 1 ]]
|
||||
then
|
||||
#twmnc "$@"
|
||||
notify-send "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
# so it bootstraps...
|
||||
( sleep 0.5; hc emit_hook volume ) &
|
||||
|
||||
hc --idle | {
|
||||
for monitor in "${monitors[@]}" ; do
|
||||
tags[$monitor]="$(hc tag_status "$monitor")"
|
||||
done
|
||||
date="%{T2}%{T-} $(date '+%{F#efefef}%H:%M%{F#909090}, %Y-%m-%{F#efefef}%d')"
|
||||
for monitor in "${monitors[@]}" ; do
|
||||
tags[$monitor]="$(hc tag_status "$monitor")"
|
||||
done
|
||||
date="%{T2}%{T-} $(date '+%{F#efefef}%H:%M%{F#909090}, %Y-%m-%{F#efefef}%d')"
|
||||
windowtitle=""
|
||||
#count-mails;
|
||||
#charge=$(battery | awk '{print $2}')
|
||||
#count-mails;
|
||||
#charge=$(battery | awk '{print $2}')
|
||||
while true ; do
|
||||
|
||||
### prepare by monitor tags displaying
|
||||
for monitor in "${monitors[@]}" ; do
|
||||
output_tags[$monitor]="%{A4:herbstclient use_index +1 --skip-visible:}%{A5:herbstclient use_index -1 --skip-visible:}"
|
||||
for i in ${tags[$monitor]} ; do
|
||||
case ${i:0:1} in
|
||||
'#'|'+')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{F$col_fg_pri_sel}%{B$col_bg_pri_sel}"
|
||||
;;
|
||||
#'+')
|
||||
#output_tags[$monitor]="${output_tags[$monitor]}%{B#3c7693}%{F#141414}"
|
||||
#;;
|
||||
':')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B-}%{F-}"
|
||||
;;
|
||||
'!')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B${col_bg_urg}}%{F-}"
|
||||
;;
|
||||
'-'|'%')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B${col_bg_sec_sel}%{F${col_fg_sec_sel}}"
|
||||
;;
|
||||
*)
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B-}%{F${col_fg_sec}}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# output_tags[$monitor]="${output_tags[$monitor]}%{A:herbstclient use_index $((${i:1} - 1 )):} ${i:1} %{A}"
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{A1:herbstclient use ${i:1}:} ${i:1} %{A}%{B-}%{F-}"
|
||||
done
|
||||
### prepare by monitor tags displaying
|
||||
for monitor in "${monitors[@]}" ; do
|
||||
output_tags[$monitor]="%{A4:herbstclient use_index +1 --skip-visible:}%{A5:herbstclient use_index -1 --skip-visible:}"
|
||||
for i in ${tags[$monitor]} ; do
|
||||
case ${i:0:1} in
|
||||
'#'|'+')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{F$col_fg_pri_sel}%{B$col_bg_pri_sel}"
|
||||
;;
|
||||
#'+')
|
||||
#output_tags[$monitor]="${output_tags[$monitor]}%{B#3c7693}%{F#141414}"
|
||||
#;;
|
||||
':')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B-}%{F-}"
|
||||
;;
|
||||
'!')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B${col_bg_urg}}%{F-}"
|
||||
;;
|
||||
'-'|'%')
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B${col_bg_sec_sel}%{F${col_fg_sec_sel}}"
|
||||
;;
|
||||
*)
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{B-}%{F${col_fg_sec}}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# output_tags[$monitor]="${output_tags[$monitor]}%{A:herbstclient use_index $((${i:1} - 1 )):} ${i:1} %{A}"
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{A1:herbstclient use ${i:1}:} ${i:1} %{A}%{B-}%{F-}"
|
||||
done
|
||||
output_tags[$monitor]="${output_tags[$monitor]}%{A}%{A}"
|
||||
done
|
||||
done
|
||||
|
||||
#bordercolor="#26221C"
|
||||
separator="%{B-}%{F-}|"
|
||||
#separator="%{B$selbg} %{B-}%{F-}"
|
||||
#right=
|
||||
#for st in playing volume wifi temperature load date
|
||||
#do
|
||||
#data="$(eval $st)"
|
||||
#[[ -n "$data" ]] && right="$right $separator $data"
|
||||
#done
|
||||
|
||||
### All drawing happens here
|
||||
# echo -n "%{T5}" # set font
|
||||
#bordercolor="#26221C"
|
||||
separator="%{B-}%{F-}|"
|
||||
#separator="%{B$selbg} %{B-}%{F-}"
|
||||
#right=
|
||||
#for st in playing volume wifi temperature load date
|
||||
#do
|
||||
#data="$(eval $st)"
|
||||
#[[ -n "$data" ]] && right="$right $separator $data"
|
||||
#done
|
||||
|
||||
### All drawing happens here
|
||||
# echo -n "%{T5}" # set font
|
||||
res=
|
||||
for m in "${!monitors[@]}" ; do
|
||||
monitor=${monitors[$m]}
|
||||
for m in "${!monitors[@]}" ; do
|
||||
monitor=${monitors[$m]}
|
||||
|
||||
### set monitor
|
||||
res+="%{S$m}"
|
||||
#echo -en "%{S$((${#monitors[@]} - monitor))}"
|
||||
### print the left
|
||||
res+="%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}"
|
||||
### center
|
||||
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
|
||||
### print the right
|
||||
res+="%{r}$playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
done
|
||||
### set monitor
|
||||
res+="%{S$m}"
|
||||
#echo -en "%{S$((${#monitors[@]} - monitor))}"
|
||||
### print the left
|
||||
res+="%{l}${output_tags[$monitor]}$separator ${windowtitle:0:150}"
|
||||
### center
|
||||
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
|
||||
### print the right
|
||||
res+="%{r}$playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
done
|
||||
|
||||
### end the output
|
||||
echo -e "$res"
|
||||
### end the output
|
||||
echo -e "$res"
|
||||
|
||||
### Data handling ###
|
||||
# This part handles the events generated in the event loop, and sets
|
||||
# internal variables based on them. The event and its arguments are
|
||||
# read into the array cmd, then action is taken depending on the event
|
||||
# name.
|
||||
# "Special" events (quit_panel/togglehidepanel/reload) are also handled
|
||||
# here.
|
||||
### Data handling ###
|
||||
# This part handles the events generated in the event loop, and sets
|
||||
# internal variables based on them. The event and its arguments are
|
||||
# read into the array cmd, then action is taken depending on the event
|
||||
# name.
|
||||
# "Special" events (quit_panel/togglehidepanel/reload) are also handled
|
||||
# here.
|
||||
|
||||
# wait for next event
|
||||
IFS=$'\t' read -ra cmd || break
|
||||
|
|
Loading…
Add table
Reference in a new issue