Update example config

This commit is contained in:
Ottatop 2023-10-18 20:35:36 -05:00
parent 8b0d7f1427
commit 0564342a6a
2 changed files with 8 additions and 26 deletions

View file

@ -55,22 +55,12 @@ require("pinnacle").setup(function(pinnacle)
-- Keybinds ---------------------------------------------------------------------- -- Keybinds ----------------------------------------------------------------------
input.keybind({ mod_key }, keys.t, function()
output.get_by_name("lkhewtlkhtwe"):add_tags("nut", "dsa")
end)
-- mod_key + Alt + q quits the compositor -- mod_key + Alt + q quits the compositor
input.keybind({ mod_key, "Alt" }, keys.q, pinnacle.quit) input.keybind({ mod_key, "Alt" }, keys.q, pinnacle.quit)
-- mod_key + Alt + c closes the focused window -- mod_key + Alt + c closes the focused window
input.keybind({ mod_key, "Alt" }, keys.c, function() input.keybind({ mod_key, "Alt" }, keys.c, function()
-- The commented out line may crash the config process if you have no windows open. window.get_focused():close()
-- There is no nil warning here due to limitations in Lua LS type checking, so check for nil as shown below.
-- window.get_focused():close()
local win = window.get_focused()
if win ~= nil then
win:close()
end
end) end)
-- mod_key + return spawns a terminal -- mod_key + return spawns a terminal
@ -82,26 +72,17 @@ require("pinnacle").setup(function(pinnacle)
-- mod_key + Alt + Space toggle floating on the focused window -- mod_key + Alt + Space toggle floating on the focused window
input.keybind({ mod_key, "Alt" }, keys.space, function() input.keybind({ mod_key, "Alt" }, keys.space, function()
local win = window.get_focused() window.get_focused():toggle_floating()
if win ~= nil then
win:toggle_floating()
end
end) end)
-- mod_key + f toggles fullscreen on the focused window -- mod_key + f toggles fullscreen on the focused window
input.keybind({ mod_key }, keys.f, function() input.keybind({ mod_key }, keys.f, function()
local win = window.get_focused() window.get_focused():toggle_fullscreen()
if win ~= nil then
win:toggle_fullscreen()
end
end) end)
-- mod_key + m toggles maximized on the focused window -- mod_key + m toggles maximized on the focused window
input.keybind({ mod_key }, keys.m, function() input.keybind({ mod_key }, keys.m, function()
local win = window.get_focused() window.get_focused():toggle_maximized()
if win ~= nil then
win:toggle_maximized()
end
end) end)
-- Tags --------------------------------------------------------------------------- -- Tags ---------------------------------------------------------------------------
@ -165,11 +146,11 @@ require("pinnacle").setup(function(pinnacle)
end) end)
-- mod_key + Alt + 1-5 moves windows to tags -- mod_key + Alt + 1-5 moves windows to tags
input.keybind({ mod_key, "Alt" }, tag_name, function() input.keybind({ mod_key, "Alt" }, tag_name, function()
local _ = window.get_focused() and window:get_focused():move_to_tag(tag_name) window:get_focused():move_to_tag(tag_name)
end) end)
-- mod_key + Shift + Alt + 1-5 toggles tags on windows -- mod_key + Shift + Alt + 1-5 toggles tags on windows
input.keybind({ mod_key, "Shift", "Alt" }, tag_name, function() input.keybind({ mod_key, "Shift", "Alt" }, tag_name, function()
local _ = window.get_focused() and window.get_focused():toggle_tag(tag_name) window.get_focused():toggle_tag(tag_name)
end) end)
end end
end) end)

View file

@ -225,7 +225,8 @@ function window.get_by_title(title)
end end
---Get the currently focused window. ---Get the currently focused window.
---@return WindowHandle ---
---@return WindowHandle handle A handle to the currently focused window. If there are none, this returns a dummy handle that can still be used but will be ignored by the compositor.
function window.get_focused() function window.get_focused()
-- TODO: get focused on output -- TODO: get focused on output
local windows = window.get_all() local windows = window.get_all()