Skip to content

Speed up theme switcher, shell startup, icon scans, and brightness keys - #20129

Merged
dhh merged 3 commits into
quattrofrom
perf/theme-switcher-and-shell-startup
Nov 25, 2026
Merged

dhh merged 3 commits into
quattrofrom
perf/theme-switcher-and-shell-startup

Conversation

@dhh

@dhh dhh commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • bin/omarchy-theme-switcher: batch theme directory mtime checks into a single stat -Lc '%n:%Y' call, deduplicate the cmp check, remove the dead unread theme_signature pass, and replace find_preview's per-extension find loop with pure-Bash nocaseglob/nullglob.
  • shell/services/PluginRegistry.qml: start rescan() immediately on Component.onCompleted instead of serializing behind initProcess (bash -c mkdir) and watcherReaper, invoke mkdir -p directly, and guard localPluginWatcher.onExited with a destroying flag during Component.onDestruction.
  • shell/services/desktop-entries.sh: replace pure-Bash line-by-line regex parsing with a single-pass awk parser (also fixing exit status 1 when optional directories like ~/.nix-profile/share/applications do not exist).
  • shell/services/AppLibrary.qml & bin/omarchy-theme-set-icons: deduplicate icon index entries by basename inside awk (dropping sort/cut and 4.2x duplicate QML lines), and record in icons.revision whether symlinks changed so ordinary theme switches bump themeRevision++ without rescanning all system icons.
  • shell/services/BrightnessKeys.qml: cache maxBrightness per backlight device instead of re-reading max_brightness twice per keypress, and only re-run omarchy-hw-display if reading the sysfs files fails.

Verified measurements

  • shell/services/desktop-entries.sh: 65.86ms (rc=1) → 10.47ms (rc=0) (6.3x faster)
  • bin/omarchy-theme-switcher index: cold 127.2ms → 17.9ms (7.1x faster), warm 19.5ms → 4.5ms (4.3x faster)

Tests

  • app-icon-scan-test.sh, desktop-entries-test.sh, plugin-manifest-scan-test.sh, plugin-watcher-reap-test.sh, theme-templates-test.sh, theme-set-budget-test.sh
  • ./test/headless: bar-startup-budget-test.sh (193ms), menu-open-budget-test.sh (27ms), lock-appear-budget-test.sh (677/29/25ms), plugins-test.sh

@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Speeds up theme previews, desktop-entry reads, icon scans, plugin startup, and brightness keys.

  • Theme previews use fewer scans when the picker opens.
  • The app library keeps one icon path per name and skips needless rescans.
  • Desktop-entry scans parse files together and skip missing folders.
  • Plugin scans start earlier and keep up with new scan requests.
  • Brightness keys reuse the backlight limit between presses.

Reviews (3) · Last reviewed commit: "Handle failed sysfs brightness reads and..." · Reviewed by Greptile

Comment thread shell/services/PluginRegistry.qml Resolved
Comment thread bin/omarchy-theme-switcher Resolved
Comment thread shell/services/AppLibrary.qml Resolved
@dhh
dhh merged commit 4918a61 into quattro Nov 25, 2026
6 checks passed
@dhh
dhh deleted the perf/theme-switcher-and-shell-startup branch November 25, 2026 15:54
cursor Bot pushed a commit to mark-groves/omarchy that referenced this pull request Nov 25, 2026
…ys (omacom#20129)

* Speed up theme switcher, shell startup, icon scans, and brightness keys

* Fix review findings in theme switcher, icon revision tracking, and plugin scan

* Handle failed sysfs brightness reads and reconcile plugins after watcher start
@emirb emirb added this to the 4.6.0 milestone Dec 1, 2026
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