Start idle time monitor only if xprintidle is available

This commit is contained in:
Gobinath 2017-04-19 14:04:16 -04:00
parent 1286389658
commit 1298d69838
2 changed files with 7 additions and 1 deletions

View File

@ -67,6 +67,8 @@ class SafeEyesCore:
self.skip_break_window_classes = [x.lower() for x in config['active_window_class']['skip_break']]
self.take_break_window_classes = [x.lower() for x in config['active_window_class']['take_break']]
self.custom_exercises = config['custom_exercises']
# Enable idle time pause only if xprintidle is available
self.context['idle_pause_enabled'] = Utility.command_exist('xprintidle')
exercises = language['exercises']
for short_break_config in config['short_breaks']:
@ -120,7 +122,8 @@ class SafeEyesCore:
self.active = True
self.running = True
Utility.start_thread(self.__scheduler_job)
Utility.start_thread(self.__start_idle_monitor)
if self.context['idle_pause_enabled']:
Utility.start_thread(self.__start_idle_monitor)
"""

View File

@ -77,6 +77,9 @@ class SettingsDialog:
self.switch_audible_alert.set_active(config['audible_alert'])
self.spin_time_to_screen_lock.set_value(config['time_to_screen_lock'])
# Enable idle_time_to_pause only if xprintidle is available
self.spin_idle_time_to_pause.set_sensitive(Utility.command_exist('xprintidle'))
# Check lock screen command
able_to_lock_screen = False
if config['lock_screen_command'] or Utility.lock_screen_command():