Restore "Show desktop on wallpaper click" as an opt-in setting#210
Merged
Conversation
✅ WordPress Plugin Check Report
📊 ReportAll checks passed! No errors or warnings found. 🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check |
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.
Summary
Adds a new per-user toggle in OS Settings → Features:
"Show desktop when clicking the wallpaper" (off by default).
The macOS-style left-click-the-wallpaper gesture used to be the only
way to trigger Show Desktop. It was moved into the wallpaper context
menu (CMO) so left-clicks on the desktop wouldn't surprise users who
weren't expecting that affordance. This brings the gesture back as an
opt-in, with the two surfaces kept mutually exclusive so there's
never a redundant entry on screen:
Show desktopentry appears in the wallpaper CMO.the matching CMO entry is suppressed.
Also tidies up the Features tab: each toggle + hint pair now has a
hairline separator above it (matching the existing
__rowseparatorat the bottom of the section), so the wall of checkboxes reads as
grouped settings rather than one continuous list.
Tab placement
The toggle lives in Features, not Appearance: Features is
where per-user behavior flags live (native Posts/Pages/Users/Plugins/
Comments windows, AI comment scoring, reset what's-new dialogs).
Appearance is reserved for look-and-feel (wallpaper, accent, dock
size, layout). This is interaction behavior, so Features is the
right home.
State plumbing
New persisted field
showDesktopOnWallpaperClick: boolean(default
false) wired end-to-end:desktop_mode_default_os_settings()anddesktop_mode_sanitize_os_settings()inincludes/os-settings.phpadd the field with a
(bool)coercion matching the surroundingnative*Enabledflags.OsSettingsState(
src/settings/types.ts),DEFAULTS(src/settings/constants.ts),and the
_parseRawsanitizer insrc/settings/state.ts.The field is intentionally not added to
OsSettingsSnapshot— it's a shell-level preference; no pluginneeds to read it. The shell reads
osSettings.state.*directly atclick time.
Wallpaper menu wiring
src/desktop-files/wallpaper-menu.tsgains an optionalincludeShowDesktop?: booleanfield onWallpaperMenuDeps(default
true). Whenfalse, the built-inshow-desktopitem isomitted from the menu's items list.
src/desktop.tspassesincludeShowDesktop: ! osSettings.state.showDesktopOnWallpaperClickinto the menu builder.
Left-click handler
src/desktop.tsregisters aclicklistener ondesktopArea,gated on the setting:
Guards in plain English:
target !== desktopArea— only the bare wallpaper. Clicks on atile, widget, or any inner surface bubble up but mustn't trigger
the toggle.
synthesized trailing click would otherwise minimize every window
the moment the overview animation starts (this guard mirrors the
one already in the contextmenu handler above).
isWallpaperMenuOpen()— if the CMO is currently open, the clickshould just dismiss it (handled by the menu's own outside-click
listener) without also triggering Show Desktop.
Features section grouping
Each toggle + hint in
src/settings/sections/features.tsis nowwrapped in
<div class="desktop-mode-features__item">. A new rulein
assets/css/os-settings.cssadds a hairline border + paddingabove every item after the first:
This matches the
border-topstyle already used by.desktop-mode-features__rowat the bottom of the section("Reset what's-new dialogs").
Files changed
includes/os-settings.php— default + sanitize.src/settings/types.ts—OsSettingsState.showDesktopOnWallpaperClick.src/settings/constants.ts—DEFAULTS.showDesktopOnWallpaperClick.src/settings/state.ts—_parseRawcoercion.src/settings/sections/features.ts— new checkbox; each togglewrapped in
__itemdivs.src/desktop-files/wallpaper-menu.ts—includeShowDesktopdeps flag.src/desktop.ts— passes flag into menu builder; left-click handler.assets/css/os-settings.css—__itemseparators.tests/vitest/desktop-files-wallpaper-menu.test.ts— new testasserting the
show-desktopitem is omitted whenincludeShowDesktop: false.Test plan
npm run build— green../node_modules/.bin/tsc --noEmit— green.npm run lint— green.npm run test:js— 1209 / 1209 passing.npm run test:php— couldn't run locally (wp-env tests-mysqlservice won't start in this environment). PHP change is the same
default-+-sanitize pattern the surrounding fields use;
php -lon
includes/os-settings.phppasses.shows "Show desktop".
second click restores; CMO no longer shows "Show desktop".
don't trigger Show Desktop).