The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
desktop(linux): Alt workspace shortcuts, Super as Meta, tiling-aware chrome
bubu-dudua855450f7fbf
diff --git a/desktop/CLAUDE.md b/desktop/CLAUDE.mdindex 1cb3d78d4..856640854 100644--- a/desktop/CLAUDE.md+++ b/desktop/CLAUDE.md@@ -540,7 +540,12 @@ its headless debug timings do not establish native display or network latency.appear immediately; clicking a row or pressing Enter opens keyboard practice without dispatchingthat action. Labels and keycaps use system UI typography and accessibility text scaling,independent of terminal font and zoom. The practice scratch preview retains terminal typography.- ⇧⌘P opens commands with the query `>`; ⌘P opens the unified picker. On Linux these use Ctrl+Shift+P and Ctrl+P.+ ⇧⌘P opens commands with the query `>`; ⌘P opens the unified picker. On Linux these use+ Ctrl+Shift+P and Alt+Shift+P. Linux, like the web, takes Alt where the Mac takes ⌘+ (`altWorkspacePrefix`) — Hyprland and GNOME keep most Super chords for themselves — and+ `_linuxAltShortcuts`/`linuxAltCommandKeys` move the few that would land on a key a terminal+ program answers (Alt+Enter, Alt+T, Alt+F/B/D). The runner rewrites Super to Meta+ (`super_as_meta_cb`), so a Super chord a user binds still reads as `cmd`.Other workspace shortcuts are ⌘-based — Ctrl otherwise belongs to the shell/tmux, ⌥ is aMeta prefix for the pty (⌥⏎ and ⌥⌫ only — `AltAsMetaInputHandler` in`lib/terminal/terminal_input.dart` turns them into `ESC` + Return and `ESC` + `\x7f`, so thediff --git a/desktop/lib/orchestrator/orchestrator_launcher.dart b/desktop/lib/orchestrator/orchestrator_launcher.dartindex e178db88d..6d9c4386c 100644--- a/desktop/lib/orchestrator/orchestrator_launcher.dart+++ b/desktop/lib/orchestrator/orchestrator_launcher.dart@@ -4,13 +4,13 @@ import '../shared/widgets/labeled_field.dart';import 'package:harness/shared/theme/app_icons.dart';import 'package:flutter/material.dart';-import 'package:flutter/foundation.dart' show kIsWeb;import 'package:flutter/services.dart';import '../shared/theme/app_theme.dart' as grid;import '../shared/widgets/app_dialog.dart';import '../shared/widgets/app_icon_button.dart';import '../shared/widgets/app_select_field.dart';+import '../shortcuts/app_shortcuts.dart' show altWorkspacePrefix;import '../state/app_state.dart';import '../ws/ws_conn.dart';import 'orchestrator_controller.dart';@@ -160,10 +160,10 @@ class _OrchestratorLauncherState extends State<OrchestratorLauncher> {padding: const EdgeInsets.all(24),child: CallbackShortcuts(bindings: {- const SingleActivator(+ SingleActivator(LogicalKeyboardKey.enter,- meta: !kIsWeb,- alt: kIsWeb,+ meta: !altWorkspacePrefix,+ alt: altWorkspacePrefix,): _start,},child: Column(diff --git a/desktop/lib/settings/sections/terminal_section.dart b/desktop/lib/settings/sections/terminal_section.dartindex 38c36d41d..fc6a3e796 100644--- a/desktop/lib/settings/sections/terminal_section.dart+++ b/desktop/lib/settings/sections/terminal_section.dart@@ -8,6 +8,7 @@ import '../../shared/theme/app_theme.dart' as grid;import '../../shared/widgets/app_icon_button.dart';import '../../shared/widgets/app_select_field.dart';import '../../shared/widgets/setting_row.dart';+import '../../shortcuts/app_shortcuts.dart' show linuxKeyLabels;import '../../terminal/terminal_font_store.dart';import '../../terminal/terminal_theme.dart';import '../../terminal/terminal_theme_store.dart';@@ -317,10 +318,12 @@ class _ResetRow extends StatelessWidget {spacing: 10,runSpacing: 8,children: [- Text(- '⌘0',- style: grid.AppType.monoMeta(color: grid.AppPalette.textFaint),- ),+ // ⌘0 is the Mac's View menu row; Linux binds no font-size keys.+ if (!linuxKeyLabels)+ Text(+ '⌘0',+ style: grid.AppType.monoMeta(color: grid.AppPalette.textFaint),+ ),OutlinedButton(key: const Key('terminal-settings-reset-button'),// Dead at the default, because that is what pressing it would leavediff --git a/desktop/lib/sharing/share_harness_dialog.dart b/desktop/lib/sharing/share_harness_dialog.dartindex d54b21b3f..d4413256c 100644--- a/desktop/lib/sharing/share_harness_dialog.dart+++ b/desktop/lib/sharing/share_harness_dialog.dart@@ -77,6 +77,9 @@ class _ShareHarnessDialogState extends State<ShareHarnessDialog> {@overridevoid initState() {super.initState();+ // The dialog veil autofocuses its own Escape scope first, and only one+ // autofocus wins per scope — so the form asks for the keys itself.+ _focusPane();unawaited(_load());_presence = Timer.periodic(const Duration(seconds: 5), (_) {if (!_busy) unawaited(_load(quiet: true));diff --git a/desktop/lib/shortcuts/app_keymap.dart b/desktop/lib/shortcuts/app_keymap.dartindex d7a848e57..fda2bf197 100644--- a/desktop/lib/shortcuts/app_keymap.dart+++ b/desktop/lib/shortcuts/app_keymap.dart@@ -1,6 +1,5 @@import 'dart:io';-import 'package:flutter/foundation.dart' show kIsWeb;import 'package:flutter/widgets.dart';import 'app_shortcuts.dart';@@ -238,10 +237,10 @@ List<ShortcutRow> effectiveShortcutRows(group: command.group,),if (defaultDigits)- const ShortcutRow(+ ShortcutRow(label: 'Select swarms 1–9',chords: [- [kIsWeb ? 'Alt' : '⌘', '1 – 9'],+ [workspaceKeyLabel, '1 – 9'],],group: ShortcutGroup.navigate,),diff --git a/desktop/lib/shortcuts/app_shortcuts.dart b/desktop/lib/shortcuts/app_shortcuts.dartindex 7c156331a..94fbf3fe9 100644--- a/desktop/lib/shortcuts/app_shortcuts.dart+++ b/desktop/lib/shortcuts/app_shortcuts.dart@@ -363,22 +363,7 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) =>}.contains(shortcut.action) &&!shortcut.activator.control))shortcut,- if (swarmMode)- for (final shortcut in kSwarmShortcuts)- if (!kIsWeb &&- shortcut.action == ShortcutAction.addAgent &&- defaultTargetPlatform == TargetPlatform.linux)- AppShortcut(- action: shortcut.action,- activator: const SingleActivator(- LogicalKeyboardKey.keyO,- control: true,- ),- label: shortcut.label,- group: shortcut.group,- )- else- shortcut,+ if (swarmMode) ...kSwarmShortcuts,if (kDebugSurfaceEnabled) kDebugShortcut,].where(@@ -388,13 +373,61 @@ List<AppShortcut> appShortcuts({bool swarmMode = true}) =>.map(_platformShortcut).toList(growable: false);-/// The browser owns Command/Control keys such as Print, New Tab and Close.-/// Web uses Option/Alt as its workspace prefix. Editing and terminal Control-/// keys keep their normal behavior; help and live bindings share this mapping.-String get workspaceCommandModifier => kIsWeb ? 'alt' : 'cmd';+/// The browser owns Command/Control keys such as Print, New Tab and Close,+/// and a Linux desktop owns Super — Hyprland and GNOME bind most Super chords+/// to windows and workspaces before the app sees them. Both use Option/Alt as+/// the workspace prefix. Editing and terminal Control keys keep their normal+/// behavior; help and live bindings share this mapping.+bool get altWorkspacePrefix =>+ kIsWeb || defaultTargetPlatform == TargetPlatform.linux;++String get workspaceCommandModifier => altWorkspacePrefix ? 'alt' : 'cmd';++/// Where "⌘ becomes Alt" would take a key a Linux terminal program already+/// answers — Alt+Enter is the engine prompt's newline, Alt+T Claude Code's+/// thinking toggle, Alt+F/B/D the shell's word motions — the command moves to+/// Alt-Shift instead, and whatever that displaced moves on to a free key.+const _linuxAltShortcuts = <ShortcutAction, SingleActivator>{+ ShortcutAction.newSwarm: SingleActivator(+ LogicalKeyboardKey.keyT,+ alt: true,+ shift: true,+ ),+ ShortcutAction.newTerminal: SingleActivator(+ LogicalKeyboardKey.enter,+ alt: true,+ shift: true,+ ),+ // tmux's `prefix z`, which ⌘⏎ stands for on a Mac.+ ShortcutAction.zoomPane: SingleActivator(LogicalKeyboardKey.keyZ, alt: true),+ ShortcutAction.routeTask: SingleActivator(+ LogicalKeyboardKey.keyB,+ alt: true,+ shift: true,+ ),+ ShortcutAction.findTerminal: SingleActivator(+ LogicalKeyboardKey.keyF,+ alt: true,+ shift: true,+ ),+ ShortcutAction.showDebug: SingleActivator(+ LogicalKeyboardKey.keyX,+ alt: true,+ shift: true,+ ),+};++/// The keymap's string-bound commands, moved for the same reasons.+const linuxAltCommandKeys = <String, List<String>>{+ // VS Code's key, kept from before Linux took Alt.+ 'navigation.commands': ['ctrl+shift+p'],+ 'harnesses.list': ['alt+shift+p'],+ 'pane.split_down': ['alt+shift+d'],+ 'app.daemon_talk': ['alt+shift+a'],+};String platformWorkspaceBinding(String keys) {- if (!kIsWeb || !keys.split('+').contains('cmd')) return keys;+ if (!altWorkspacePrefix || !keys.split('+').contains('cmd')) return keys;final parts = keys.split('+');return {for (final part in parts) part == 'cmd' ? workspaceCommandModifier : part,@@ -402,7 +435,7 @@ String platformWorkspaceBinding(String keys) {}SingleActivator _platformActivator(SingleActivator keys) {- if (!kIsWeb || !keys.meta) return keys;+ if (!altWorkspacePrefix || !keys.meta) return keys;final modifier = workspaceCommandModifier;return SingleActivator(keys.trigger,@@ -414,11 +447,13 @@ SingleActivator _platformActivator(SingleActivator keys) {);}-AppShortcut _platformShortcut(AppShortcut shortcut) => !kIsWeb+AppShortcut _platformShortcut(AppShortcut shortcut) => !altWorkspacePrefix? shortcut: AppShortcut(action: shortcut.action,- activator: _platformActivator(shortcut.activator),+ activator:+ (kIsWeb ? null : _linuxAltShortcuts[shortcut.action]) ??+ _platformActivator(shortcut.activator),label: shortcut.label,group: shortcut.group,);@@ -637,8 +672,8 @@ List<ShortcutRow> shortcutRows() {// everything around them — so they join here, at the end of their group.final digits = ShortcutRow(label: 'Select swarms 1–9',- chords: const [- [kIsWeb ? 'Alt' : '⌘', '1 – $kTabDigitCount'],+ chords: [+ [workspaceKeyLabel, '1 – $kTabDigitCount'],],group: ShortcutGroup.navigate,);@@ -664,24 +699,24 @@ class TerminalKey {/// "why is there no shortcut for X" is answered by seeing that X already/// belongs to something.List<TerminalKey> get kTerminalOwnedKeys => [- if (defaultTargetPlatform == TargetPlatform.linux) ...const [- TerminalKey(['⌃', '⇧', 'C'], 'Copy'),- TerminalKey(['⌃', '⇧', 'V'], 'Paste'),- TerminalKey(['⌃', '⇧', 'A'], 'Select all'),+ if (defaultTargetPlatform == TargetPlatform.linux) ...[+ TerminalKey([controlKeyLabel, shiftKeyLabel, 'C'], 'Copy'),+ TerminalKey([controlKeyLabel, shiftKeyLabel, 'V'], 'Paste'),+ TerminalKey([controlKeyLabel, shiftKeyLabel, 'A'], 'Select all'),] else ...const [TerminalKey(['⌘', 'C'], 'Copy'),TerminalKey(['⌘', 'V'], 'Paste'),TerminalKey(['⌘', 'A'], 'Select all'),],const TerminalKey(['esc'], 'Interrupt the engine'),- const TerminalKey(['⌥', '⏎'], "Newline in the engine's prompt"),+ TerminalKey([altKeyLabel, '⏎'], "Newline in the engine's prompt"),// Kept as short as the rows around them: the deck's narrowest card is 280px, where a label much// past thirty characters takes a second line to itself.- const TerminalKey(['⌥', '⌫'], 'Delete the previous word'),+ TerminalKey([altKeyLabel, '⌫'], 'Delete the previous word'),// ⌘⌫ is taken in the pane on Apple only — elsewhere ⌘ is Super and stays the app's.if (defaultTargetPlatform != TargetPlatform.linux)const TerminalKey(['⌘', '⌫'], "Delete to the line's start"),- const TerminalKey(['⌃', 'C'], 'Cancel / interrupt in the agent'),+ TerminalKey([controlKeyLabel, 'C'], 'Cancel / interrupt in the agent'),];/// Turns the declared shortcuts into the map [CallbackShortcuts] wants.@@ -715,18 +750,44 @@ Map<ShortcutActivator, VoidCallback> buildShortcutBindings({/// a string (a tooltip, a test's failure message).typedef KeyChord = List<String>;+/// The browser and Linux spell modifiers out, joined by `+`, the way their own+/// apps print a chord; only a Mac draws Apple's glyphs.+bool get spellsModifierKeys => kIsWeb || linuxKeyLabels;++/// The native Linux app, whose command key is Super.+bool get linuxKeyLabels =>+ !kIsWeb && defaultTargetPlatform == TargetPlatform.linux;++/// The workspace prefix as a keycap: ⌘ on a Mac, Alt where+/// [altWorkspacePrefix] moved it.+String get workspaceKeyLabel => altWorkspacePrefix ? 'Alt' : '⌘';++String get controlKeyLabel => spellsModifierKeys ? 'Ctrl' : '⌃';+String get altKeyLabel => spellsModifierKeys ? 'Alt' : '⌥';+String get shiftKeyLabel => spellsModifierKeys ? 'Shift' : '⇧';++/// The command key: ⌘ on a Mac, and on Linux the logo key a PC keyboard has+/// in its place, which the desktop calls Super.+String get commandKeyLabel => kIsWeb+ ? 'Cmd'+ : linuxKeyLabels+ ? 'Super'+ : '⌘';++String get chordKeySeparator => spellsModifierKeys ? '+' : '';+/// The caps for [activator], in the order Apple prints them.KeyChord describeShortcutKeys(SingleActivator activator) => [- if (activator.control) kIsWeb ? 'Ctrl' : '⌃',- if (activator.alt) kIsWeb ? 'Alt' : '⌥',- if (activator.shift) kIsWeb ? 'Shift' : '⇧',- if (activator.meta) kIsWeb ? 'Cmd' : '⌘',+ if (activator.control) controlKeyLabel,+ if (activator.alt) altKeyLabel,+ if (activator.shift) shiftKeyLabel,+ if (activator.meta) commandKeyLabel,_keyLabel(activator.trigger),];/// "⇧⌘]" — the way a Mac menu prints it, in the order Apple prints it.String describeShortcut(SingleActivator activator) =>- describeShortcutKeys(activator).join(kIsWeb ? '+' : '');+ describeShortcutKeys(activator).join(chordKeySeparator);String _keyLabel(LogicalKeyboardKey key) {// keyLabel spells these out ("Arrow Left"), which is not how a Mac prints adiff --git a/desktop/lib/shortcuts/keymap_commands.dart b/desktop/lib/shortcuts/keymap_commands.dartindex 2be824adb..bced3211d 100644--- a/desktop/lib/shortcuts/keymap_commands.dart+++ b/desktop/lib/shortcuts/keymap_commands.dart@@ -29,26 +29,9 @@ class HarnessCommand {/// Workspace defaults come from the live shortcut table. A command cannot/// quietly propose different keys from the ones the user already uses.List<String> get keys {- if (!kIsWeb &&- id == 'navigation.commands' &&- defaultTargetPlatform == TargetPlatform.linux) {- return const ['ctrl+shift+p'];- }- if (!kIsWeb &&- id == 'harnesses.list' &&- defaultTargetPlatform == TargetPlatform.linux) {- return const ['ctrl+p'];- }- if (!kIsWeb &&- id == 'models.list' &&- defaultTargetPlatform == TargetPlatform.linux) {- return const ['ctrl+i', 'cmd+i'];- }- if (!kIsWeb &&- id == 'picker.complete' &&- defaultTargetPlatform == TargetPlatform.linux) {- // Ctrl-I opens Models on Linux, including from another picker scope.- return const ['tab'];+ if (!kIsWeb && defaultTargetPlatform == TargetPlatform.linux) {+ final linux = linuxAltCommandKeys[id];+ if (linux != null) return linux;}return action == null? extraKeys.map(platformWorkspaceBinding).toList(growable: false)@@ -855,10 +838,10 @@ ResolvedKeymap get harnessDefaultKeymap =>);List<String> describeKeyStrokeKeys(KeyStroke stroke) => [- if (stroke.control) kIsWeb ? 'Ctrl' : '⌃',- if (stroke.alt) kIsWeb ? 'Alt' : '⌥',- if (stroke.shift) kIsWeb ? 'Shift' : '⇧',- if (stroke.command) kIsWeb ? 'Cmd' : '⌘',+ if (stroke.control) controlKeyLabel,+ if (stroke.alt) altKeyLabel,+ if (stroke.shift) shiftKeyLabel,+ if (stroke.command) commandKeyLabel,const {'left': '←','right': '→',@@ -887,6 +870,6 @@ List<String> describeKeyStrokeKeys(KeyStroke stroke) => [stroke.key.toUpperCase(),];String describeKeyStroke(KeyStroke stroke) =>- describeKeyStrokeKeys(stroke).join(kIsWeb ? '+' : '');+ describeKeyStrokeKeys(stroke).join(chordKeySeparator);String describeKeyBinding(KeyBinding binding) =>binding.keys.map(describeKeyStroke).join(' ');diff --git a/desktop/lib/widgets/box_chrome.dart b/desktop/lib/widgets/box_chrome.dartindex a310528b0..fd790aa4e 100644--- a/desktop/lib/widgets/box_chrome.dart+++ b/desktop/lib/widgets/box_chrome.dart@@ -1,3 +1,4 @@+import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:flutter/semantics.dart';import 'package:flutter/services.dart';@@ -164,15 +165,27 @@ double boxRowHeight(TextScaler scale) =>Color get kBoxFaint => boxText(.54);TextStyle get kBoxFaintStyle => grid.AppType.monoMeta(color: kBoxFaint);+/// Linux spells its chords out (`spellsModifierKeys`); the box prints them in+/// its own lower-case, dash-joined form, as it does a Mac's glyphs.+String _unspelled(String hint) =>+ kIsWeb || defaultTargetPlatform != TargetPlatform.linux+ ? hint+ : hint+ .replaceAll('Ctrl+', 'ctrl-')+ .replaceAll('Alt+', 'alt-')+ .replaceAll('Shift+', 'shift-')+ .replaceAll('Super+', 'super-');+/// Keep the user's actual binding, printed like a terminal's local key guide.-String boxKeyLabel(String hint) => hint- .replaceAll('⌃', 'ctrl-')- .replaceAll('⌥', 'alt-')- .replaceAll('⇧', 'shift-')- .replaceAll('⌘', 'cmd-')- .replaceAll('↵', 'enter')- .replaceAll('⇥', 'tab')- .replaceAll('Esc', 'esc');+String boxKeyLabel(String hint) =>+ _unspelled(hint)+ .replaceAll('⌃', 'ctrl-')+ .replaceAll('⌥', 'alt-')+ .replaceAll('⇧', 'shift-')+ .replaceAll('⌘', 'cmd-')+ .replaceAll('↵', 'enter')+ .replaceAll('⇥', 'tab')+ .replaceAll('Esc', 'esc');/// The highlighted row: a bar at its left edge, fzf's `▌`, with a fill you can/// see. A 5% wash on its own was about 1.15:1 — the keyboard's whole positiondiff --git a/desktop/lib/widgets/daemon_slot.dart b/desktop/lib/widgets/daemon_slot.dartindex 8e63ecfe3..018515b54 100644--- a/desktop/lib/widgets/daemon_slot.dart+++ b/desktop/lib/widgets/daemon_slot.dart@@ -13,6 +13,7 @@ import '../daemons/render.dart' show cardWidth;import '../daemons/roster.dart';import '../shared/theme/app_theme.dart';import '../shared/theme/workspace_bar_style.dart';+import '../shortcuts/app_shortcuts.dart' show linuxKeyLabels;import '../terminal/terminal_theme.dart';import '../terminal/terminal_theme_store.dart';import 'box_chrome.dart';@@ -552,7 +553,7 @@ class DaemonKeys extends StatelessWidget {key: ValueKey('$idPrefix-$key'),label: action.label,tooltip: chord- ? '${action.label} ⌘⌥${key.toUpperCase()}'+ ? '${action.label} ${linuxKeyLabels ? 'Alt+Super+' : '⌘⌥'}${key.toUpperCase()}': action.label,onPressed: () => onAnswer!(key),builder: (context, emphasized) => SizedBox(diff --git a/desktop/lib/widgets/harness_command_bar.dart b/desktop/lib/widgets/harness_command_bar.dartindex 999990f3d..5e36ac24b 100644--- a/desktop/lib/widgets/harness_command_bar.dart+++ b/desktop/lib/widgets/harness_command_bar.dart@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';import 'package:flutter/services.dart';import '../shared/theme/app_theme.dart' as grid;+import '../shortcuts/app_shortcuts.dart' show linuxKeyLabels;import '../state/command_bar.dart';class HarnessCommandBar extends StatefulWidget {@@ -360,7 +361,7 @@ class _HarnessCommandBarState extends State<HarnessCommandBar> {),if (!widget.compact && !watchesVisible)Text(- '⌘⇧J · toggle Esc · close',+ '${linuxKeyLabels ? 'Alt+Shift+J' : '⌘⇧J'} · toggle Esc · close',style: grid.AppType.monoMeta(color: grid.AppPalette.textFaint,),diff --git a/desktop/lib/widgets/linux_menu_bar.dart b/desktop/lib/widgets/linux_menu_bar.dartindex 146b3b909..9656e889e 100644--- a/desktop/lib/widgets/linux_menu_bar.dart+++ b/desktop/lib/widgets/linux_menu_bar.dart@@ -98,8 +98,13 @@ class _LinuxMenuBarState extends State<LinuxMenuBar> {final visible = widget.visible ?? (RuntimePlatform.isLinux && !kUnderTest);if (!visible) return const SizedBox.shrink();grid.AppTheme.watch(context);+ // The strip spans the window with the menus at its left end, where a menu+ // bar sits; the shell's Column would otherwise centre a strip only as+ // wide as its menus.return Container(+ width: double.infinity,height: 30,+ alignment: Alignment.centerLeft,decoration: BoxDecoration(color: grid.AppPalette.panelBg,border: Border(bottom: BorderSide(color: grid.AppGlass.hair)),diff --git a/desktop/linux/runner/my_application.cc b/desktop/linux/runner/my_application.ccindex f4da6f169..0f60eb8f7 100644--- a/desktop/linux/runner/my_application.cc+++ b/desktop/linux/runner/my_application.cc@@ -96,6 +96,24 @@ static void clipboard_image_method_call_cb(FlMethodChannel* channel,fl_method_call_respond(method_call, response, nullptr);}+// The app's command key is Meta — ⌘ on a Mac. A PC keyboard's logo key reaches+// GTK as Super, which Flutter's Linux embedder maps to its own `superKey`+// rather than to meta, so HardwareKeyboard.isMetaPressed never saw it and no+// ⌘ shortcut could fire. Rewrite the key and its modifier bit before FlView's+// own handler (the class default, which runs after this) reads the event.+static gboolean super_as_meta_cb(GtkWidget* widget, GdkEventKey* event,+ gpointer user_data) {+ if (event->keyval == GDK_KEY_Super_L) {+ event->keyval = GDK_KEY_Meta_L;+ } else if (event->keyval == GDK_KEY_Super_R) {+ event->keyval = GDK_KEY_Meta_R;+ }+ if (event->state & GDK_SUPER_MASK) {+ event->state = static_cast<GdkModifierType>(event->state | GDK_META_MASK);+ }+ return FALSE;+}+// Held for the app's lifetime (same scope as the window itself), never unreffed — there is no// natural teardown point before process exit, the same reason `fl_register_plugins` below registers// its plugins on `view` with no matching cleanup in this function.@@ -107,6 +125,31 @@ static void install_clipboard_image_channel(FlView* view) {channel, clipboard_image_method_call_cb, nullptr, nullptr);}+// True under a tiling compositor (Hyprland — Omarchy's — sway, niri, river,+// i3). Windows there carry no title bar: the compositor places them and a key+// closes them, so a GTK header bar is a strip of chrome no other app has.+static gboolean is_tiling_session() {+ const gchar* sockets[] = {"HYPRLAND_INSTANCE_SIGNATURE", "SWAYSOCK",+ "NIRI_SOCKET", "I3SOCK"};+ for (const gchar* name : sockets) {+ const gchar* value = g_getenv(name);+ if (value != nullptr && value[0] != '\0') return TRUE;+ }+ const gchar* desktop = g_getenv("XDG_CURRENT_DESKTOP");+ if (desktop == nullptr) return FALSE;+ g_auto(GStrv) names = g_strsplit(desktop, ":", -1);+ for (gchar** name = names; *name != nullptr; name++) {+ if (g_ascii_strcasecmp(*name, "Hyprland") == 0 ||+ g_ascii_strcasecmp(*name, "sway") == 0 ||+ g_ascii_strcasecmp(*name, "niri") == 0 ||+ g_ascii_strcasecmp(*name, "river") == 0 ||+ g_ascii_strcasecmp(*name, "i3") == 0) {+ return TRUE;+ }+ }+ return FALSE;+}+// Implements GApplication::activate.static void my_application_activate(GApplication* application) {MyApplication* self = MY_APPLICATION(application);@@ -122,8 +165,7 @@ static void my_application_activate(GApplication* application) {GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));// The packaged icon lives beside the executable in the relocatable Linux- // bundle. Resolve it once so both the native window icon and GNOME's custom- // header title use the exact same asset.+ // bundle.g_autofree gchar* icon_path = nullptr;g_autofree gchar* exe_path = g_file_read_link("/proc/self/exe", nullptr);if (exe_path != nullptr) {@@ -133,12 +175,17 @@ static void my_application_activate(GApplication* application) {// Use a header bar when running in GNOME as this is the common style used// by applications and is the setup most users will be using (e.g. Ubuntu- // desktop).+ // desktop) — there it is the only way to drag, minimize or close a GTK+ // window.// If running on X and not using GNOME then just use a traditional title bar// in case the window manager does more exotic layout, e.g. tiling.- // If running on Wayland assume the header bar will work (may need changing- // if future cases occur).+ // Under a tiling compositor draw no title bar at all; on Wayland GTK would+ // otherwise fall back to a client-side one of its own.gboolean use_header_bar = TRUE;+ if (is_tiling_session()) {+ use_header_bar = FALSE;+ gtk_window_set_decorated(window, FALSE);+ }#ifdef GDK_WINDOWING_X11GdkScreen* screen = gtk_window_get_screen(window);if (GDK_IS_X11_SCREEN(screen)) {@@ -149,25 +196,11 @@ static void my_application_activate(GApplication* application) {}#endifif (use_header_bar) {+ // The stock title, name only, as GNOME's own apps caption their windows;+ // the icon already sits in the dock and the task switcher.GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());gtk_widget_show(GTK_WIDGET(header_bar));- // GTK's stock header title has no application icon. Supply a compact,- // centered title widget so the native caption identifies Harness the same- // way it does in the dock and task switcher.- GtkWidget* title = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 6);- if (icon_path != nullptr && g_file_test(icon_path, G_FILE_TEST_IS_REGULAR)) {- g_autoptr(GError) icon_error = nullptr;- g_autoptr(GdkPixbuf) title_pixbuf = gdk_pixbuf_new_from_file_at_scale(- icon_path, 20, 20, TRUE, &icon_error);- if (title_pixbuf != nullptr) {- GtkWidget* icon = gtk_image_new_from_pixbuf(title_pixbuf);- gtk_box_pack_start(GTK_BOX(title), icon, FALSE, FALSE, 0);- }- }- GtkWidget* label = gtk_label_new("Harness");- gtk_box_pack_start(GTK_BOX(title), label, FALSE, FALSE, 0);- gtk_widget_show_all(title);- gtk_header_bar_set_custom_title(header_bar, title);+ gtk_header_bar_set_title(header_bar, "Harness");gtk_header_bar_set_show_close_button(header_bar, TRUE);gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));}@@ -196,6 +229,10 @@ static void my_application_activate(GApplication* application) {fl_view_set_background_color(view, &background_color);gtk_widget_show(GTK_WIDGET(view));gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));+ g_signal_connect(view, "key-press-event", G_CALLBACK(super_as_meta_cb),+ nullptr);+ g_signal_connect(view, "key-release-event", G_CALLBACK(super_as_meta_cb),+ nullptr);// Show the window when Flutter renders.// Requires the view to be realized so we can start rendering.diff --git a/desktop/test/support/open_harness.dart b/desktop/test/support/open_harness.dartindex 1694617f4..876bcfd0b 100644--- a/desktop/test/support/open_harness.dart+++ b/desktop/test/support/open_harness.dart@@ -9,7 +9,7 @@ import 'resource_picker.dart';/// Tests for the landing mode itself send Cmd-O directly instead.Future<void> openHarnessPicker(WidgetTester tester) async {final linux = defaultTargetPlatform == TargetPlatform.linux;- await key(tester, LogicalKeyboardKey.keyO, cmd: !linux, ctrl: linux);+ await key(tester, LogicalKeyboardKey.keyO, cmd: !linux, alt: linux);await tester.pump(const Duration(milliseconds: 100));if (resourceScope('#').evaluate().isNotEmpty &&resourceSearch(tester).matchQuery.isEmpty) {