alt tab and odd -c no focus

This commit is contained in:
Harrison DiAmbrosio 2025-11-25 17:30:13 -05:00
parent 1729e10e1d
commit d4ab71fb35
4 changed files with 22 additions and 18 deletions

View file

@ -51,23 +51,31 @@ mez.input.add_keymap("alt", "v", {
end
})
mez.input.add_keymap("alt", "Tab", {
press = function ()
print("alt+tab")
local focused = mez.view.get_focused_id()
local all = mez.view.get_all_ids()
for _, id in ipairs(all) do
if id ~= focused then
mez.view.set_focused(id)
return
end
end
end
})
for i = 1, 12 do
mez.input.add_keymap("ctrl|alt", "XF86Switch_VT_"..i, {
press = function() mez.api.change_vt(i) end
})
end
-- mez.input.add_keymap("alt", "a", {
-- press = function()
-- print("hello from my keymap")
-- end,
-- release = function()
-- print("goodbye from my keymap")
-- end
-- })
mez.hook.add("ViewMapPre", {
callback = function(v)
mez.view.set_size(v, 1000, 1000)
mez.view.set_focused(v)
end
})

View file

@ -16,6 +16,7 @@ pub fn spawn(L: *zlua.Lua) i32 {
}
L.checkType(1, .string);
std.log.debug("GOT HERE", .{});
const cmd = L.toString(1) catch {
L.raiseErrorStr("Lua error check your config", .{});

View file

@ -29,7 +29,7 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
pub fn get_focused_id(L: *zlua.Lua) i32 {
if(server.seat.focused_view) |view| {
_ = L.pushNumber(@floatFromInt(view.id));
L.pushInteger(@intCast(view.id));
return 1;
}
@ -92,7 +92,7 @@ pub fn set_size(L: *zlua.Lua) i32 {
return 0;
}
pub fn raise_to_top(L: *zlua.Lua) i32 {
pub fn set_focused(L: *zlua.Lua) i32 {
const nargs: i32 = L.getTop();
if(nargs != 1) {
@ -110,7 +110,7 @@ pub fn raise_to_top(L: *zlua.Lua) i32 {
return 0;
}
view.?.raiseToTop();
view.?.setFocused();
return 0;
}

View file

@ -95,8 +95,7 @@ pub fn setFocused(self: *View) void {
}
}
self.raiseToTop();
self.scene_tree.node.raiseToTop();
_ = self.xdg_toplevel.setActivated(true);
const wlr_keyboard = server.seat.wlr_seat.getKeyboard() orelse return;
@ -113,10 +112,6 @@ pub fn setFocused(self: *View) void {
self.focused = true;
}
pub fn raiseToTop(self: *View) void {
self.scene_tree.node.raiseToTop();
}
pub fn setPosition(self: *View, x: i32, y: i32) void {
self.scene_tree.node.setPosition(x, y);
}