Add ens-forecast to xmobar

This commit is contained in:
Daniele Fucini
2026-10-10 09:18:57 +02:00
parent 493d555983
commit a7f19fe2a7
4 changed files with 43 additions and 4 deletions
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# Next day from ens-forecast for xmobar, e.g. "Sat 19/10° 39%" (today before 18:00, then tomorrow)
# With "week": show the next 7 days in a notification (for a click on the bar)
if [ "$1" = "week" ]; then
if ! line=$(ens-forecast --brief 7 2>&1); then
notify-send "ens-forecast" "$line"
exit
fi
body=""
while IFS= read -r part; do
read -r day temps rain extra <<< "$part"
temps=${temps%°C}
body+="$day ${temps%/*}° / ${temps#*/}° rain $rain${extra:+ $extra}"$'\n'
done <<< "$(sed "s/ | /\n/g" <<< "${line#*: }")"
notify-send "${line%%: *}" "${body%$'\n'}"
exit
fi
line=$(ens-forecast --brief 1 2>/dev/null) || exit 0
read -r day temps rain <<< "${line#*: }"
echo "$day ${temps%C} "$'\uf043'" $rain"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
sink=$(pactl get-default-sink)
muted=$(pactl get-sink-mute "$sink" | cut -d' ' -f2)
if [ "$muted" = "yes" ]; then
echo " 0%"
else
case "$sink" in
bluez_output.*) icon="" ;;
*) icon="" ;;
esac
echo "$icon $(pactl get-sink-volume "$sink" | grep Volume | cut -d/ -f2 | xargs)"
fi
+3 -2
View File
@@ -9,7 +9,7 @@ Config { overrideRedirect = True
, allDesktops = True
, pickBroadest = True
, commands = [ Run Weather "LZIB"
[ "--template", "\xe302 <station>: <tempC>°C"
[ "--template", "\xf2c9 <tempC>°C"
, "-L", "5"
, "-H", "25"
, "--low" , "#8be9fd"
@@ -50,9 +50,10 @@ Config { overrideRedirect = True
[ "--template" , "\xf017 Uptime: <days>d <hours>h <minutes>m"
] 600
, Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10
, Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000
, Run XMonadLog
]
, sepChar = "%"
, alignSep = "}{"
, template = "  | %XMonadLog% } %uptime% | %multicpu%, %coretemp% | %memory% |  %kbd% { %LZIB% | %pactl_volume% | %date% "
, template = "  | %XMonadLog% } %uptime% | %multicpu%, %coretemp% | %memory% |  %kbd% { <action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% "
}
+3 -2
View File
@@ -9,7 +9,7 @@ Config { overrideRedirect = True
, allDesktops = True
, pickBroadest = True
, commands = [ Run Weather "LZIB"
[ "--template", "\xe302 <station>: <tempC>°C"
[ "--template", "\xf2c9 <tempC>°C"
, "-L", "5"
, "-H", "25"
, "--low" , "#8be9fd"
@@ -51,9 +51,10 @@ Config { overrideRedirect = True
] 600
, Run XPropertyLog "_XMONAD_TRAYPAD"
, Run Com "/home/fuxino/.config/xmobar/pactl_volume.sh" [] "pactl_volume" 10
, Run Com "/home/fuxino/.config/xmobar/ens_brief.sh" [] "ens_brief" 18000
, Run XMonadLog
]
, sepChar = "%"
, alignSep = "}{"
, template = "  | %XMonadLog% } %uptime% | %multicpu%, %coretemp% | %memory% |  %kbd% { %LZIB% | %pactl_volume% | %date% %_XMONAD_TRAYPAD% "
, template = "  | %XMonadLog% } %uptime% | %multicpu%, %coretemp% | %memory% |  %kbd% { <action=`/home/fuxino/.config/xmobar/ens_brief.sh week`>%LZIB% <fc=#565f89>·</fc> %ens_brief%</action> | %pactl_volume% | %date% %_XMONAD_TRAYPAD% "
}