oleid/gnome-shell-teatime

Countdown stops, if shell is locked

Closed this issue · 4 comments

Note to myself: This seems to work for the pomodoro guys, check how they do it!

But please consider making it optional. Quite often it is preferred to keep the counter running even when locked for a while.

oleid commented

I'm not really sure how to do that. gnome-shell automatically disables all the timers when the shell is locked.

I think, the solution can be done easily with help of an additional data-file. All extensions are destroyed when Gnome exits, hence the state has to be saved to a data file on destroy() and restored on _init().

On destroy(), at least { timer_name, absolute_timeout_time } should be saved for an active timer.
On _init(), there are more cases to consider:

  • if there's no data-file or no timeout saved, extensions should start without any timer (as usual);
  • if there's a timeout saved and it's already up, the data should be cleared and the notification triggered right away;
  • in other case, the restored timeout should be set (what's left of it) and the data cleared.

The advantage of this approach is that it can even keep the time after suspend or reboot.

no data file, just using already used settings with additional keys
no destroy routine used, just save timer on start and remove saved timer on stop, test on init (if starting, will rewrite already saved state) -> so the graphical counter won't restart, just continue