mirror of
https://github.com/MezzalunaWM/Mezzaluna.git
synced 2026-03-08 04:57:32 -04:00
alt tab and odd -c no focus
This commit is contained in:
parent
1729e10e1d
commit
d4ab71fb35
4 changed files with 22 additions and 18 deletions
|
|
@ -51,23 +51,31 @@ mez.input.add_keymap("alt", "v", {
|
||||||
end
|
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
|
for i = 1, 12 do
|
||||||
mez.input.add_keymap("ctrl|alt", "XF86Switch_VT_"..i, {
|
mez.input.add_keymap("ctrl|alt", "XF86Switch_VT_"..i, {
|
||||||
press = function() mez.api.change_vt(i) end
|
press = function() mez.api.change_vt(i) end
|
||||||
})
|
})
|
||||||
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", {
|
mez.hook.add("ViewMapPre", {
|
||||||
callback = function(v)
|
callback = function(v)
|
||||||
mez.view.set_size(v, 1000, 1000)
|
mez.view.set_size(v, 1000, 1000)
|
||||||
|
mez.view.set_focused(v)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ pub fn spawn(L: *zlua.Lua) i32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
L.checkType(1, .string);
|
L.checkType(1, .string);
|
||||||
|
std.log.debug("GOT HERE", .{});
|
||||||
|
|
||||||
const cmd = L.toString(1) catch {
|
const cmd = L.toString(1) catch {
|
||||||
L.raiseErrorStr("Lua error check your config", .{});
|
L.raiseErrorStr("Lua error check your config", .{});
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ pub fn get_all_ids(L: *zlua.Lua) i32 {
|
||||||
|
|
||||||
pub fn get_focused_id(L: *zlua.Lua) i32 {
|
pub fn get_focused_id(L: *zlua.Lua) i32 {
|
||||||
if(server.seat.focused_view) |view| {
|
if(server.seat.focused_view) |view| {
|
||||||
_ = L.pushNumber(@floatFromInt(view.id));
|
L.pushInteger(@intCast(view.id));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -92,7 +92,7 @@ pub fn set_size(L: *zlua.Lua) i32 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn raise_to_top(L: *zlua.Lua) i32 {
|
pub fn set_focused(L: *zlua.Lua) i32 {
|
||||||
const nargs: i32 = L.getTop();
|
const nargs: i32 = L.getTop();
|
||||||
|
|
||||||
if(nargs != 1) {
|
if(nargs != 1) {
|
||||||
|
|
@ -110,7 +110,7 @@ pub fn raise_to_top(L: *zlua.Lua) i32 {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
view.?.raiseToTop();
|
view.?.setFocused();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,7 @@ pub fn setFocused(self: *View) void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.raiseToTop();
|
self.scene_tree.node.raiseToTop();
|
||||||
|
|
||||||
_ = self.xdg_toplevel.setActivated(true);
|
_ = self.xdg_toplevel.setActivated(true);
|
||||||
|
|
||||||
const wlr_keyboard = server.seat.wlr_seat.getKeyboard() orelse return;
|
const wlr_keyboard = server.seat.wlr_seat.getKeyboard() orelse return;
|
||||||
|
|
@ -113,10 +112,6 @@ pub fn setFocused(self: *View) void {
|
||||||
self.focused = true;
|
self.focused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn raiseToTop(self: *View) void {
|
|
||||||
self.scene_tree.node.raiseToTop();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn setPosition(self: *View, x: i32, y: i32) void {
|
pub fn setPosition(self: *View, x: i32, y: i32) void {
|
||||||
self.scene_tree.node.setPosition(x, y);
|
self.scene_tree.node.setPosition(x, y);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue