-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Add timer for checking themes #325
base: beta
Are you sure you want to change the base?
Conversation
Sorry for the excessive commits, I'm still pretty green to Python. Turns out this is a pretty straightforward implementation. I create a timer in main which calls the theme switcher every 45 seconds. I just needed to set the |
Thanks, looks good! I will test this tomorrow and then merge. But for the future, please try to minimize formatting changes. This makes it really hard for me to see whats going on. If you want, you can push all of these changes in one pr. I assume you use a tool for this, if so, please provide the config as well so we can share and maintain the code style. Keep up the good work, and happy new year! |
Sorry for pushing the formatting changes. I'm using the Black Formatter plugin for VScode, along with Flake8 and isort and they are all using default settings. Happy to look into setting up an EditorConfig file or something if you would like. I'll reset my branch so it's just the one change. |
3eb470f
to
2357cca
Compare
Just force pushed as I didn't realize that the Python timer only executes once. This new implementation should repeat indefinitely. I tested a couple of theme shifts and it looks good. I'll give it a day to make sure my system keeps changing theme automatically. |
I've been running this for three days now and can confirm no issues. The application backgrounds and switches themes automatically when running in Flatpak! |
Checking in to let you know this is still working for me. One issue I am running into is that the timer also triggers pulling location from the API if the user has that enabled. This can lead to odd behavior if the timer fires when the computer is offline, or if the API rate limit is hit. I think it would be best to implement some sort of location cache so that we do not pull new location information if not needed. I'm thinking we can build a short list of hardware info and check to see if any of that has changed as an indicator that the location may have changed. For example, tracking Wi-Fi SSID, IP Address, and time zone may be a good way to tell if a users physical location has changed. If the location hasn't changed, we could store the sunset time, sunrise time, and last updated time in the config file and use those values What are your thoughts on this? |
I added a simple timer which checks every 45 seconds to see if the theme needs to be changes. This solves the issue with the flatpak version not being able to utilize systemd units.
I picked 45 seconds since it seems like a good compromise between the resource usage of checking every second, and the user experience of needing to potentially wait a full minute before the theme switches.
The timer is only created if running in the flatpak version so that we don't step on any toes.