Merge branch 'hook-w-arbitrary-args' into dev

This commit is contained in:
Squibid 2025-11-25 16:51:22 -05:00
commit 3f946d4f5c
Signed by: squibid
GPG key ID: BECE5684D3C4005D
5 changed files with 46 additions and 25 deletions

View file

@ -1,10 +1,10 @@
local env_conf = os.getenv("XDG_CONFIG_HOME")
if not env_conf then
env_conf = os.getenv("HOME")
if not env_conf then
error("Couldn't determine potential config directory is $HOME set?")
end
env_conf = mez.fs.joinpath(env_conf, ".config")
env_conf = os.getenv("HOME")
if not env_conf then
error("Couldn't determine potential config directory is $HOME set?")
end
env_conf = mez.fs.joinpath(env_conf, ".config")
end
mez.path.config = mez.fs.joinpath(env_conf, "mez", "init.lua")
@ -12,26 +12,34 @@ package.path = package.path..";"..mez.fs.joinpath(env_conf, "mez", "lua", "?.lua
-- this is an example
mez.input.add_keymap("alt", "a", {
press = function()
print("hello from my keymap")
end
press = function()
print("hello from my keymap")
end
})
mez.input.add_keymap("alt", "Return", {
press = function()
mez.api.spawn("foot")
end,
press = function()
mez.api.spawn("foot")
end,
})
mez.input.add_keymap("alt", "c", {
press = function ()
mez.api.close()
end
press = function ()
mez.api.close()
end
})
mez.input.add_keymap("alt", "q", {
press = function ()
mez.api.exit();
end
})
mez.input.add_keymap("alt", "v", {
press = function ()
mez.api.exit();
local view = mez.view.get_focused_id()
mez.view.set_position(view, 100, 100)
mez.view.set_size(view, 100, 100)
end
})
@ -59,7 +67,7 @@ end
-- })
mez.hook.add("ViewMapPre", {
callback = function()
print("hello world")
callback = function(v)
mez.view.set_size(v, 1000, 1000)
end
})