diff --git a/.config/xmobar/ens_brief.sh b/.config/xmobar/ens_brief.sh new file mode 100755 index 0000000..e3415f2 --- /dev/null +++ b/.config/xmobar/ens_brief.sh @@ -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" diff --git a/.config/xmobar/pactl_volume.sh b/.config/xmobar/pactl_volume.sh new file mode 100755 index 0000000..1ff41bf --- /dev/null +++ b/.config/xmobar/pactl_volume.sh @@ -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 diff --git a/.config/xmobar/xmobarrc_hdmi b/.config/xmobar/xmobarrc_hdmi index 458d9d0..e63ddd0 100644 --- a/.config/xmobar/xmobarrc_hdmi +++ b/.config/xmobar/xmobarrc_hdmi @@ -9,7 +9,7 @@ Config { overrideRedirect = True , allDesktops = True , pickBroadest = True , commands = [ Run Weather "LZIB" - [ "--template", "\xe302 : °C" + [ "--template", "\xf2c9 °C" , "-L", "5" , "-H", "25" , "--low" , "#8be9fd" @@ -50,9 +50,10 @@ Config { overrideRedirect = True [ "--template" , "\xf017 Uptime: d h 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% { %LZIB% · %ens_brief% | %pactl_volume% | %date% " } diff --git a/.config/xmobar/xmobarrc_laptop b/.config/xmobar/xmobarrc_laptop index da50b18..0325d95 100644 --- a/.config/xmobar/xmobarrc_laptop +++ b/.config/xmobar/xmobarrc_laptop @@ -9,7 +9,7 @@ Config { overrideRedirect = True , allDesktops = True , pickBroadest = True , commands = [ Run Weather "LZIB" - [ "--template", "\xe302 : °C" + [ "--template", "\xf2c9 °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% { %LZIB% · %ens_brief% | %pactl_volume% | %date% %_XMONAD_TRAYPAD% " }