Skip to content

Add background switcher across all themes - #11357

Open
TonciZ wants to merge 4 commits into
omacom:quattrofrom
TonciZ:all-theme-backgrounds-switcher
Open

TonciZ wants to merge 4 commits into
omacom:quattrofrom
TonciZ:all-theme-backgrounds-switcher

Conversation

@TonciZ

@TonciZ TonciZ commented Sep 11, 2026 •

Copy link
Copy Markdown

Summary

  • Adds omarchy-theme-bg-switcher-all (omarchy theme bg-switcher-all), which opens the existing image picker over the backgrounds of every theme at once (stock themes, user themes, and the per-theme ~/.config/omarchy/backgrounds/<theme>/ folders), instead of just the current theme.
  • New menu entry style.background-all ("All Backgrounds"), same apply path as the existing background switcher (omarchy-theme-bg-set).
  • New default bind SUPER+CTRL+ALT+SPACE next to the existing SUPER+CTRL+SPACE (current-theme-only) switcher. If you'd rather not add a default bind, the menu entry works on its own and the bind line can be dropped.

How it works

  • One folder of theme-prefixed links. The picker intentionally keeps one image per file name (ImagePickerModel.loadRows, covered by image-picker-test.sh), and themes reuse names — 20 stock themes ship an omarchy.png. Passing every theme's folder directly would hide all but one of those. Instead the switcher links each background into ~/.cache/omarchy/all-backgrounds/ as <theme>@<file> and opens the picker on that folder. The prefix also means typing a theme name in the filter (--filterable) narrows to that theme.
  • Link names can't collide. @ can't appear in installed theme names (omarchy-theme-install allows [a-z0-9._+-]); for user-made themes, % and @ in the theme part are percent-escaped, so the first @ always ends the theme name and every background gets a distinct link. Existing links are read NUL-separated, so any file name (tabs included) is tracked correctly.
  • Clash order matches existing behaviour: a user theme's background wins over a stock theme of the same name (as omarchy-theme-set stages them), and a theme's own background wins over a same-named one in the user's per-theme folder (as the per-theme switcher does).
  • Links are synced, not rebuilt. Only changed links are written and stale ones removed (only symlinks — nothing else in the folder is touched), so the folder's mtime — and with it the picker's row cache — stays valid between opens. Steady-state cost is ~20 ms for 144 backgrounds.
  • Current background is highlighted after a theme switch. omarchy-theme-set points current/background at the copy staged under current/theme/backgrounds/, which is none of the originals. The switcher maps a staged background back to its original theme file by name, so the picker highlights it (it matches the link via find -L -samefile) and pressing Enter keeps the wallpaper. Selecting returns a link; omarchy-theme-bg-set already realpaths it, so current/background points at the original file as before.

No changes to omarchy-menu-images, ImagePickerModel, or omarchy-theme-bg-set.

Test plan

  • New test/shell.d/theme-bg-switcher-all-test.sh (12 checks): same-named backgrounds from different themes both appear; user theme beats stock theme; user per-theme backgrounds included; link names can't collide even for theme names containing @/%; picker opens filterable on the link folder; a staged background maps back to its original, and to its own theme when names would otherwise run together; an original background is selected as is; an unchanged view isn't rewritten (tabs in file names included); removed backgrounds lose their link; new backgrounds gain one; non-link files are never removed.
  • ./test/all — no new failures. The 4 failing files (config, locate, snapper, unowned-system-paths) fail identically without this PR's changes (missing local omarchy-pkgs checkout / local tooling).
  • Verified on a live Omarchy install with 29 background folders / 144 images: all 144 listed (previously 125), current background highlighted, selecting applies it and updates omarchy theme bg current.
  • hyprctl configerrors clean after adding the bind.

@omarchybot omarchybot added the enhancement New feature or request label Sep 27, 2026
With every theme's backgrounds in one carousel the list gets long;
--filterable lets you type to narrow it by file name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds a new background switcher menu option.

The PR appears safe to merge, though filtering by the literal name of a user-created theme containing @ or % does not work.

Findings

  1. P2 Theme-name filtering breaks ▶

Summary

The PR adds an all-themes background picker, a menu action, a default binding, and shell tests. It gives backgrounds theme-prefixed links so images with the same filename remain selectable, and maps staged backgrounds back to their originals for selection highlighting.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Theme and per-theme backgrounds] --> B[Escape theme name and create unique link names]
  B --> C[Sync all-backgrounds cache]
  C --> D[Filterable image picker]
  D --> E[Set selected background]
Loading

Reviews (3) · Last reviewed commit: "Make background link names collision-fre..."

Comment thread bin/omarchy-theme-bg-switcher-all Outdated
Comment thread bin/omarchy-theme-bg-switcher-all Outdated
The image picker keeps one image per file name, so passing every theme's
backgrounds folder hid same-named backgrounds (20 stock themes ship an
omarchy.png; only the first was selectable). Link every background into
one cache folder as <theme>--<file> and open the picker on that instead.
The prefix also lets the filter match theme names.

Switching theme points the background at the copy staged under
current/theme, which matched none of the originals, so the picker
highlighted the first image and Enter could change the wallpaper. Map a
staged background back to its original theme file before selecting it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread bin/omarchy-theme-bg-switcher-all Outdated
Comment thread bin/omarchy-theme-bg-switcher-all Outdated
A theme name may contain "--", so "<theme>--<file>" could give two
backgrounds the same link name (foo--bar/baz.png and foo/bar--baz.png),
hiding one and letting the staged-background lookup pick the other.
Separate with "@", which installed theme names can't contain, and
percent-escape "%" and "@" in the theme part so the first "@" always
ends the theme name, whatever a user-made theme is called.

Read existing links NUL-separated instead of tab-separated, so a tab in
a file name no longer makes the switcher rewrite the link on every open
or leave it behind when the background is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines +24 to +25
local theme=${1//%/%25}
REPLY=${theme//@/%40}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Theme-name filtering breaks When a user-created theme is named my@theme or contains %, this escaping changes the name shown to the picker to %40 or %25. The picker filters link names without decoding them, so typing the theme’s actual name finds none of its backgrounds. The labels show the escaped name too, making those themes harder to find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants