Slightly different color for statusbar item's icon.

This commit is contained in:
Bartek Stalewski 2022-04-15 00:44:28 +02:00
parent 826a05826d
commit 4ff14f25fd
6 changed files with 31 additions and 37 deletions

View File

@ -1,3 +1,3 @@
#!/bin/bash
[ $(pgrep -x emerge) ] && printf "^c#ffffff^^b#9a37ff^\ue20f emerge^d^" || printf ""
[ $(pgrep -x emerge) ] && printf "^c#ffffff^\ue20f ^c#ffffff^^b#9a37ff^emerge^d^" || printf ""

17
_suckless/_scripts/sb-vol-in Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
if [ "${1}" = "micmute" ]; then
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
case ${state} in
yes)
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
no)
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
esac
kill -44 $(pidof dwmblocks)
else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && printf "^c#ffffff^\uf131 ^c#ffffff^^b#770000^mute^d^"
fi

4
_suckless/_scripts/sb-vol-out Executable file
View File

@ -0,0 +1,4 @@
#!/bin/bash
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && printf "^c#ffffff^\ufa80 ^c#ffffff^^b#770000^mute^d^" || printf "^c#ffffff^\uf028 ^d^${vol}%%"

View File

@ -1,28 +0,0 @@
#!/bin/bash
if [ "${1}" = "micmute" ]; then
state=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
case ${state} in
yes)
echo 0 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 0 ;;
no)
echo 1 | doas tee /sys/devices/platform/thinkpad_acpi/leds/platform::micmute/brightness
pactl set-source-mute @DEFAULT_SOURCE@ 1 ;;
esac
kill -46 $(pidof dwmblocks)
else
mic=$(pactl get-source-volume @DEFAULT_SOURCE@ | awk -F' / ' '{print $2}' | tr -d '%')
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | awk -F' / ' '{print $2}' | tr -d '%')
micmute=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}')
volmute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}')
if [ "$micmute" = yes ] && [ "$volmute" = yes ]; then
printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^"
elif [ "$mic" -eq 0 ] && [ "$vol" -eq 0 ]; then
printf "^c#ffffff^^b#770000^\uf131 mute | \ufa80 mute^d^"
else
[ $(pactl get-source-mute @DEFAULT_SOURCE@ | awk -F': ' '{print $2}') = yes ] || [ "$mic" -eq 0 ] && micinfo="^c#ffffff^^b#770000^\uf131 mute^d^ | " || micinfo=""
[ $(pactl get-sink-mute @DEFAULT_SINK@ | awk -F': ' '{print $2}') = yes ] || [ "$vol" -eq 0 ] && volinfo="^c#ffffff^^b#770000^\ufa80 mute^d^" || volinfo="\uf028 ${vol}%%"
printf "${micinfo}${volinfo}"
fi
fi

View File

@ -140,7 +140,7 @@ static Key keys[] = {
{ SHTKEY, XK_comma, tagmon, {.i = -1 } },
{ SHTKEY, XK_period, tagmon, {.i = +1 } },
{ 0, XF86XK_AudioMute, spawn, SHCMD("pactl set-sink-mute @DEFAULT_SINK@ toggle; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sb-volume micmute") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sb-vol-in micmute") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ +5%; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pactl set-sink-volume @DEFAULT_SINK@ -5%; kill -46 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 10") },

View File

@ -1,12 +1,13 @@
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = {
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{"", "sb-emerge", 1, 0 },
{"", "sb-mail", 60, 16 },
{"", "sb-volume", 0, 12 },
{"\uf241 ", "sb-battery", 3, 0 },
{"\uf1eb ", "sb-network", 1, 0 },
{"\uf073 ", "date '+[%e] %I:%M:%S %p |'", 1, 0 },
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{"", "sb-emerge", 1, 0 },
{"", "sb-mail", 60, 16 },
{"", "sb-vol-in", 0, 10 },
{"", "sb-vol-out", 0, 12 },
{"^c#ffffff^\uf241 ^d^", "sb-battery", 3, 0 },
{"^c#ffffff^\uf1eb ^d^", "sb-network", 1, 0 },
{"^c#ffffff^\uf073 ^d^", "date '+[%e] %I:%M:%S %p |'", 1, 0 },
};
//sets delimeter between status commands. NULL character ('\0') means no delimeter.