Skip to content

Commit f1c37fb

Browse files
dortortclaude
andcommitted
feat(browser): add Cmd+Shift+Click to toggle terminal link destination
Cmd+Click opens links using the default destination per the "Open Terminal Links in cmux Browser" setting. Cmd+Shift+Click opens in the opposite browser, giving users quick access to both without changing the setting. - Read shift state in OPEN_URL handler and XOR with setting - Update setting subtitle to explain the Cmd+Shift shortcut - Update all xcstrings translations (marked needs_review) - Update ghostty submodule for shift-aware link detection Closes #719 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 9bb2816 commit f1c37fb

4 files changed

Lines changed: 45 additions & 38 deletions

File tree

Resources/Localizable.xcstrings

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -51292,109 +51292,109 @@
5129251292
"en": {
5129351293
"stringUnit": {
5129451294
"state": "translated",
51295-
"value": "When off, links clicked in terminal output open in your default browser."
51295+
"value": "Sets the default for Cmd+Click. Cmd+Shift+Click opens in the other browser."
5129651296
}
5129751297
},
5129851298
"ja": {
5129951299
"stringUnit": {
51300-
"state": "translated",
51301-
"value": "オフの場合、ターミナル出力のリンクはデフォルトブラウザで開きます。"
51300+
"state": "needs_review",
51301+
"value": "Cmd+Click のデフォルトを設定します。Cmd+Shift+Click でもう一方のブラウザで開きます。"
5130251302
}
5130351303
},
5130451304
"zh-Hans": {
5130551305
"stringUnit": {
51306-
"state": "translated",
51307-
"value": "关闭后,终端输出中点击的链接在默认浏览器中打开。"
51306+
"state": "needs_review",
51307+
"value": "设置 Cmd+Click 的默认行为。Cmd+Shift+Click 在另一个浏览器中打开。"
5130851308
}
5130951309
},
5131051310
"zh-Hant": {
5131151311
"stringUnit": {
51312-
"state": "translated",
51313-
"value": "關閉時,終端機輸出中點擊的連結會在您的預設瀏覽器中開啟。"
51312+
"state": "needs_review",
51313+
"value": "設定 Cmd+Click 的預設行為。Cmd+Shift+Click 會在另一個瀏覽器中開啟。"
5131451314
}
5131551315
},
5131651316
"ko": {
5131751317
"stringUnit": {
51318-
"state": "translated",
51319-
"value": "비활성화하면 터미널 출력에서 클릭한 링크가 기본 브라우저에서 열립니다."
51318+
"state": "needs_review",
51319+
"value": "Cmd+Click의 기본 동작을 설정합니다. Cmd+Shift+Click으로 다른 브라우저에서 엽니다."
5132051320
}
5132151321
},
5132251322
"de": {
5132351323
"stringUnit": {
51324-
"state": "translated",
51325-
"value": "Wenn deaktiviert, werden im Terminal angeklickte Links in Ihrem Standardbrowser geöffnet."
51324+
"state": "needs_review",
51325+
"value": "Legt die Standardaktion für Cmd+Klick fest. Cmd+Shift+Klick öffnet im anderen Browser."
5132651326
}
5132751327
},
5132851328
"es": {
5132951329
"stringUnit": {
51330-
"state": "translated",
51331-
"value": "Cuando está desactivado, los enlaces en la salida del terminal se abren en tu navegador predeterminado."
51330+
"state": "needs_review",
51331+
"value": "Configura la acción predeterminada de Cmd+Clic. Cmd+Shift+Clic abre en el otro navegador."
5133251332
}
5133351333
},
5133451334
"fr": {
5133551335
"stringUnit": {
51336-
"state": "translated",
51337-
"value": "Lorsque désactivé, les liens cliqués dans la sortie du terminal s'ouvrent dans votre navigateur par défaut."
51336+
"state": "needs_review",
51337+
"value": "Définit l'action par défaut de Cmd+Clic. Cmd+Shift+Clic ouvre dans l'autre navigateur."
5133851338
}
5133951339
},
5134051340
"it": {
5134151341
"stringUnit": {
51342-
"state": "translated",
51343-
"value": "Quando disattivato, i link cliccati nell'output del terminale si aprono nel browser predefinito."
51342+
"state": "needs_review",
51343+
"value": "Imposta l'azione predefinita per Cmd+Clic. Cmd+Shift+Clic apre nell'altro browser."
5134451344
}
5134551345
},
5134651346
"da": {
5134751347
"stringUnit": {
51348-
"state": "translated",
51349-
"value": "Når deaktiveret, åbnes links, der klikkes i terminaloutput, i din standardbrowser."
51348+
"state": "needs_review",
51349+
"value": "Indstiller standardhandlingen for Cmd+Klik. Cmd+Shift+Klik åbner i den anden browser."
5135051350
}
5135151351
},
5135251352
"pl": {
5135351353
"stringUnit": {
51354-
"state": "translated",
51355-
"value": "Po wyłączeniu linki kliknięte w terminalu otwierają się w domyślnej przeglądarce."
51354+
"state": "needs_review",
51355+
"value": "Ustawia domyślną akcję Cmd+Klik. Cmd+Shift+Klik otwiera w drugiej przeglądarce."
5135651356
}
5135751357
},
5135851358
"ru": {
5135951359
"stringUnit": {
51360-
"state": "translated",
51361-
"value": "При отключении ссылки из терминала открываются в браузере по умолчанию."
51360+
"state": "needs_review",
51361+
"value": "Задаёт действие по умолчанию для Cmd+Click. Cmd+Shift+Click открывает в другом браузере."
5136251362
}
5136351363
},
5136451364
"bs": {
5136551365
"stringUnit": {
51366-
"state": "translated",
51367-
"value": "Kada je isključeno, linkovi kliknuti u izlazu terminala se otvaraju u podrazumijevanom pregledniku."
51366+
"state": "needs_review",
51367+
"value": "Postavlja zadanu radnju za Cmd+Klik. Cmd+Shift+Klik otvara u drugom pregledniku."
5136851368
}
5136951369
},
5137051370
"ar": {
5137151371
"stringUnit": {
51372-
"state": "translated",
51373-
"value": "عند التعطيل، تفتح الروابط المنقورة في مخرجات الطرفية في متصفحك الافتراضي."
51372+
"state": "needs_review",
51373+
"value": "يحدد الإجراء الافتراضي لـ Cmd+النقر. Cmd+Shift+النقر يفتح في المتصفح الآخر."
5137451374
}
5137551375
},
5137651376
"nb": {
5137751377
"stringUnit": {
51378-
"state": "translated",
51379-
"value": "Når av, åpnes lenker som klikkes i terminalutdata i standard nettleser."
51378+
"state": "needs_review",
51379+
"value": "Angir standardhandlingen for Cmd+Klikk. Cmd+Shift+Klikk åpner i den andre nettleseren."
5138051380
}
5138151381
},
5138251382
"pt-BR": {
5138351383
"stringUnit": {
51384-
"state": "translated",
51385-
"value": "Quando desativado, links clicados na saída do terminal abrem no seu navegador padrão."
51384+
"state": "needs_review",
51385+
"value": "Define a ação padrão do Cmd+Clique. Cmd+Shift+Clique abre no outro navegador."
5138651386
}
5138751387
},
5138851388
"th": {
5138951389
"stringUnit": {
51390-
"state": "translated",
51391-
"value": "เมื่อปิด ลิงก์ที่คลิกในเอาต์พุตเทอร์มินัลจะเปิดในเบราว์เซอร์เริ่มต้นของคุณ"
51390+
"state": "needs_review",
51391+
"value": "ตั้งค่าเริ่มต้นสำหรับ Cmd+Click Cmd+Shift+Click เปิดในเบราว์เซอร์อื่น"
5139251392
}
5139351393
},
5139451394
"tr": {
5139551395
"stringUnit": {
51396-
"state": "translated",
51397-
"value": "Kapalıyken, terminal çıktısında tıklanan bağlantılar varsayılan tarayıcınızda açılır."
51396+
"state": "needs_review",
51397+
"value": "Cmd+Tıklama için varsayılan eylemi belirler. Cmd+Shift+Tıklama diğer tarayıcıda açar."
5139851398
}
5139951399
}
5140051400
}

