Formatting
parent
3000136e61
commit
55ae4430b9
|
|
@ -129,7 +129,7 @@ pub const Action = union(Key) {
|
||||||
/// Jump to a specific split.
|
/// Jump to a specific split.
|
||||||
goto_split: GotoSplit,
|
goto_split: GotoSplit,
|
||||||
|
|
||||||
/// Jump to next/previous window.
|
/// Jump to next/previous window.
|
||||||
goto_window: GotoWindow,
|
goto_window: GotoWindow,
|
||||||
|
|
||||||
/// Resize the split in the given direction.
|
/// Resize the split in the given direction.
|
||||||
|
|
|
||||||
|
|
@ -2016,40 +2016,40 @@ const Action = struct {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn gotoWindow(
|
pub fn gotoWindow(
|
||||||
direction: apprt.action.GotoWindow,
|
direction: apprt.action.GotoWindow,
|
||||||
) bool {
|
) bool {
|
||||||
const glist = gtk.Window.listToplevels();
|
const glist = gtk.Window.listToplevels();
|
||||||
defer glist.free();
|
defer glist.free();
|
||||||
|
|
||||||
const node = glist.findCustom(null, findActiveWindow);
|
const node = glist.findCustom(null, findActiveWindow);
|
||||||
|
|
||||||
const target_node = switch (direction) {
|
const target_node = switch (direction) {
|
||||||
.next => node.f_next orelse glist,
|
.next => node.f_next orelse glist,
|
||||||
.previous => node.f_prev orelse last: {
|
.previous => node.f_prev orelse last: {
|
||||||
var current = glist;
|
var current = glist;
|
||||||
while (current.f_next) |next| {
|
while (current.f_next) |next| {
|
||||||
current = next;
|
current = next;
|
||||||
}
|
}
|
||||||
break :last current;
|
break :last current;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const gtk_window: *gtk.Window = @ptrCast(@alignCast(target_node.f_data orelse return false));
|
const gtk_window: *gtk.Window = @ptrCast(@alignCast(target_node.f_data orelse return false));
|
||||||
gtk.Window.present(gtk_window);
|
gtk.Window.present(gtk_window);
|
||||||
|
|
||||||
const ghostty_window: *Window = @ptrCast(@alignCast(gtk_window));
|
const ghostty_window: *Window = @ptrCast(@alignCast(gtk_window));
|
||||||
var value = std.mem.zeroes(gobject.Value);
|
var value = std.mem.zeroes(gobject.Value);
|
||||||
defer value.unset();
|
defer value.unset();
|
||||||
_ = value.init(gobject.ext.typeFor(?*Surface));
|
_ = value.init(gobject.ext.typeFor(?*Surface));
|
||||||
ghostty_window.as(gobject.Object).getProperty("active-surface", &value);
|
ghostty_window.as(gobject.Object).getProperty("active-surface", &value);
|
||||||
|
|
||||||
const surface: ?*Surface = @ptrCast(@alignCast(value.getObject()));
|
const surface: ?*Surface = @ptrCast(@alignCast(value.getObject()));
|
||||||
if (surface) |s| {
|
if (surface) |s| {
|
||||||
s.grabFocus();
|
s.grabFocus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.warn("window has no active surface, cannot grab focus", .{});
|
log.warn("window has no active surface, cannot grab focus", .{});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -545,7 +545,6 @@ pub const Action = union(enum) {
|
||||||
/// (`previous` and `next`).
|
/// (`previous` and `next`).
|
||||||
goto_split: SplitFocusDirection,
|
goto_split: SplitFocusDirection,
|
||||||
|
|
||||||
|
|
||||||
/// Focus on either the previous window or the next one ('previous', 'next')
|
/// Focus on either the previous window or the next one ('previous', 'next')
|
||||||
goto_window: WindowDirection,
|
goto_window: WindowDirection,
|
||||||
|
|
||||||
|
|
@ -936,7 +935,7 @@ pub const Action = union(enum) {
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const WindowDirection = enum {
|
pub const WindowDirection = enum {
|
||||||
previous,
|
previous,
|
||||||
next,
|
next,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -492,7 +492,6 @@ fn actionCommands(action: Action.Key) []const Command {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
.toggle_split_zoom => comptime &.{.{
|
.toggle_split_zoom => comptime &.{.{
|
||||||
.action = .toggle_split_zoom,
|
.action = .toggle_split_zoom,
|
||||||
.title = "Toggle Split Zoom",
|
.title = "Toggle Split Zoom",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue