mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
Merge pull request #2413 from ghostty-org/push-zzplrqptxorm
macos: remove the ability to bind fn/globe
This commit is contained in:
@ -88,13 +88,12 @@ typedef enum {
|
|||||||
GHOSTTY_MODS_CTRL = 1 << 1,
|
GHOSTTY_MODS_CTRL = 1 << 1,
|
||||||
GHOSTTY_MODS_ALT = 1 << 2,
|
GHOSTTY_MODS_ALT = 1 << 2,
|
||||||
GHOSTTY_MODS_SUPER = 1 << 3,
|
GHOSTTY_MODS_SUPER = 1 << 3,
|
||||||
GHOSTTY_MODS_FN = 1 << 4,
|
GHOSTTY_MODS_CAPS = 1 << 4,
|
||||||
GHOSTTY_MODS_CAPS = 1 << 5,
|
GHOSTTY_MODS_NUM = 1 << 5,
|
||||||
GHOSTTY_MODS_NUM = 1 << 6,
|
GHOSTTY_MODS_SHIFT_RIGHT = 1 << 6,
|
||||||
GHOSTTY_MODS_SHIFT_RIGHT = 1 << 7,
|
GHOSTTY_MODS_CTRL_RIGHT = 1 << 7,
|
||||||
GHOSTTY_MODS_CTRL_RIGHT = 1 << 8,
|
GHOSTTY_MODS_ALT_RIGHT = 1 << 8,
|
||||||
GHOSTTY_MODS_ALT_RIGHT = 1 << 9,
|
GHOSTTY_MODS_SUPER_RIGHT = 1 << 9,
|
||||||
GHOSTTY_MODS_SUPER_RIGHT = 1 << 10,
|
|
||||||
} ghostty_input_mods_e;
|
} ghostty_input_mods_e;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -354,11 +354,6 @@ class AppDelegate: NSObject,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (equiv.modifiers.contains(.function)) {
|
|
||||||
// NSMenuItem key equivalent cannot contain function modifiers.
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
menu.keyEquivalent = equiv.key
|
menu.keyEquivalent = equiv.key
|
||||||
menu.keyEquivalentModifierMask = equiv.modifiers
|
menu.keyEquivalentModifierMask = equiv.modifiers
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,6 @@ extension Ghostty {
|
|||||||
if (mods.rawValue & GHOSTTY_MODS_CTRL.rawValue != 0) { flags.insert(.control) }
|
if (mods.rawValue & GHOSTTY_MODS_CTRL.rawValue != 0) { flags.insert(.control) }
|
||||||
if (mods.rawValue & GHOSTTY_MODS_ALT.rawValue != 0) { flags.insert(.option) }
|
if (mods.rawValue & GHOSTTY_MODS_ALT.rawValue != 0) { flags.insert(.option) }
|
||||||
if (mods.rawValue & GHOSTTY_MODS_SUPER.rawValue != 0) { flags.insert(.command) }
|
if (mods.rawValue & GHOSTTY_MODS_SUPER.rawValue != 0) { flags.insert(.command) }
|
||||||
if (mods.rawValue & GHOSTTY_MODS_FN.rawValue != 0) { flags.insert(.function) }
|
|
||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,7 +25,6 @@ extension Ghostty {
|
|||||||
if (flags.contains(.control)) { mods |= GHOSTTY_MODS_CTRL.rawValue }
|
if (flags.contains(.control)) { mods |= GHOSTTY_MODS_CTRL.rawValue }
|
||||||
if (flags.contains(.option)) { mods |= GHOSTTY_MODS_ALT.rawValue }
|
if (flags.contains(.option)) { mods |= GHOSTTY_MODS_ALT.rawValue }
|
||||||
if (flags.contains(.command)) { mods |= GHOSTTY_MODS_SUPER.rawValue }
|
if (flags.contains(.command)) { mods |= GHOSTTY_MODS_SUPER.rawValue }
|
||||||
if (flags.contains(.function)) { mods |= GHOSTTY_MODS_FN.rawValue }
|
|
||||||
if (flags.contains(.capsLock)) { mods |= GHOSTTY_MODS_CAPS.rawValue }
|
if (flags.contains(.capsLock)) { mods |= GHOSTTY_MODS_CAPS.rawValue }
|
||||||
|
|
||||||
// Handle sided input. We can't tell that both are pressed in the
|
// Handle sided input. We can't tell that both are pressed in the
|
||||||
|
@ -743,7 +743,6 @@ extension Ghostty {
|
|||||||
case 0x3B, 0x3E: mod = GHOSTTY_MODS_CTRL.rawValue
|
case 0x3B, 0x3E: mod = GHOSTTY_MODS_CTRL.rawValue
|
||||||
case 0x3A, 0x3D: mod = GHOSTTY_MODS_ALT.rawValue
|
case 0x3A, 0x3D: mod = GHOSTTY_MODS_ALT.rawValue
|
||||||
case 0x37, 0x36: mod = GHOSTTY_MODS_SUPER.rawValue
|
case 0x37, 0x36: mod = GHOSTTY_MODS_SUPER.rawValue
|
||||||
case 0x3F: mod = GHOSTTY_MODS_FN.rawValue
|
|
||||||
default: return
|
default: return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,6 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
|||||||
const ctrl_style: vaxis.Style = .{ .fg = .{ .index = 2 } };
|
const ctrl_style: vaxis.Style = .{ .fg = .{ .index = 2 } };
|
||||||
const alt_style: vaxis.Style = .{ .fg = .{ .index = 3 } };
|
const alt_style: vaxis.Style = .{ .fg = .{ .index = 3 } };
|
||||||
const shift_style: vaxis.Style = .{ .fg = .{ .index = 4 } };
|
const shift_style: vaxis.Style = .{ .fg = .{ .index = 4 } };
|
||||||
const fn_style: vaxis.Style = .{ .fg = .{ .index = 5 } };
|
|
||||||
|
|
||||||
var longest_col: usize = 0;
|
var longest_col: usize = 0;
|
||||||
|
|
||||||
@ -143,10 +142,6 @@ fn prettyPrint(alloc: Allocator, keybinds: Config.Keybinds) !u8 {
|
|||||||
|
|
||||||
var result: vaxis.Window.PrintResult = .{ .col = 0, .row = 0, .overflow = false };
|
var result: vaxis.Window.PrintResult = .{ .col = 0, .row = 0, .overflow = false };
|
||||||
const trigger = bind.trigger;
|
const trigger = bind.trigger;
|
||||||
if (trigger.mods.function) {
|
|
||||||
result = try win.printSegment(.{ .text = "fn ", .style = fn_style }, .{ .col_offset = result.col });
|
|
||||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
|
||||||
}
|
|
||||||
if (trigger.mods.super) {
|
if (trigger.mods.super) {
|
||||||
result = try win.printSegment(.{ .text = "super", .style = super_style }, .{ .col_offset = result.col });
|
result = try win.printSegment(.{ .text = "super", .style = super_style }, .{ .col_offset = result.col });
|
||||||
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
result = try win.printSegment(.{ .text = " + " }, .{ .col_offset = result.col });
|
||||||
|
@ -670,22 +670,13 @@ class: ?[:0]const u8 = null,
|
|||||||
/// translated by any system keyboard layouts. Example: "ctrl+physical:a"
|
/// translated by any system keyboard layouts. Example: "ctrl+physical:a"
|
||||||
///
|
///
|
||||||
/// Valid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`,
|
/// Valid modifiers are `shift`, `ctrl` (alias: `control`), `alt` (alias: `opt`,
|
||||||
/// `option`), `super` (alias: `cmd`, `command`), and `function` (alias: `fn`,
|
/// `option`), and `super` (alias: `cmd`, `command`). You may use the modifier
|
||||||
/// `globe`). You may use the modifier or the alias. When debugging keybinds,
|
/// or the alias. When debugging keybinds, the non-aliased modifier will always
|
||||||
/// the non-aliased modifier will always be used in output.
|
/// be used in output.
|
||||||
///
|
///
|
||||||
/// Some notes about the `function` modifier:
|
/// Note that the fn or "globe" key on keyboards are not supported as a
|
||||||
///
|
/// modifier. This is a limitation of the operating systems and GUI toolkits
|
||||||
/// * It is only available on macOS.
|
/// that Ghostty uses.
|
||||||
/// * It is used by many system shortcuts and Ghostty is not able to
|
|
||||||
/// override these shortcuts. If a system shortcut is triggered, the
|
|
||||||
/// system shortcut will take precedence.
|
|
||||||
/// * If you have multiple keyboard layouts active and don't press the
|
|
||||||
/// combination fast enough, macOS will switch to the next keyboard
|
|
||||||
/// layout.
|
|
||||||
/// * Menu items on macOS cannot be bound to the `function` modifier,
|
|
||||||
/// so this modifier will work with Ghostty but will not be visible
|
|
||||||
/// in the menu.
|
|
||||||
///
|
///
|
||||||
/// You may also specify multiple triggers separated by `>` to require a
|
/// You may also specify multiple triggers separated by `>` to require a
|
||||||
/// sequence of triggers to activate the action. For example,
|
/// sequence of triggers to activate the action. For example,
|
||||||
|
@ -901,8 +901,6 @@ pub const Trigger = struct {
|
|||||||
.{ "opt", "alt" },
|
.{ "opt", "alt" },
|
||||||
.{ "option", "alt" },
|
.{ "option", "alt" },
|
||||||
.{ "control", "ctrl" },
|
.{ "control", "ctrl" },
|
||||||
.{ "fn", "function" },
|
|
||||||
.{ "globe", "function" },
|
|
||||||
};
|
};
|
||||||
inline for (alias_mods) |pair| {
|
inline for (alias_mods) |pair| {
|
||||||
if (std.mem.eql(u8, part, pair[0])) {
|
if (std.mem.eql(u8, part, pair[0])) {
|
||||||
|
@ -35,8 +35,6 @@ pub fn encode(
|
|||||||
self: *const KeyEncoder,
|
self: *const KeyEncoder,
|
||||||
buf: []u8,
|
buf: []u8,
|
||||||
) ![]const u8 {
|
) ![]const u8 {
|
||||||
// log.debug("encode {}", .{self.*});
|
|
||||||
|
|
||||||
if (self.kitty_flags.int() != 0) return try self.kitty(buf);
|
if (self.kitty_flags.int() != 0) return try self.kitty(buf);
|
||||||
return try self.legacy(buf);
|
return try self.legacy(buf);
|
||||||
}
|
}
|
||||||
|
@ -89,11 +89,10 @@ pub const Mods = packed struct(Mods.Backing) {
|
|||||||
ctrl: bool = false,
|
ctrl: bool = false,
|
||||||
alt: bool = false,
|
alt: bool = false,
|
||||||
super: bool = false,
|
super: bool = false,
|
||||||
function: bool = false,
|
|
||||||
caps_lock: bool = false,
|
caps_lock: bool = false,
|
||||||
num_lock: bool = false,
|
num_lock: bool = false,
|
||||||
sides: side = .{},
|
sides: side = .{},
|
||||||
_padding: u5 = 0,
|
_padding: u6 = 0,
|
||||||
|
|
||||||
/// Tracks the side that is active for any given modifier. Note
|
/// Tracks the side that is active for any given modifier. Note
|
||||||
/// that this doesn't confirm a modifier is pressed; you must check
|
/// that this doesn't confirm a modifier is pressed; you must check
|
||||||
@ -131,7 +130,6 @@ pub const Mods = packed struct(Mods.Backing) {
|
|||||||
.ctrl = self.ctrl,
|
.ctrl = self.ctrl,
|
||||||
.alt = self.alt,
|
.alt = self.alt,
|
||||||
.super = self.super,
|
.super = self.super,
|
||||||
.function = self.function,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user