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

Add timer for checking themes #325

Open
wants to merge 1 commit into
base: beta
Choose a base branch
from
Open

Add timer for checking themes #325

wants to merge 1 commit into from

Conversation

chase9
Copy link
Contributor

@chase9 chase9 commented Dec 31, 2024

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.

@chase9
Copy link
Contributor Author

chase9 commented Jan 4, 2025

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 daemon property of the timer so that Python would kill the thread when the application tried to close.

@chase9 chase9 marked this pull request as ready for review January 4, 2025 15:36
@l0drex
Copy link
Collaborator

l0drex commented Jan 5, 2025

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!

@chase9
Copy link
Contributor Author

chase9 commented Jan 12, 2025

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.

@chase9 chase9 force-pushed the beta branch 2 times, most recently from 3eb470f to 2357cca Compare January 12, 2025 19:02
@chase9
Copy link
Contributor Author

chase9 commented Jan 14, 2025

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.

@chase9
Copy link
Contributor Author

chase9 commented Jan 16, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants