Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(remote-desktop): refine Omarchy toolbar icons and navigation

Dash Huang14e52e590db9
diff --git a/apps/desktop/src/main/remote-desktop/__tests__/linuxOmarchyMenu.test.ts b/apps/desktop/src/main/remote-desktop/__tests__/linuxOmarchyMenu.test.ts
new file mode 100644
index 0000000000..ae35f8f477
--- /dev/null
+++ b/apps/desktop/src/main/remote-desktop/__tests__/linuxOmarchyMenu.test.ts
@@ -0,0 +1,35 @@
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+const h = vi.hoisted(() => ({ exec: vi.fn() }));
+vi.mock('node:child_process', () => ({ execFile: vi.fn() }));
+vi.mock('node:util', () => ({ promisify: () => h.exec }));
+vi.mock('node:fs', () => ({ accessSync: vi.fn(), constants: { X_OK: 1 } }));
+vi.mock('../linuxSessionLock', () => ({ isLinuxDesktopUnlocked: async () => true }));
+vi.mock('../linuxDesktop', () => ({ linuxMonitor: async () => ({ name: 'eDP-2' }) }));
+import { LinuxWindowActions } from '../linuxWindowActions';
+
+beforeEach(() => {
+ vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
+ h.exec.mockReset();
+});
+afterEach(() => vi.restoreAllMocks());
+
+it('lets Omarchy own menu visibility so the second press closes it', async () => {
+ let visible = false;
+ h.exec.mockImplementation(async (program, args) => {
+ if (program === '/usr/bin/omarchy') {
+ expect(args).toEqual(['menu', 'toggle']);
+ visible = !visible;
+ }
+ return { stdout: 'ok' };
+ });
+ const windows = new LinuxWindowActions();
+ await windows.request('omarchyMenu', undefined, 'hyprland:eDP-2', () => true);
+ expect(visible).toBe(true);
+ await windows.request('omarchyMenu', undefined, 'hyprland:eDP-2', () => true);
+ expect(visible).toBe(false);
+ // The same command also works when the menu was opened locally.
+ visible = true;
+ await windows.request('omarchyMenu', undefined, 'hyprland:eDP-2', () => true);
+ expect(visible).toBe(false);
+});
diff --git a/apps/desktop/src/main/remote-desktop/__tests__/linuxWindowActions.test.ts b/apps/desktop/src/main/remote-desktop/__tests__/linuxWindowActions.test.ts
index 224717760d..2f9d5ffffe 100644
--- a/apps/desktop/src/main/remote-desktop/__tests__/linuxWindowActions.test.ts
+++ b/apps/desktop/src/main/remote-desktop/__tests__/linuxWindowActions.test.ts
@@ -155,12 +155,12 @@ it('strictly parses the additive host action without accepting arbitrary command
});
it.each([false, true])(
- 'switches workspaces on the captured monitor without moving windows (Lua=%s)',
+ 'includes empty workspaces on the captured monitor without moving windows (Lua=%s)',
async (lua) => {
const h = fixture(lua);
for (const [action, direction] of [
- ['workspaceLeft', 'm-1'],
- ['workspaceRight', 'm+1'],
+ ['workspaceLeft', 'r-1'],
+ ['workspaceRight', 'r+1'],
] as const) {
await h.windows.request(action, undefined, 'hyprland:eDP-2', () => true);
expect(h.run).toHaveBeenLastCalledWith(
diff --git a/apps/desktop/src/main/remote-desktop/linuxWindowActions.ts b/apps/desktop/src/main/remote-desktop/linuxWindowActions.ts
index dfcdbad0cf..d2ad78cead 100644
--- a/apps/desktop/src/main/remote-desktop/linuxWindowActions.ts
+++ b/apps/desktop/src/main/remote-desktop/linuxWindowActions.ts
@@ -19,7 +19,7 @@ export function supportsOmarchyMenu(): boolean {
}
async function openOmarchyMenu(): Promise<void> {
if (!supportsOmarchyMenu()) throw new Error('DESKTOP_INPUT_UNSUPPORTED');
- await exec('/usr/bin/omarchy', ['menu', 'summon'], { timeout: 2000, maxBuffer: 16384 });
+ await exec('/usr/bin/omarchy', ['menu', 'toggle'], { timeout: 2000, maxBuffer: 16384 });
}
const invoke = async (args: string[]): Promise<string> => {
const { stdout } = await exec('/usr/bin/hyprctl', args, { timeout: 2000, maxBuffer: 512000 });
@@ -120,7 +120,8 @@ export class LinuxWindowActions {
await this.dispatch('focusmonitor', selected.name, check);
await check();
if (action === 'omarchyMenu') await this.openMenu();
- else await this.dispatch('workspace', action === 'workspaceLeft' ? 'm-1' : 'm+1', check);
+ // r includes empty workspaces on this monitor; m skips them.
+ else await this.dispatch('workspace', action === 'workspaceLeft' ? 'r-1' : 'r+1', check);
await check();
return null;
}
diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx
index 647837f054..5e84e210d6 100644
--- a/apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx
+++ b/apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx
@@ -26,13 +26,7 @@ import {
presentationDragIndicator,
shapes,
} from "@expo/ui/swift-ui/modifiers";
-import {
- ArrowLeft,
- ArrowRight,
- Menu,
- Keyboard,
- SlidersHorizontal,
-} from "lucide-react-native";
+import { Keyboard, SlidersHorizontal } from "lucide-react-native";
import { useTranslation } from "react-i18next";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import {
@@ -46,7 +40,13 @@ import {
import { useLiquidGlassAvailable } from "@/session/useLiquidGlassAvailable";
import { Text as AppText } from "@/components/AppText";
import { RemoteDesktopPanelButton } from "./RemoteDesktopPanelButton";
-import { AllWindowsIcon, ShowDesktopIcon } from "./RemoteDesktopIcons";
+import {
+ AllWindowsIcon,
+ ShowDesktopIcon,
+ WorkspaceLeftIcon,
+ WorkspaceRightIcon,
+ OmarchyMenuIcon,
+} from "./RemoteDesktopIcons";
import type {
RemoteDesktopPanel as Panel,
RemoteDesktopToolbar as Toolbar,
@@ -64,14 +64,14 @@ export function RemoteDesktopToolbar(props: ComponentProps<typeof Toolbar>) {
const actions = [
{
key: props.onWorkspaceLeft ? "workspaceLeft" : "allWindows",
- Icon: props.onWorkspaceLeft ? ArrowLeft : AllWindowsIcon,
+ Icon: props.onWorkspaceLeft ? WorkspaceLeftIcon : AllWindowsIcon,
onPress: props.onWorkspaceLeft ?? props.onWindows,
disabled: !props.canControl,
selected: false,
},
{
key: props.onWorkspaceRight ? "workspaceRight" : "showDesktop",
- Icon: props.onWorkspaceRight ? ArrowRight : ShowDesktopIcon,
+ Icon: props.onWorkspaceRight ? WorkspaceRightIcon : ShowDesktopIcon,
onPress: props.onWorkspaceRight ?? props.onDesktop,
disabled: !props.canControl,
selected: false,
@@ -80,7 +80,7 @@ export function RemoteDesktopToolbar(props: ComponentProps<typeof Toolbar>) {
? [
{
key: "omarchyMenu",
- Icon: Menu,
+ Icon: OmarchyMenuIcon,
onPress: props.onOmarchyMenu,
disabled: !props.canControl,
selected: false,
diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx
index 534ae250de..5f1bc74d69 100644
--- a/apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx
+++ b/apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx
@@ -4,12 +4,15 @@ import { Pressable, ScrollView, StyleSheet, View } from "react-native";
import {
Keyboard,
SlidersHorizontal,
- ArrowLeft,
- ArrowRight,
- Menu,
type LucideIcon,
} from "lucide-react-native";
-import { AllWindowsIcon, ShowDesktopIcon } from "./RemoteDesktopIcons";
+import {
+ AllWindowsIcon,
+ ShowDesktopIcon,
+ WorkspaceLeftIcon,
+ WorkspaceRightIcon,
+ OmarchyMenuIcon,
+} from "./RemoteDesktopIcons";
import { RemoteDesktopPanelButton } from "./RemoteDesktopPanelButton";
import { useTranslation } from "react-i18next";
import { Text } from "@/components/AppText";
@@ -62,13 +65,13 @@ export function RemoteDesktopToolbar({
}> = [
{
key: onWorkspaceLeft ? "workspaceLeft" : "allWindows",
- icon: onWorkspaceLeft ? ArrowLeft : AllWindowsIcon,
+ icon: onWorkspaceLeft ? WorkspaceLeftIcon : AllWindowsIcon,
press: onWorkspaceLeft ?? onWindows,
disabled: !canControl,
},
{
key: onWorkspaceRight ? "workspaceRight" : "showDesktop",
- icon: onWorkspaceRight ? ArrowRight : ShowDesktopIcon,
+ icon: onWorkspaceRight ? WorkspaceRightIcon : ShowDesktopIcon,
press: onWorkspaceRight ?? onDesktop,
disabled: !canControl,
},
@@ -76,7 +79,7 @@ export function RemoteDesktopToolbar({
? [
{
key: "omarchyMenu",
- icon: Menu,
+ icon: OmarchyMenuIcon,
press: onOmarchyMenu,
disabled: !canControl,
},
diff --git a/apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx b/apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx
index c3dbb22ba3..1ce385a571 100644
--- a/apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx
+++ b/apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx
@@ -1,15 +1,72 @@
-import { createLucideIcon } from "lucide-react-native";
+import { memo } from "react";
+import { createLucideIcon, type LucideProps } from "lucide-react-native";
+
+export const WorkspaceLeftIcon = createLucideIcon(
+ "RemoteDesktopWorkspaceLeft",
+ [
+ [
+ "rect",
+ { x: "3", y: "3", width: "18", height: "14", rx: "2", key: "screen" },
+ ],
+ ["path", { d: "M12 17v4M8 21h8M15 10H9m3-3-3 3 3 3", key: "direction" }],
+ ],
+);
+
+export const WorkspaceRightIcon = createLucideIcon(
+ "RemoteDesktopWorkspaceRight",
+ [
+ [
+ "rect",
+ { x: "3", y: "3", width: "18", height: "14", rx: "2", key: "screen" },
+ ],
+ ["path", { d: "M12 17v4M8 21h8M9 10h6m-3-3 3 3-3 3", key: "direction" }],
+ ],
+);
+
+// Official Omarchy mark: https://omarchy.org/brand/omarchy-logo.svg
+// Preserve its path and proportions; inherit the toolbar's Light/Dark foreground.
+const OmarchyMark = createLucideIcon("RemoteDesktopOmarchyMenu", [
+ [
+ "path",
+ {
+ d: "m1200 1200h-480v-80h400v-1040h-479.996v160h-400v720h720v-720h-80v-80h159.996v880h-400v160h-640v-1200h1200zm-1120-80h480v-80h-400l.004-400h-80.004zm0-560h80.004v-400h400v-80h-480.004z",
+ transform: "scale(0.02)",
+ fillRule: "evenodd",
+ clipRule: "evenodd",
+ stroke: "none",
+ key: "official-mark",
+ },
+ ],
+]);
+
+export const OmarchyMenuIcon = memo(
+ ({ color = "currentColor", ...props }: LucideProps) => (
+ <OmarchyMark {...props} color={color} fill={color} />
+ ),
+);
// Same 24-point grid and round line endings as the adjacent Lucide controls.
// The rear window stops at the foreground outline instead of showing through it.
export const AllWindowsIcon = createLucideIcon("RemoteDesktopAllWindows", [
- ["path", { d: "M4 16a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1", key: "rear" }],
- ["rect", { x: "7", y: "8", width: "15", height: "13", rx: "2", key: "front" }],
+ [
+ "path",
+ {
+ d: "M4 16a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v1",
+ key: "rear",
+ },
+ ],
+ [
+ "rect",
+ { x: "7", y: "8", width: "15", height: "13", rx: "2", key: "front" },
+ ],
["path", { d: "M7 12h15", key: "titlebar" }],
]);
export const ShowDesktopIcon = createLucideIcon("RemoteDesktopShowDesktop", [
- ["rect", { x: "2", y: "3", width: "20", height: "14", rx: "2", key: "screen" }],
+ [
+ "rect",
+ { x: "2", y: "3", width: "20", height: "14", rx: "2", key: "screen" },
+ ],
["path", { d: "M8 13h8", key: "dock" }],
["path", { d: "M12 17v4M8 21h8", key: "stand" }],
]);
diff --git a/apps/mobile/src/remote-desktop/__tests__/nativeChrome.test.tsx b/apps/mobile/src/remote-desktop/__tests__/nativeChrome.test.tsx
index ccdf144d7a..c2dcc17792 100644
--- a/apps/mobile/src/remote-desktop/__tests__/nativeChrome.test.tsx
+++ b/apps/mobile/src/remote-desktop/__tests__/nativeChrome.test.tsx
@@ -104,6 +104,9 @@ vi.mock("lucide-react-native", () => ({
vi.mock("../RemoteDesktopIcons", () => ({
AllWindowsIcon: () => null,
ShowDesktopIcon: () => null,
+ WorkspaceLeftIcon: () => <span data-icon="workspace-left" />,
+ WorkspaceRightIcon: () => <span data-icon="workspace-right" />,
+ OmarchyMenuIcon: () => <span data-icon="omarchy" />,
}));
vi.mock("react-i18next", () => ({
useTranslation: () => ({ t: (key: string) => key }),
@@ -193,6 +196,8 @@ it.each([false, true])(
onOmarchyMenu: menu,
};
const v = mount(<RemoteDesktopToolbar {...props} />);
+ for (const icon of ["workspace-left", "workspace-right", "omarchy"])
+ expect(v.host.querySelector(`[data-icon="${icon}"]`)).not.toBeNull();
for (const key of ["workspaceLeft", "workspaceRight", "omarchyMenu"])
act(() =>
v.host
diff --git a/docs/remote-desktop.md b/docs/remote-desktop.md
index 45b98d6102..08d97fb768 100644
--- a/docs/remote-desktop.md
+++ b/docs/remote-desktop.md
@@ -608,15 +608,21 @@ of physical phone end-to-end parity.
| Desktop navigation | Mission Control / system shortcuts | Capability-gated left/right workspace buttons on the captured monitor and an Omarchy menu button when installed; legacy viewers retain the window picker and temporary empty-workspace toggle |
| PiP, rotation, gestures | Mobile viewer functionality | Same viewer functionality, subject to phone/runtime support |
+The Omarchy toolbar uses desktop-and-arrow icons and the official Omarchy mark
+(https://omarchy.org/brand/omarchy-logo.svg), tinted with the toolbar foreground
+in both themes. Left/right navigation includes empty workspaces on the captured
+monitor (`r-1` / `r+1`); the menu button uses Omarchy's own `menu toggle`, so a
+second press closes it even when the menu was opened locally.
+
Linux's window picker supplies selection/switching, not macOS Mission Control's
thumbnail animation. Quickshell auto-unlock remains unavailable under the
existing-system-interface constraint. These differences and the unverified
physical phone scenarios must not be described as complete macOS parity.
The mobile toolbar uses `workspaceNavigation` to replace its first two actions
-with left/right desktops (`m-1` / `m+1`, existing workspaces on the selected
+with left/right desktops (`r-1` / `r+1`, including empty workspaces on the selected
monitor). `omarchyMenu` adds a fifth action, invoking the fixed local
-`omarchy menu summon` entry point. Keyboard and Controls remain available.
+`omarchy menu toggle` entry point. Keyboard and Controls remain available.
Both native iOS and shared mobile chrome size the toolbar for its action count;
the landscape popover stays anchored to Controls. Old hosts keep their original
toolbar, and all new host actions require an active controlling lease.