diff --git a/CHANGELOG.md b/CHANGELOG.md
index 67f4ea04..12efa12f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,9 @@ release is checked here and released on by hand.
password field brings the on-screen keyboard back after it was put away,
tapping beside the window cancels, and the keyboard goes with the window.
+- With a keyboard, Command (Super) with X, C, V and A cuts, copies, pastes
+ and selects all, in the terminal too, as in upstream Omarchy.
+
- After typing a Wi-Fi password in the control center and pressing Enter,
the on-screen keyboard stays above the control center until it is put
away, instead of being covered by it where it couldn't be dismissed.
diff --git a/desktop/shell/default/i18n/en/shell.json b/desktop/shell/default/i18n/en/shell.json
index 26bbfd00..ec89fdbb 100644
--- a/desktop/shell/default/i18n/en/shell.json
+++ b/desktop/shell/default/i18n/en/shell.json
@@ -754,6 +754,7 @@
"shortcuts.none": "No shortcuts",
"shortcuts.group.shell": "Shell",
"shortcuts.group.apps": "Apps",
+ "shortcuts.group.edit": "Editing",
"shortcuts.group.windows": "Windows",
"shortcuts.group.screenshots": "Screenshots",
"shortcuts.group.hardware": "Hardware Keys",
@@ -771,6 +772,10 @@
"shortcuts.bar": "Show or Hide the Bar",
"shortcuts.terminal": "Terminal",
"shortcuts.browser": "Browser",
+ "shortcuts.cut": "Cut",
+ "shortcuts.copy": "Copy",
+ "shortcuts.paste": "Paste",
+ "shortcuts.selectAll": "Select All",
"shortcuts.activity": "Activity",
"shortcuts.screenshot": "Screenshot",
"shortcuts.volumeUp": "Volume Up",
diff --git a/desktop/shell/labwc-rc.xml b/desktop/shell/labwc-rc.xml
index d2ce56fe..cf987d84 100644
--- a/desktop/shell/labwc-rc.xml
+++ b/desktop/shell/labwc-rc.xml
@@ -187,6 +187,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+XML
+)
+awk -v block="$block" '$0 == " " && !done { print block; done = 1 } { print }' "$rc" > "$rc.new"
+mv -- "$rc.new" "$rc"
diff --git a/desktop/shell/shell/settings/ShortcutsModel.js b/desktop/shell/shell/settings/ShortcutsModel.js
index c6a7bdc7..eb65fe8b 100644
--- a/desktop/shell/shell/settings/ShortcutsModel.js
+++ b/desktop/shell/shell/settings/ShortcutsModel.js
@@ -35,7 +35,7 @@ function unescape(text) {
// What a binding does: { group, label } (i18n keys), or null for one that is
// there only to swallow a key (Execute /usr/bin/true).
-// groups: shell, apps, windows, screenshots, hardware, other
+// groups: shell, apps, edit, windows, screenshots, hardware, other
var COMMANDS = [
[/omarchy\.dock apps$/, "shell", "shortcuts.launcher"],
[/omarchy\.controlcenter toggle/, "shell", "shortcuts.controlCenter"],
@@ -48,6 +48,12 @@ var COMMANDS = [
[/omarchy\.menu .*"system"/, "shell", "shortcuts.systemMenu"],
[/omarchy\.menu .*"root"/, "shell", "shortcuts.menu"],
[/omarchy-toggle-bar\b/, "shell", "shortcuts.bar"],
+ // The universal clipboard: keys sent through the virtual keyboard. Copy and
+ // paste are an If (terminal or not), named by its first branch.
+ [/omarchy-wtype .* x -m /, "edit", "shortcuts.cut"],
+ [/omarchy-wtype .*( c|-k Insert) -m /, "edit", "shortcuts.copy"],
+ [/omarchy-wtype .* v -m /, "edit", "shortcuts.paste"],
+ [/omarchy-wtype .* a -m /, "edit", "shortcuts.selectAll"],
[/\bfoot\b|omarchy-launch-terminal/, "apps", "shortcuts.terminal"],
[/\bfirefox\b|omarchy-launch-browser/, "apps", "shortcuts.browser"],
[/omactivity|\bbtop\b/, "apps", "shortcuts.activity"],
@@ -77,6 +83,8 @@ var ACTIONS = {
function describe(binding) {
var first = binding.actions[0]
if (!first) return null
+ // …: what it does is its then.
+ if (first.name === "If" && binding.actions[1]) first = binding.actions[1]
if (first.name === "Execute") {
var command = first.command
if (/^\s*(\/usr\/bin\/)?true\s*$/.test(command)) return null
@@ -96,7 +104,7 @@ function describe(binding) {
return { group: "other", label: "", command: first.name, rank: 1000 }
}
-var GROUPS = ["shell", "apps", "windows", "screenshots", "hardware", "other"]
+var GROUPS = ["shell", "apps", "edit", "windows", "screenshots", "hardware", "other"]
// The bindings in their groups: [{ group, rows: [{ keys, label, command, direction }] }].
// Two keys for one thing (Super_L, Super_R) are one row.
diff --git a/tests/test_universal_clipboard.py b/tests/test_universal_clipboard.py
new file mode 100644
index 00000000..08a57c0e
--- /dev/null
+++ b/tests/test_universal_clipboard.py
@@ -0,0 +1,87 @@
+"""Command (Super) with X, C, V and A: upstream Omarchy's universal clipboard under labwc."""
+import os
+from pathlib import Path
+import shutil
+import subprocess
+import tempfile
+import unittest
+import xml.etree.ElementTree as ET
+
+PROJECT = Path(__file__).resolve().parents[1]
+RC = PROJECT / 'desktop/shell/labwc-rc.xml'
+MIGRATION = PROJECT / 'desktop/shell/migrations/1796378339.sh'
+WTYPE = '/usr/libexec/omarchy-wtype'
+TERMINALS = ['foot', 'footclient', 'org.omarchy.terminal', 'com.mitchellh.ghostty']
+
+
+def binding(tree, key):
+ found = tree.findall("./keyboard/keybind[@key='%s']" % key)
+ assert len(found) == 1, key
+ return found[0].find('action')
+
+
+class Bindings(unittest.TestCase):
+ def setUp(self):
+ self.tree = ET.parse(RC)
+
+ def test_cut_and_select_all_send_ctrl_everywhere(self):
+ self.assertEqual(binding(self.tree, 'W-x').get('command'), WTYPE + ' -M ctrl x -m ctrl')
+ self.assertEqual(binding(self.tree, 'W-a').get('command'), WTYPE + ' -M ctrl a -m ctrl')
+
+ def test_copy_and_paste_know_the_terminals(self):
+ for key, terminal, app in (('W-c', '-M ctrl -k Insert -m ctrl', '-M ctrl c -m ctrl'),
+ ('W-v', '-M ctrl -M shift v -m shift -m ctrl', '-M ctrl v -m ctrl')):
+ action = binding(self.tree, key)
+ self.assertEqual(action.get('name'), 'If')
+ self.assertEqual([q.get('identifier') for q in action.findall('query')], TERMINALS)
+ self.assertEqual(action.find('then/action').get('command'), WTYPE + ' ' + terminal)
+ self.assertEqual(action.find('else/action').get('command'), WTYPE + ' ' + app)
+
+ def test_a_terminal_never_gets_ctrl_c(self):
+ # Ctrl+Shift+C from the virtual keyboard reaches Ghostty's shell as
+ # Ctrl+C, which stops what runs: copy there is Ctrl+Insert.
+ then = binding(self.tree, 'W-c').find('then/action').get('command')
+ self.assertNotIn(' c ', then)
+
+ def test_foot_copies_and_pastes_with_those_keys(self):
+ ini = (PROJECT / 'desktop/shell/foot/foot.ini').read_text()
+ self.assertIn('clipboard-copy=Control+Insert', ini)
+ self.assertRegex(ini, r'clipboard-paste=.*Control\+Shift\+v')
+
+
+@unittest.skipUnless(shutil.which('bash'), 'bash is required')
+class Migration(unittest.TestCase):
+ def migrate(self, text):
+ with tempfile.TemporaryDirectory() as home:
+ rc = Path(home) / '.config/labwc/rc.xml'
+ if text is not None:
+ rc.parent.mkdir(parents=True)
+ rc.write_text(text)
+ result = subprocess.run(['bash', '-euo', 'pipefail', str(MIGRATION)], capture_output=True, text=True,
+ env={'PATH': os.environ['PATH'], 'HOME': home}, timeout=30)
+ self.assertEqual(result.returncode, 0, result.stderr)
+ return rc.read_text() if rc.exists() else None
+
+ def shipped_without(self):
+ shipped = RC.read_text()
+ start = shipped.index('