mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
macos: stylistic changes
This commit is contained in:
@ -189,7 +189,7 @@ class PrimaryWindowManager {
|
|||||||
for (index, window) in windows.enumerated().prefix(9) {
|
for (index, window) in windows.enumerated().prefix(9) {
|
||||||
let action = "goto_tab:\(index + 1)"
|
let action = "goto_tab:\(index + 1)"
|
||||||
let trigger = ghostty_config_trigger(cfg, action, UInt(action.count))
|
let trigger = ghostty_config_trigger(cfg, action, UInt(action.count))
|
||||||
guard let equiv = Ghostty.keyEquivalent(key: trigger.key, mods: trigger.mods) else {
|
guard let equiv = Ghostty.keyEquivalentLabel(key: trigger.key, mods: trigger.mods) else {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,24 +7,17 @@ extension Ghostty {
|
|||||||
return Self.keyToEquivalent[key]
|
return Self.keyToEquivalent[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
static func keyEquivalent(key: ghostty_input_key_e, mods: ghostty_input_mods_e) -> String? {
|
/// Returns the keyEquivalent label that includes the mods.
|
||||||
|
static func keyEquivalentLabel(key: ghostty_input_key_e, mods: ghostty_input_mods_e) -> String? {
|
||||||
guard var key = Self.keyEquivalent(key: key) else { return nil }
|
guard var key = Self.keyEquivalent(key: key) else { return nil }
|
||||||
let flags = Self.eventModifierFlags(mods: mods)
|
let flags = Self.eventModifierFlags(mods: mods)
|
||||||
if flags.contains(.command) {
|
|
||||||
key = "⌘\(key)"
|
// Note: the order below matters; it matches the ordering modifiers show for
|
||||||
}
|
// macOS menu shortcut labels.
|
||||||
|
if flags.contains(.command) { key = "⌘\(key)" }
|
||||||
if flags.contains(.shift) {
|
if flags.contains(.shift) { key = "⇧\(key)" }
|
||||||
key = "⇧\(key)"
|
if flags.contains(.option) { key = "⌥\(key)" }
|
||||||
}
|
if flags.contains(.control) { key = "⌃\(key)" }
|
||||||
|
|
||||||
if flags.contains(.option) {
|
|
||||||
key = "⌥\(key)"
|
|
||||||
}
|
|
||||||
|
|
||||||
if flags.contains(.control) {
|
|
||||||
key = "⌃\(key)"
|
|
||||||
}
|
|
||||||
|
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user