mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
Modify cmd+9 behaviour (#3587)
Fixes #3528 **Note:** Not sure if this is what OP requested regarding displaying user defined shortcuts as hints, but we currently relabel all tabs, but only consider labels for tabs from 1 to 9. Applying this simple patch should allow for displaying shortcut hints for tabs beyond 9 <details><summary>Patch</summary> ```diff diff --git a/macos/Sources/Features/Terminal/TerminalController.swift b/macos/Sources/Features/Terminal/TerminalController.swift index 7fd1802d..242e5711 100644 --- a/macos/Sources/Features/Terminal/TerminalController.swift +++ b/macos/Sources/Features/Terminal/TerminalController.swift @@ -155,13 +155,6 @@ class TerminalController: BaseTerminalController { tabListenForFrame = windows.count > 1 for (tab, window) in zip(1..., windows) { - // We need to clear any windows beyond this because they have had - // a keyEquivalent set previously. - guard tab <= 9 else { - window.keyEquivalent = "" - continue - } - let action = "goto_tab:\(tab)" if let equiv = ghostty.config.keyEquivalent(for: action) { window.keyEquivalent = "\(equiv)" ``` </details>
This commit is contained in:
@ -2303,18 +2303,18 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
// On macOS we default to super but everywhere else
|
||||||
|
// is alt.
|
||||||
|
const mods: inputpkg.Mods = if (builtin.target.isDarwin())
|
||||||
|
.{ .super = true }
|
||||||
|
else
|
||||||
|
.{ .alt = true };
|
||||||
|
|
||||||
// Cmd+N for goto tab N
|
// Cmd+N for goto tab N
|
||||||
const start = @intFromEnum(inputpkg.Key.one);
|
const start = @intFromEnum(inputpkg.Key.one);
|
||||||
const end = @intFromEnum(inputpkg.Key.nine);
|
const end = @intFromEnum(inputpkg.Key.eight);
|
||||||
var i: usize = start;
|
var i: usize = start;
|
||||||
while (i <= end) : (i += 1) {
|
while (i <= end) : (i += 1) {
|
||||||
// On macOS we default to super but everywhere else
|
|
||||||
// is alt.
|
|
||||||
const mods: inputpkg.Mods = if (builtin.target.isDarwin())
|
|
||||||
.{ .super = true }
|
|
||||||
else
|
|
||||||
.{ .alt = true };
|
|
||||||
|
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{
|
.{
|
||||||
@ -2333,6 +2333,17 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
|||||||
.{ .goto_tab = (i - start) + 1 },
|
.{ .goto_tab = (i - start) + 1 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
try result.keybind.set.put(
|
||||||
|
alloc,
|
||||||
|
.{
|
||||||
|
.key = if (comptime builtin.target.isDarwin())
|
||||||
|
.{ .physical = .nine }
|
||||||
|
else
|
||||||
|
.{ .translated = .nine },
|
||||||
|
.mods = mods,
|
||||||
|
},
|
||||||
|
.{ .last_tab = {} },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Toggle fullscreen
|
// Toggle fullscreen
|
||||||
@ -2437,11 +2448,6 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
|||||||
.{ .key = .{ .translated = .right_bracket }, .mods = .{ .super = true, .shift = true } },
|
.{ .key = .{ .translated = .right_bracket }, .mods = .{ .super = true, .shift = true } },
|
||||||
.{ .next_tab = {} },
|
.{ .next_tab = {} },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
|
||||||
alloc,
|
|
||||||
.{ .key = .{ .physical = inputpkg.Key.zero }, .mods = .{ .super = true } },
|
|
||||||
.{ .last_tab = {} },
|
|
||||||
);
|
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .d }, .mods = .{ .super = true } },
|
.{ .key = .{ .translated = .d }, .mods = .{ .super = true } },
|
||||||
|
Reference in New Issue
Block a user