Smart Pause count as long break #373 - correction to original fix (#388)

Co-authored-by: AdamPS <AdamPS@2650563.no-reply.drupal.org>
This commit is contained in:
AdamPS 2020-11-02 01:21:22 +00:00 committed by GitHub
parent ebe6f1aafb
commit d3bcb9de73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -111,7 +111,7 @@ def init(ctx, safeeyes_config, plugin_config):
global postpone
global idle_time
global short_break_interval
global long_break_interval
global long_break_duration
global waiting_time
global interpret_idle_as_break
global postpone_if_active
@ -126,8 +126,7 @@ def init(ctx, safeeyes_config, plugin_config):
postpone_if_active = plugin_config['postpone_if_active']
short_break_interval = safeeyes_config.get(
'short_break_interval') * 60 # Convert to seconds
long_break_interval = safeeyes_config.get(
'long_break_interval') * 60 # Convert to seconds
long_break_duration = safeeyes_config.get('long_break_duration')
waiting_time = min(2, idle_time) # If idle time is 1 sec, wait only 1 sec
is_wayland_and_gnome = context['desktop'] == 'gnome' and context['is_wayland']
@ -162,7 +161,8 @@ def __start_idle_monitor():
context['idle_period'] = idle_seconds
if interpret_idle_as_break and idle_seconds >= next_break_duration:
# User is idle for break duration and wants to consider it as a break
enable_safe_eyes(-1, idle_seconds >= long_break_interval)
logging.debug("Idle for %d seconds, long break %d", idle_seconds, long_break_duration)
enable_safe_eyes(-1, idle_seconds >= long_break_duration)
elif idle_seconds < short_break_interval:
# Credit back the idle time
if next_break is not None: