polybar: Add weather script

Added script to show the forecast weather for the immediate future /
right now in polybar.
This commit is contained in:
Marty Oehme 2020-09-07 22:01:30 +02:00
parent 18cd15222d
commit 5d265a33f7
No known key found for this signature in database
GPG key ID: 0CCB0526EFB9611A
2 changed files with 35 additions and 1 deletions

View file

@ -59,7 +59,7 @@ module-margin-left = 2
modules-left = workspaces sxhkdmode pomo
modules-center = music date papersdue
modules-right = networkspeed archupdates cpu temp backlight volume battery
modules-right = networkspeed weather archupdates cpu temp backlight volume battery
; do not use offsets for the bar, would only work with override-redirect
; and will mess up tray https://github.com/polybar/polybar/issues/1355
tray-position = right
@ -248,6 +248,17 @@ click-left = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p1
click-right = exist rofi-bib-due normal "opening due papers" && rofi-bib-due -p3 -u $(date --date='fri this week' +%Y-%m-%d)
format-prefix = " "
interval = 120
format-underline = ${colors.primary}
[module/weather]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-weather '?format=%t+%C+(%p)'
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-weather
interval = 60.0
format-padding = 5
; format-background = ${colors.primary}
; format-foreground = ${colors.background}
format-underline = ${colors.primary}
; displays a small pomodoro timer
[module/pomo]

View file

@ -0,0 +1,23 @@
#!/usr/bin/env sh
wttr() {
# change Paris to your default location
request="wttr.in/${1-~Leipzig}"
curl -s -H "Accept-Language: ${LANG%_*}" --compressed "$request"
}
wttr "$@"
# while true; do
# all="$(bib-due -u 'fri this week' -p3 | wc -l)"
# required="$(bib-due -u 'fri this week' -p1 | wc -l)"
# # add polybar formatting to color required readings red
# # https://github.com/polybar/polybar/wiki/Formatting#format-tags
# # TODO use xresources
# colorreq=$(xrdb -query | grep -e '\*color1:' | cut -f2)
# colorall=$(xrdb -query | grep -e '\*foreground:' | cut -f2)
# printf "%s%s%s(%s)\n" "%{F${colorall:-#000}}" "$all" "%{F${colorreq:-#d00}}" "$required"
# sleep 120
# done