From 3bf5becbe24dfe2e1e130ab245b8f4037b5f87ff Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Fri, 24 Sep 2021 11:15:08 +0200 Subject: [PATCH] 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. --- polybar/.config/polybar/config | 8 ++++---- sh/.local/bin/check-internet | 24 ++++++++++++++++++++++++ sh/README.md | 20 ++++++++++++++++++++ 3 files changed, 48 insertions(+), 4 deletions(-) create mode 100755 sh/.local/bin/check-internet create mode 100644 sh/README.md diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config index b39d42e..76232eb 100644 --- a/polybar/.config/polybar/config +++ b/polybar/.config/polybar/config @@ -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 =