Sources/GhosttyTerminalView.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2307,7 +2307,14 @@ class GhosttyApp {
23072307
#endif
23082308
return false
23092309
}
2310-
if !BrowserLinkOpenSettings.openTerminalLinksInCmuxBrowser() {
2310+
let shiftHeld = performOnMain {
2311+
NSApp.currentEvent?.modifierFlags.contains(.shift) == true
2312+
}
2313+
let useCmuxBrowser = shiftHeld != BrowserLinkOpenSettings.openTerminalLinksInCmuxBrowser()
2314+
#if DEBUG
2315+
dlog("link.openURL shiftHeld=\(shiftHeld) useCmuxBrowser=\(useCmuxBrowser)")
2316+
#endif
2317+
if !useCmuxBrowser {
23112318
#if DEBUG
23122319
dlog("link.openURL cmuxBrowser=disabled, opening externally url=\(target.url)")
23132320
#endif

Sources/cmuxApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4080,7 +4080,7 @@ struct SettingsView: View {
40804080

40814081
SettingsCardRow(
40824082
String(localized: "settings.browser.openTerminalLinks", defaultValue: "Open Terminal Links in cmux Browser"),
4083-
subtitle: String(localized: "settings.browser.openTerminalLinks.subtitle", defaultValue: "When off, links clicked in terminal output open in your default browser.")
4083+
subtitle: String(localized: "settings.browser.openTerminalLinks.subtitle", defaultValue: "Sets the default for Cmd+Click. Cmd+Shift+Click opens in the other browser.")
40844084
) {
40854085
Toggle("", isOn: $openTerminalLinksInCmuxBrowser)
40864086
.labelsHidden()

0 commit comments

Comments
 (0)