new statusbar

This commit is contained in:
Your Name 2025-10-06 13:09:40 -06:00
parent d83cba2530
commit a2469aedaf
3 changed files with 107 additions and 7 deletions

View File

@ -7,7 +7,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "monospace:size=18", "Noto Color Emoji:size=18" };
static const char *fonts[] = { "monospace:size=18", "Symbola:size=18" };
static const char dmenufont[] = "monospace:size=22";
static const char col_gray1[] = "#222222";
static const char col_gray2[] = "#444444";
@ -100,12 +100,12 @@ static const Key keys[] = {
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_x, quit, {0} },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --decrease 5; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer --toggle-mute; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --increase 5; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_MonBrightnessDown,spawn, SHCMD("brightnessctl set 10%-; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sh /usr/local/scripts/mutemic.sh; kill -44 $(pidof dwmblocks)") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("pamixer --decrease 5; /usr/local/scripts/xsetsingle.sh") },
{ 0, XF86XK_AudioMute, spawn, SHCMD("pamixer --toggle-mute; /usr/local/scripts/xsetsingle.sh") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("pamixer --increase 5; /usr/local/scripts/xsetsingle.sh") },
{ 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl set 10%+; /usr/local/scripts/xsetsingle.sh") },
{ 0, XF86XK_MonBrightnessDown,spawn, SHCMD("brightnessctl set 10%-; /usr/local/scripts/xsetsingle.sh") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("sh /usr/local/scripts/mutemic.sh; /usr/local/scripts/xsetsingle.sh") },
{ 0, PrintScreenDWM, spawn, SHCMD("flameshot gui") },
{ 0, XF86XK_AudioPlay, spawn, SHCMD("playerctl play-pause") },
};

52
xsetroot.sh Executable file
View File

@ -0,0 +1,52 @@
while true; do
micstat=$(pamixer --default-source --get-mute)
[[ $micstat = "false" ]] && micstat="✔️"
[[ $micstat = "true" ]] && micstat="🚫"
vol="$(pamixer --get-volume)%"
if [ "$vol" -gt "70" ]; then
volicon="🔊"
elif [ "$vol" -lt "30" ]; then
volicon="🔈"
else
volicon="🔉"
fi
[[ "$vol" = 0 || "$vol" = "" || $(pamixer --get-mute) = "true" ]] && volicon="🔇" && vol=""
for battery in /sys/class/power_supply/BAT?
do
# Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/|⚡/" "$battery"/status)
# If it is discharging and 25% or less, we will add a ❗ as a warning.
[ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗"
batmsg=$(printf "%s%s%s%s%%" "$status" "$warn" "$capacity")
unset warn
done
clock=$(date '+%I')
case "$clock" in
"00") icon="🕛" ;;
"01") icon="🕐" ;;
"02") icon="🕑" ;;
"03") icon="🕒" ;;
"04") icon="🕓" ;;
"05") icon="🕔" ;;
"06") icon="🕕" ;;
"07") icon="🕖" ;;
"08") icon="🕗" ;;
"09") icon="🕘" ;;
"10") icon="🕙" ;;
"11") icon="🕚" ;;
"12") icon="🕛" ;;
esac
xsetroot -name " 🔆 $(brightnessctl get -P) / $volicon$vol / $micstat🎤 / $(free --mega | sed -n '2{p;q}' | awk '{printf ("%2.2fGB/%2.2fGB\n", ( $3 / 1000), ($2 / 1000))}') / $batmsg / $(date '+%a %d %b %Y') $icon $(date '+%R %p')"
sleep 1
done

48
xsetsingle.sh Executable file
View File

@ -0,0 +1,48 @@
micstat=$(pamixer --default-source --get-mute)
[[ $micstat = "false" ]] && micstat="✔️"
[[ $micstat = "true" ]] && micstat="🚫"
vol="$(pamixer --get-volume)%"
if [ "$vol" -gt "70" ]; then
volicon="🔊"
elif [ "$vol" -lt "30" ]; then
volicon="🔈"
else
volicon="🔉"
fi
[[ "$vol" = 0 || "$vol" = "" || $(pamixer --get-mute) = "true" ]] && volicon="🔇" && vol=""
for battery in /sys/class/power_supply/BAT?
do
# Get its remaining capacity and charge status.
capacity=$(cat "$battery"/capacity 2>/dev/null) || break
status=$(sed "s/[Dd]ischarging/🔋/;s/[Nn]ot charging/🛑/;s/[Cc]harging/🔌/;s/[Uu]nknown/♻️/;s/[Ff]ull/|⚡/" "$battery"/status)
# If it is discharging and 25% or less, we will add a ❗ as a warning.
[ "$capacity" -le 25 ] && [ "$status" = "🔋" ] && warn="❗"
batmsg=$(printf "%s%s%s%s%%" "$status" "$warn" "$capacity")
unset warn
done
clock=$(date '+%I')
case "$clock" in
"00") icon="🕛" ;;
"01") icon="🕐" ;;
"02") icon="🕑" ;;
"03") icon="🕒" ;;
"04") icon="🕓" ;;
"05") icon="🕔" ;;
"06") icon="🕕" ;;
"07") icon="🕖" ;;
"08") icon="🕗" ;;
"09") icon="🕘" ;;
"10") icon="🕙" ;;
"11") icon="🕚" ;;
"12") icon="🕛" ;;
esac
xsetroot -name " 🔆 $(brightnessctl get -P) / $volicon$vol / $micstat🎤 / $(free --mega | sed -n '2{p;q}' | awk '{printf ("%2.2fGB/%2.2fGB\n", ( $3 / 1000), ($2 / 1000))}') / $batmsg / $(date '+%a %d %b %Y') $icon $(date '+%R %p')"