sh: Add internet-check base script

Added script to sh base package to allow checking for internet
connectivity. Checks both through system virtual filesystem and, as a
fallback, through pinging google dns.

Added a simple readme to sh module.
This commit is contained in:
Marty Oehme 2021-09-24 11:15:08 +02:00
parent 658e07e1b8
commit 3bf5becbe2
Signed by: Marty
GPG key ID: B7538B8F50A1C800
3 changed files with 48 additions and 4 deletions

View file

@ -269,7 +269,7 @@ format-underline = ${colors.primary}
[module/mail]
type = custom/script
exec = echo "$( [ $(systemctl --user --property=ActiveState show mbsync.timer) = 'ActiveState=active' ] && echo "" || echo "" ) $(notmuch count tag:inbox and tag:unread)"
exec-if = [ "$(notmuch count tag:inbox and tag:unread)" -gt 0 ]
exec-if = check-internet && [ "$(notmuch count tag:inbox and tag:unread)" -gt 0 ]
click-right = systemctl --user start mbsync.timer
click-left = systemctl --user stop mbsync.timer
interval = 300.0
@ -278,7 +278,7 @@ format-underline = ${colors.primary}
[module/weather]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-weather 'Copenhagen?m&format=%t+%C+(%p)'
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-weather
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-weather && check-internet
interval = 60.0
; format-background = ${colors.primary}
; format-foreground = ${colors.background}
@ -301,7 +301,7 @@ tail = true
[module/archupdates]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-archupdates
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-archupdates
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-archupdates && check-internet
interval = 600
format = <label>
format-prefix = " "
@ -311,7 +311,7 @@ format-underline = ${colors.primary}
[module/networkspeed]
type = custom/script
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-networkspeed
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-networkspeed
exec-if = type $XDG_CONFIG_HOME/polybar/scripts/poly-networkspeed && check-internet
tail = true
format-underline = ${colors.primary}