feat: indicate home screen focus by (un)selecting menu

This commit is contained in:
CJ van den Berg 2026-01-15 12:21:45 +01:00
parent 4a545beb99
commit 5f25c85f93
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -156,12 +156,15 @@ pub fn focus(self: *Self) void {
self.commands.register() catch @panic("home.commands.register"); self.commands.register() catch @panic("home.commands.register");
self.focused = true; self.focused = true;
command.executeName("enter_mode", command.Context.fmt(.{"home"})) catch {}; command.executeName("enter_mode", command.Context.fmt(.{"home"})) catch {};
if (self.menu.selected == null)
self.menu.select_down();
} }
pub fn unfocus(self: *Self) void { pub fn unfocus(self: *Self) void {
if (self.focused) self.commands.unregister(); if (self.focused) self.commands.unregister();
self.focused = false; self.focused = false;
command.executeName("enter_mode_default", .{}) catch {}; command.executeName("enter_mode_default", .{}) catch {};
self.menu.selected = null;
} }
fn add_menu_command(self: *Self, command_name: []const u8, description: []const u8, hint: []const u8, menu: anytype) !void { fn add_menu_command(self: *Self, command_name: []const u8, description: []const u8, hint: []const u8, menu: anytype) !void {