Skip to content

feat(rice-switch): redesign the menu as a frosted grid of app tiles - #81

Closed
Schnee111 wants to merge 2 commits into
mainfrom
feat/issue-80-rice-switch-grid
Closed

Schnee111 wants to merge 2 commits into
mainfrom
feat/issue-80-rice-switch-grid

Conversation

@Schnee111

Copy link
Copy Markdown
Owner

Fixes #80

What this changes

Visual only. Selection by row index, Esc/cancel handling and rice name validation are unchanged; the diff touches none of -format i, -no-custom or the choice handling.

The menu from #77 was a restyled vertical list. This replaces it with a grid of app-style tiles, as in macOS Launchpad or the Dock.

common/rofi/rice-switch.rasi, rewritten:

  • Panel: neutral frosted glass, rgba(30, 30, 34, 66%) with a 1 px rgba(255, 255, 255, 14%) border and a 26 px radius, 664 px wide. It no longer imports colors.rasi, because the tiles carry the colour.
  • Header: "Switch Desktop" title (Inter Display Semi-Bold 16) on the left and a rounded search pill on the right. Typing still filters, matches are shown in bold rather than underlined, and the panel keeps its size (fixed-height).
  • Grid: four columns and flow: horizontal. Each tile has a 68 px icon, then the name, the compositor and the dot. The hover/selection state is a soft rgba(255, 255, 255, 11%) tile.
  • Keys: the arrow keys move around the grid (kb-row-left/right). The entry keeps Ctrl+B / Ctrl+F for moving the cursor.
  • Footer: Switching logs you out · ↵ switch · esc cancel.

bin/rice-switch:

  • rice_icon writes ~/.cache/rice-switch/<rice>.svg: a rounded square in the rice's ACCENT, with a light sheen and a hairline edge, and the initial of DISPLAY_NAME in Google Sans Flex. It is rewritten on every open (eight small files), so a cache can never be stale.
  • Tiles are three lines: the name, the compositor, then a dot that is visible (80 %) only under the current rice and invisible on the others, so all tiles have the same height. The icon is a rofi row option. Rows are separated by \x1e, because \x1f belongs to the row option, and are written with printf, because a NUL cannot live in a bash string.
  • -l is now the number of grid rows (ceil(rices / 4)).
  • The fuzzel fallback is unchanged.

Metadata: every rice.conf gets ACCENT, a macOS system colour: indigo, blue, purple, teal, orange, graphite, pink, green. The README template documents it.

Tests:

  • tests/rice-switch.sh checks:
    • one tile per rice;
    • the compositor line;
    • the icon option pointing at the cached SVG, which uses the rice's ACCENT and initial;
    • exactly one visible dot.
  • tests/rice-metadata.sh requires ACCENT to be #RRGGBB.

Verification

  • bash tests/run.sh: all test files pass. shellcheck -S warning is clean. rofi -dump-theme parses the theme.
  • Negative control: with bin/rice-switch from main, tests/rice-switch.sh fails with expected 8 rows, got 0.
  • Live on end4 (1920x1080), running the real bin/rice-switch -n. Screenshots were checked by hand:
    • all 8 tiles are visible with nothing cut off, and the dot sits under end4;
    • Down moves from end4 to Noctalia;
    • typing vit leaves only Vitreus;
    • Escape exits 0 with no output.

Risk

Low. Until the next install links the new theme, the display.rasi fallback shows the three-line tiles in the old list layout. On rices without a blur rule for the rofi layer, the panel is a 66 % dark translucent box.

