Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(tray): correct macOS shortcut modifier order to ⌘⌃⌥⇧Key

Louis Beaumont448b05982f06
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.lock b/screenpipe-app-tauri/src-tauri/Cargo.lock
index 0cb9e3f90..863142430 100755
--- a/screenpipe-app-tauri/src-tauri/Cargo.lock
+++ b/screenpipe-app-tauri/src-tauri/Cargo.lock
@@ -5629,7 +5629,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "screenpipe-app"
-version = "2.0.157"
+version = "2.0.161"
dependencies = [
"anyhow",
"async-stream",
diff --git a/screenpipe-app-tauri/src-tauri/src/tray.rs b/screenpipe-app-tauri/src-tauri/src/tray.rs
index 2da84f001..db59c07de 100644
--- a/screenpipe-app-tauri/src-tauri/src/tray.rs
+++ b/screenpipe-app-tauri/src-tauri/src/tray.rs
@@ -298,41 +298,44 @@ pub fn setup_tray_menu_updater(app: AppHandle, update_item: &tauri::menu::MenuIt
fn format_shortcut(shortcut: &str) -> String {
// Format shortcut for display in tray menu
- // Handle both "control" and "ctrl" variants since frontend uses "Control"
- let ctrl_symbol = if cfg!(target_os = "macos") {
- "⌃"
- } else {
- "ctrl"
- };
+ // macOS convention: ⌘ (Command) → ⌃ (Control) → ⌥ (Option) → ⇧ (Shift) → Key
+
+ let parts: Vec<&str> = shortcut.split('+').collect();
+
+ let mut has_cmd = false;
+ let mut has_ctrl = false;
+ let mut has_alt = false;
+ let mut has_shift = false;
+ let mut key = String::new();
+
+ for part in parts {
+ let lower = part.trim().to_lowercase();
+ match lower.as_str() {
+ "super" | "command" | "cmd" | "meta" => has_cmd = true,
+ "control" | "ctrl" | "commandorcontrol" => has_ctrl = true,
+ "alt" | "option" => has_alt = true,
+ "shift" => has_shift = true,
+ _ => key = part.trim().to_uppercase(),
+ }
+ }
- shortcut
- .to_lowercase()
- .replace(
- "super",
- if cfg!(target_os = "macos") {
- "⌘"
- } else {
- "win"
- },
- )
- .replace("commandorcontrol", ctrl_symbol)
- .replace("control", ctrl_symbol)
- .replace("ctrl", ctrl_symbol)
- .replace(
- "alt",
- if cfg!(target_os = "macos") {
- "⌥"
- } else {
- "alt"
- },
- )
- .replace(
- "shift",
- if cfg!(target_os = "macos") {
- "⇧"
- } else {
- "shift"
- },
- )
- .replace("+", " ")
+ if cfg!(target_os = "macos") {
+ // macOS: Use symbols in correct order (⌘⌃⌥⇧Key)
+ let mut result = String::new();
+ if has_cmd { result.push_str("⌘"); }
+ if has_ctrl { result.push_str("⌃"); }
+ if has_alt { result.push_str("⌥"); }
+ if has_shift { result.push_str("⇧"); }
+ result.push_str(&key);
+ result
+ } else {
+ // Windows/Linux: Use text with + separator
+ let mut parts_out = Vec::new();
+ if has_ctrl { parts_out.push("Ctrl"); }
+ if has_cmd { parts_out.push("Win"); }
+ if has_alt { parts_out.push("Alt"); }
+ if has_shift { parts_out.push("Shift"); }
+ parts_out.push(&key);
+ parts_out.join("+")
+ }
}