mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
config: bind both physical digit plus unicode digit for goto_tab
Fixes #8478 The comments explain this.
This commit is contained in:
@@ -5785,15 +5785,24 @@ pub const Keybinds = struct {
|
||||
else
|
||||
.{ .alt = true };
|
||||
|
||||
// Cmd+N for goto tab N
|
||||
// Cmd/Alt+N for goto tab N
|
||||
const start: u21 = '1';
|
||||
const end: u21 = '8';
|
||||
var i: u21 = start;
|
||||
while (i <= end) : (i += 1) {
|
||||
comptime var i: u21 = start;
|
||||
inline while (i <= end) : (i += 1) {
|
||||
// We register BOTH the physical `digit_N` key and the unicode
|
||||
// `N` key. This allows most keyboard layouts to work with
|
||||
// this shortcut. Namely, AZERTY doesn't produce unicode `N`
|
||||
// for their digit keys (they're on shifted keys on the same
|
||||
// physical keys).
|
||||
|
||||
try self.set.putFlags(
|
||||
alloc,
|
||||
.{
|
||||
.key = .{ .unicode = i },
|
||||
.key = .{ .physical = @field(
|
||||
inputpkg.Key,
|
||||
std.fmt.comptimePrint("digit_{u}", .{i}),
|
||||
) },
|
||||
.mods = mods,
|
||||
},
|
||||
.{ .goto_tab = (i - start) + 1 },
|
||||
@@ -5806,6 +5815,22 @@ pub const Keybinds = struct {
|
||||
.performable = !builtin.target.os.tag.isDarwin(),
|
||||
},
|
||||
);
|
||||
|
||||
// Important: this must be the LAST binding set so that the
|
||||
// libghostty trigger API returns this one for the action,
|
||||
// so that things like the macOS tab bar key equivalent label
|
||||
// work properly.
|
||||
try self.set.putFlags(
|
||||
alloc,
|
||||
.{
|
||||
.key = .{ .unicode = i },
|
||||
.mods = mods,
|
||||
},
|
||||
.{ .goto_tab = (i - start) + 1 },
|
||||
.{
|
||||
.performable = !builtin.target.os.tag.isDarwin(),
|
||||
},
|
||||
);
|
||||
}
|
||||
try self.set.putFlags(
|
||||
alloc,
|
||||
|
||||
Reference in New Issue
Block a user