Repository navigation
Linux: ask the desktop for light or dark once; fix the CI hang from the look tests - #29
Merged
Merged
Conversation
CustomTkinter's "system" mode asks the system again every 30 ms. On Linux each question starts a gsettings process (darkdetect), so 1.1.0- alpha.2 started dozens of processes a second for as long as it ran. - theme.apply_appearance settles "system" itself: desktop_is_dark() asks gsettings once (colour scheme, then the theme's name), with a two second limit, and light or dark is set. CustomTkinter is never left in "system" mode, at import either. - A desktop that changes while the app runs is followed at the next start, or by choosing in Settings -> Appearance. - tests/test_look_linux.py. Since alpha.2, two CI jobs failed on their first attempt, twice, in the same sync tests with a 20 second timeout. This is the likely cause; the CI runs of this change are the check. Version 1.1.0-alpha.3. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ojnyVg7ccsR3pZ64s7aRH
Since the look tests open a real window, CI failed now and then in a sync test with a 20 second timeout. Fonts and images delete themselves through Tk. When the garbage collector ran in the test server's thread, each of them waited a second for a main loop that no test runs, and the request being served timed out. The window's fixture now collects in the main thread when it closes the window. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011ojnyVg7ccsR3pZ64s7aRH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes for the new look on Linux, found right after #28 merged. Version 1.1.0-alpha.3. 1.1.0-alpha.2 was not published as a release.
1. The app asked the desktop for light or dark every 30 ms
The toolkit's "follow the system" mode asks the system again every 30 ms. On Windows that is a registry read. On Linux each question starts a
gsettingsprocess, so the app as merged in #28 would start dozens of processes a second for as long as it ran. (Found by reading the toolkit's code; not measured on a desktop.)theme.apply_appearancenow settles "system" itself: it asksgsettingsonce (the colour scheme, then the theme's name on older desktops), gives it two seconds, and sets light or dark. The toolkit is never left in its polling mode.2. CI failed now and then since #28, in a sync test
Since #28, CI failed in one or two jobs per run, always in a sync test with a 20-second timeout against the test's own local server. I first called it a random flake, then blamed the polling above. Both were wrong.
Tests
tests/test_look_linux.py: the toolkit is never left in system mode, "system" asks the desktop exactly once, a chosen mode never asks, and what eachgsettingsanswer means (including no tool and a timeout).🤖 Generated with Claude Code
https://claude.ai/code/session_011ojnyVg7ccsR3pZ64s7aRH