Skip to content

Linux: ask the desktop for light or dark once; fix the CI hang from the look tests - #29

Merged
usermaneGermane merged 2 commits into
mainfrom
v3-look-once
Nov 13, 2026
Merged

usermaneGermane merged 2 commits into
mainfrom
v3-look-once

Conversation

@usermaneGermane

@usermaneGermane usermaneGermane commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

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 gsettings process, 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_appearance now settles "system" itself: it asks gsettings once (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.
  • The cost: a desktop that switches while SecretSpace runs is followed at the next start, or by choosing in Settings → Appearance. The README says so.
  • Windows is not changed; it keeps following the system live.

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.

  • Likely cause: the look tests added in The new look for Linux: light and dark, Manrope, vaults down the left #28 open a real window. Its fonts and images delete themselves through Tk. When Python's garbage collector later ran inside the test server's thread, each of those objects waited a second for a main loop that no test runs, and the request being served timed out.
  • Fix: the test window's fixture collects its leftovers in the main thread when it closes the window. Tests only; the app itself runs a main loop, so it is not affected.
  • Evidence, not proof: the commit with only fix 1 failed 1 CI run in 3. The commit with this fix passed 3 in 3. Before both, 3 runs in 4 failed.

Tests

  • New 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 each gsettings answer means (including no tool and a timeout).
  • Full suite locally: 753 passed, 6 skipped.

🤖 Generated with Claude Code

https://claude.ai/code/session_011ojnyVg7ccsR3pZ64s7aRH

usermaneGermane and others added 2 commits November 13, 2026 09:41
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
@usermaneGermane usermaneGermane changed the title Linux: ask the desktop for light or dark once, not every 30 ms Linux: ask the desktop for light or dark once; fix the CI hang from the look tests Nov 13, 2026
@usermaneGermane
usermaneGermane merged commit 272e62c into main Nov 13, 2026
18 checks passed
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.

1 participant