Replace the Spotlight-style list with a Launchpad/Dock-style grid: four
tiles to a row, each with a generated app icon (a rounded square in the
rice's new ACCENT colour with the initial of its name), the name and the
compositor underneath, and a Dock-style dot under the current rice. The
header has a "Switch Desktop" title and a search pill, the arrow keys
move around the grid, and the footer says that switching logs out. The
glass is neutral; only the tiles carry colour.

Visual only: selection, cancel and validation are unchanged.

Fixes #80
Copilot AI balanced review requested due to automatic review settings October 25, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@Schnee111 Schnee111 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Autonomous Code Review

Verdict: Approved
Target Commit: 44b58f7

Summary

Redesign of the rice-switch menu into an app-tile grid layout is well-structured, securely handles dynamic SVG generation with atomic writes, and updates Rofi arguments and test suites cleanly.

Recommendations

  • In bin/rice-switch (rice_icon), apply uppercase before escaping (initial="$(markup_escape "${initial:0:1}")" vs ${initial^^}): if an initial ever contains & or <, uppercasing post-escape turns &amp;/&lt; into invalid XML entities &AMP;/&LT;.
  • In tests/rice-switch.sh (line 86), use icon="${XDG_CACHE_HOME:-$HOME/.cache}/rice-switch/end4.svg" instead of hardcoding $HOME/.cache to avoid test failures in environments that export XDG_CACHE_HOME.
  • In common/rofi/rice-switch.rasi, textbox { horizontal-align: 0.5; text-color: @text-dim; } applies to all textbox widgets including textbox-title. Scope footer styling to message textbox or explicitly specify horizontal-align: 0.0; and text-color: @text; on textbox-title to prevent unexpected centering or dimming of the header title.
  • In rice_icon SVG template, consider appending a generic font fallback (font-family="Google Sans Flex, sans-serif") for systems where Google Sans Flex is not installed.

Shorekeeper Sentinel · Autonomous Quality Gate

Uppercase the initial before escaping it, add font fallbacks to the
tile SVG, honour XDG_CACHE_HOME in the test, and give the header title
its own alignment and colour so the footer's textbox rule cannot reach
it. (rofi does not match a `message textbox` selector, so the footer
keeps the plain `textbox` rule.)
@Schnee111

Copy link
Copy Markdown
Owner Author

Review follow-ups in 7ec3393:

  • The initial is uppercased before markup_escape.
  • The tile SVG uses font-family="Google Sans Flex, Inter, sans-serif".
  • The test honours XDG_CACHE_HOME. Checked with it set: all checks pass.
  • textbox-title sets horizontal-align: 0.0 and text-color: @text itself. Scoping the footer rule to message textbox was tried first, but rofi does not match that selector (the footer lost its centring and dim colour in a live screenshot), so the footer keeps the plain textbox rule. A re-checked screenshot shows the title white and left-aligned and the footer centred and dim.

@Schnee111 Schnee111 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Autonomous Code Review

Verdict: Changes Requested
Target Commit: 7ec3393

Summary

The redesign cleanly implements the app-tile grid and atomic SVG icon generation, but uses an invalid Rofi property name (content instead of str) on the header title widget, causing the "Switch Desktop" title to render completely blank.

Logic & Invariants

  • common/rofi/rice-switch.rasi:56: textbox-title specifies content: "Switch Desktop"; instead of str: "Switch Desktop";. Rofi textbox widgets do not support the CSS content property; Rofi silently ignores it and looks for str when rendering static text, causing the header title widget to remain empty.

Recommendations

  • In common/rofi/rice-switch.rasi line 56, replace content: "Switch Desktop"; with str: "Switch Desktop"; so Rofi correctly displays the title in the header.

Shorekeeper Sentinel · Autonomous Quality Gate

@Schnee111

Copy link
Copy Markdown
Owner Author

The content finding at common/rofi/rice-switch.rasi:56 is not correct. content is a documented textbox property in rofi 2.0.0, the version installed here (man rofi-theme):

958:       • str/content: the string to display by this textbox (string).
976:       • content: Set the displayed text (String).
1217:                content: "My Message";

The title also renders in practice. Live screenshots of bin/rice-switch -n at this head show "Switch Desktop" in the header, white and left-aligned, before and after the review follow-ups. No change needed.

@Schnee111

Copy link
Copy Markdown
Owner Author

Closing without merging: the grid of icon tiles is not the direction we want. The redesign continues as a row list without icons in a new PR for #80.

@Schnee111 Schnee111 closed this Oct 25, 2026
@Schnee111
Schnee111 deleted the feat/issue-80-rice-switch-grid branch October 25, 2026 00:58
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.

rice-switch: redesign the menu as a frosted row list

2 participants