Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The refresh timer is being reset every time screen is locked #7

Open
PaulVanSchayck opened this issue Nov 1, 2019 · 2 comments
Open
Labels
bug Something isn't working

Comments

@PaulVanSchayck
Copy link

Nice extension!

I've set the refresh timer to 24h, but this timer seems to be reset every time the screen is locked. After unlocking the screen, the timer will say "<1m" and refresh the image pretty soon after that.

Could it have something to do with that extensions are not allowed to run during the lock screen?

@PaulVanSchayck PaulVanSchayck changed the title Refresh timer reset every time screen is locked The refresh timer is being reset every time screen is locked Nov 1, 2019
@jhsoby
Copy link
Owner

jhsoby commented Nov 2, 2019

Thanks for reporting this, Paul!

Indeed, I am seeing the same behaviour. I think it's a remnant of how the Bing wallpaper changer (which this is based on) is working – there there is one wallpaper per day and that's it, so even if the timer refreshes multiple times a day it won't change the wallpaper unless there is a new wallpaper available from Bing. So setting the timer to update every time the screen is unlocked makes sense, because that's essentially checking for a new available wallpaper.

What we need to do here is to remember when the wallpaper was last saved – I'm not sure how to do that, except writing it to a "temporary config file" or something. This also affects the description, author and license information in the widget – once you unlock the screen, that information doesn't show up in the widget like it should. So writing all of this to a config file would remedy that.

Now, for how to actually do that in JavaScript… I'll need to do some googling. :-)

@jhsoby jhsoby added the bug Something isn't working label Nov 2, 2019
@neffo
Copy link

neffo commented Nov 13, 2019

You can use DConf settings, I use that in the Google Earth View extension for just this very reason.

See the utils.js file within your own extension for some help with this, you might need to extend the DConf schema for the extension.

this._settings = Utils.getSettings();

let timezone = GLib.TimeZone.new_local();
let localTime = GLib.DateTime.new_now(timezone).add_seconds(seconds);
this._settings.set_int('next-refresh',localTime.to_unix());

nextrefresh = this._settings.get_int('next-refresh');

The reason the time is being reset I believe is because the extension actually loses state when the screen is locked. I thnik they might actually be disabled when the screen locks, at least on some versions of GNOME.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants