diff --git a/i3pystatus/updates/__init__.py b/i3pystatus/updates/__init__.py index 12da10f..157015f 100644 --- a/i3pystatus/updates/__init__.py +++ b/i3pystatus/updates/__init__.py @@ -1,4 +1,5 @@ from i3pystatus import SettingsBase, IntervalModule, formatp +from i3pystatus.core.util import internet class Backend(SettingsBase): @@ -41,8 +42,10 @@ class Updates(IntervalModule): settings = ( ("backends", "Required list of backends used to check for updates."), - ("format", "String shown when updates are availible. May contain formatters."), - ("format_no_updates", "String that is shown if no updates are available. If not set the module will be hidden if no updates are available."), + ("format", "String shown when updates are availible. " + "May contain formatters."), + ("format_no_updates", "String that is shown if no updates are available." + " If not set the module will be hidden if no updates are available."), "color", "color_no_updates", ("interval", "Default interval is set to one hour."), @@ -63,6 +66,10 @@ class Updates(IntervalModule): return def run(self): + if not internet(): + self.logger.info("Updates: No internet connection.") + return + updates_count = 0 for backend in self.backends: updates_count += backend.updates