statusbar: unified sections belonging together

master
tiyn 10 months ago
parent f862b777ec
commit 563b3bc5c6

@ -2,7 +2,7 @@
wifipercent=" 0"
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="^c#ff0000^ ^d^" && wifistatus="down"
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="^c#ff0000^ " && wifistatus="down"
[ ! -n "${wifiicon+var}" ] && wifistatus="up" && wifipercent=$(grep "^\s*w" /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
@ -12,14 +12,14 @@ if [ $wifistatus = "up" ]
then
if [ $wifipercent -gt 75 ]
then
wifiicon="^b#282828^^c#dfdfdf^  ^d^"
wifiicon=" ^d^"
elif [ $wifipercent -gt 40 ]
then
wifiicon="^b#282828^^c#ffff00^  ^d^"
wifiicon=" ^d^"
else
wifiicon="^b#282828^^c#ff0000^  ^d^"
wifiicon=" ^d^"
fi
fi
echo "$(cat /sys/class/net/e*/operstate | sed "s/down/^b#282828^^c#ff0000^  ^d^/;s/up/^b#282828^^c#dfdfdf^ 󰈀 ^d^/")" "$wifiicon"
echo "$(cat /sys/class/net/e*/operstate | sed "s/down/^b#282828^^c#ff0000^  /;s/up/^b#282828^^c#dfdfdf^ 󰈀 /")" "$wifiicon"

@ -8,21 +8,21 @@ shuffle=$(playerctl shuffle)
if [ "$loop" = "Playlist" ]
then
loop_icon="^b#282828^^c#dfdfdf^ ^d^"
loop_icon=""
elif [ "$loop" = "Track" ]
then
loop_icon="^b#282828^^c#dfdfdf^ ^d^"
loop_icon=""
elif [ "$loop" = "None" ]
then
loop_icon="^b#282828^^c#dfdfdf^ ^d^"
loop_icon=""
fi
if [ "$shuffle" = "Off" ]
then
shuffle_icon="^b#282828^^c#dfdfdf^ ^d^"
shuffle_icon=""
elif [ "$shuffle" = "On" ]
then
shuffle_icon="^b#282828^^c#dfdfdf^ ^d^"
shuffle_icon=""
fi
@ -31,8 +31,8 @@ then
echo ""
elif [ "$playerctlstatus" = "Playing" ]
then
echo "$track ^b#282828^^c#dfdfdf^ ▶️ ^d^ $loop_icon $shuffle_icon"
echo "$track ^b#282828^^c#dfdfdf^ ▶️ $loop_icon $shuffle_icon ^d^"
elif [ "$playerctlstatus" = "Paused" ]
then
echo "^b#282828^^c#dfdfdf^  ^d^ $loop_icon $shuffle_icon"
echo "^b#282828^^c#dfdfdf^  $loop_icon $shuffle_icon ^d^"
fi

@ -3,20 +3,20 @@
vol="$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2}' | sed -e 's/\.//g' | sed 's/^0*//')"
if [ "$vol" -eq "0" ]; then
vol_info="^b#282828^^c#dfdfdf^  ^d^"
vol_info="^c#dfdfdf^  "
elif [ "$vol" -gt "70" ]; then
vol_info="^b#282828^^c#dfdfdf^  ^d^"
vol_info="^c#dfdfdf^  "
else
vol_info="^b#282828^^c#dfdfdf^  ^d^"
vol_info="^c#dfdfdf^  "
fi
$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q '\[MUTED\]') && vol_info="^c#ff0000^ ^d^"
$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | grep -q '\[MUTED\]') && vol_info="^c#ff0000^ "
if wpctl get-volume @DEFAULT_SOURCE@ | grep -q '\[MUTED\]'; then
mic="^b#282828^^c#ff0000^  ^d^"
mic="^c#ff0000^  "
else
mic="^b#282828^^c#dfdfdf^  ^d^"
mic="^c#dfdfdf^  "
fi
vol=$(printf %3s $vol | tr ' ' ' ')
printf "%s %s %s %s\\n" "$mic" "$vol_info" "$vol%"
printf "^b#282828^%s%s^d^ %s %s" "$mic" "$vol_info" "$vol%"

Loading…
Cancel
Save