mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-12-28 17:14:39 +00:00
apprt/gtk: handle global actions with chains
This commit is contained in:
@@ -169,13 +169,16 @@ pub const GlobalShortcuts = extern struct {
|
||||
var trigger_buf: [1024]u8 = undefined;
|
||||
var it = config.keybind.set.bindings.iterator();
|
||||
while (it.next()) |entry| {
|
||||
const leaf = switch (entry.value_ptr.*) {
|
||||
// Global shortcuts can't have leaders
|
||||
const leaf: Binding.Set.GenericLeaf = switch (entry.value_ptr.*) {
|
||||
.leader => continue,
|
||||
.leaf => |leaf| leaf,
|
||||
inline .leaf, .leaf_chained => |leaf| leaf.generic(),
|
||||
};
|
||||
if (!leaf.flags.global) continue;
|
||||
|
||||
// We only allow global keybinds that map to exactly a single
|
||||
// action for now. TODO: remove this restriction
|
||||
if (leaf.actions.len != 1) continue;
|
||||
|
||||
const trigger = if (key.xdgShortcutFromTrigger(
|
||||
&trigger_buf,
|
||||
entry.key_ptr.*,
|
||||
@@ -197,7 +200,7 @@ pub const GlobalShortcuts = extern struct {
|
||||
try priv.map.put(
|
||||
alloc,
|
||||
try alloc.dupeZ(u8, trigger),
|
||||
leaf.action,
|
||||
leaf.actions[0],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user