Skip to content

Add desktop rail workspace and server switcher - #1034

Open
skullvalanche wants to merge 5 commits into
TinyComms:mainfrom
skullvalanche:feat/rail-workspace-switcher
Open

skullvalanche wants to merge 5 commits into
TinyComms:mainfrom
skullvalanche:feat/rail-workspace-switcher

Conversation

@skullvalanche

Copy link
Copy Markdown
Contributor

What changed and why

Hovering a Slack, Mattermost, or Discord rail icon opens a short workspace or server list, with the rest linked to the full list. Keyboard users can open and navigate it too; focus returns to the opener when the menu closes.

Type

  • feature
  • fix
  • perf
  • refactor
  • chore
  • docs

Platforms

  • windows
  • macos
  • linux
  • android
  • ios

Proof

Scenario: e2e/scenarios/rail-workspace-switcher

Lab run: pending

Compatibility

No protocol or server changes. Existing clients and servers are unaffected.

Risk and rollback

A focus or dismissal issue could leave the menu in the wrong state. Revert this PR to remove the switcher.

Release note

Switch Slack, Mattermost, and Discord workspaces or servers from the desktop rail.

@unRekable unRekable left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No blocker. Three majors, each inline:

  1. "N more" does not open the full list for Slack and Mattermost (rail.rs).
  2. Up and Down run out of the flyout at both ends (rail.rs).
  3. The macOS driver saves the whole display into the proof folder and sends a global shortcut (drive.py).

How this was checked: every hunk read and traced, including gpui-ce 0.3.0's focus code (a row with tab_index(0) gets an implicit focus handle, so Down and Enter reach it; TabStopMap keeps same-index stops in insertion order and wraps at both ends, pinned by gpui's own test_tab_handles), the sidebar's go, set_mode and show_mode, the lab's rules for the Mac, and the demo data the scenario reads. The scenario files are LF, both shell drivers carry the executable bit, and py_compile and bash -n pass.

Nothing was built or run by me, and no part of the flyout was seen running. 1 and 3 follow from short functions and the README; 2 follows from the focus code and that test.

Residual risk, not inline:

  • rail.rs:104 expects a handle from a second list of networks kept by hand in state.rs. One added to flies without a handle panics while drawing.
  • A pointer entering any eligible icon turns an open keyboard flyout into a pointer one and drops opener (rail.rs:152-153), so Escape no longer returns focus.
  • A keyboard flyout is kept by a 200 ms timer that re-arms itself while it is open, also when the window is inactive (rail.rs:178-182). Closing on focus leaving the list needs no polling.
  • Icons with a flyout lose their tooltip, and with it the shortcut hint (rail.rs:100).
  • A Discord account with one server gets a one-row flyout that names only the current server (rail.rs:79).
  • The scenario looks for its words anywhere on screen, not in the flyout. The inbox labels channel rows #channel · Workspace, so that holds only while those rows are out of view. The scan has 20 s and spends a full-screen OCR on every 20 px step.
  • 245 lines of UI logic with no unit test, and the description does not say what was run locally.

Review written by an agent (OpenCode, GLM-5.4) on behalf of the account owner.

Comment on lines +331 to +334
fn show_all_rail_spaces(&mut self, network: Network, window: &mut Window, cx: &mut Context<Self>) {
self.close_rail_flyout(window, cx);
self.visit(Mode::Network(network), window, cx);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Major: "N more" leads to the full list only on Discord.
show_all_rail_spaces goes to Mode::Network(network). For Discord that is the server list. For Slack and Mattermost it is the channel list of the workspace already open. The full list there is the header menu behind sidebar_state.slack_menu and mattermost_menu (sidebar.rs:2772, sidebar.rs:3003), which this never sets.
Already in that network, go returns early (sidebar.rs:727-741), so the row closes the flyout and does nothing else. The demo has two Slack workspaces, so the scenario never draws this row.
Smallest fix: after visit, set that network's menu flag and call cx.notify(). It has to come after visit, because set_mode clears both flags.

Comment on lines +284 to +285
"down" => window.focus_next(cx),
"up" => window.focus_prev(cx),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Major: Up and Down leave the flyout at the ends.
window.focus_next and focus_prev walk every tab stop of the window and wrap at both ends (TabStopMap, pinned by gpui's test_tab_handles). The flyout is painted last.
Up right after opening, while the list itself has the focus, lands on the last stop before the flyout. Down on the last row wraps to the first stop of the window. Either way the focus is outside, and the lapse closes the flyout without returning focus to the opener.
The other menus wrap through their rows (menu_step, overlay.rs:75).
Smallest fix: keep an index as they do, or hold a handle per row and, after the step, move to the last or first row when the focus is no longer on one.
Not seen running: this follows from the focus code and that test.

Comment on lines +39 to +41
def words(shot):
image = pyautogui.screenshot()
image.save(shot)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Major: on macOS this saves the whole display into the proof folder.
pyautogui.screenshot() captures the full display, and image.save(shot) makes it the step's shot. e2e/README.md line 155 is explicit for that host: the tinyclient window only, never the whole display, because the Mac is in daily use and the recordings are public.
Line 184 then sends ctrl+cmd+f to whatever window has the focus, where the lab's contract is keys by pid through TinyLabHelper, because sshd holds no grant.
Five older scenarios share this pattern. None has a recording from the Mac.
Smallest fix: read words with the helper's text command, which OCRs the window only. The hover step then still needs a pointer move by pid, which the helper does not have.

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