Merge pull request #30 from Ottatop/dev

Fix config crash when doing window stuff with no windows
This commit is contained in:
Ottatop 2023-07-21 22:01:30 -05:00 committed by GitHub
commit eb962323ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -163,35 +163,36 @@ require("pinnacle").setup(function(pinnacle)
tag.toggle("5") tag.toggle("5")
end) end)
-- I check for nil this way because I don't want stylua to take up like 80 lines on `if win ~= nil`
input.keybind({ mod_key, "Alt" }, keys.KEY_1, function() input.keybind({ mod_key, "Alt" }, keys.KEY_1, function()
window.get_focused():move_to_tag("1") local _ = window.get_focused() and window:get_focused():move_to_tag("1")
end) end)
input.keybind({ mod_key, "Alt" }, keys.KEY_2, function() input.keybind({ mod_key, "Alt" }, keys.KEY_2, function()
window.get_focused():move_to_tag("2") local _ = window.get_focused() and window:get_focused():move_to_tag("2")
end) end)
input.keybind({ mod_key, "Alt" }, keys.KEY_3, function() input.keybind({ mod_key, "Alt" }, keys.KEY_3, function()
window.get_focused():move_to_tag("3") local _ = window.get_focused() and window:get_focused():move_to_tag("3")
end) end)
input.keybind({ mod_key, "Alt" }, keys.KEY_4, function() input.keybind({ mod_key, "Alt" }, keys.KEY_4, function()
window.get_focused():move_to_tag("4") local _ = window.get_focused() and window:get_focused():move_to_tag("4")
end) end)
input.keybind({ mod_key, "Alt" }, keys.KEY_5, function() input.keybind({ mod_key, "Alt" }, keys.KEY_5, function()
window.get_focused():move_to_tag("5") local _ = window.get_focused() and window:get_focused():move_to_tag("5")
end) end)
input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_1, function() input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_1, function()
window.get_focused():toggle_tag("1") local _ = window.get_focused() and window.get_focused():toggle_tag("1")
end) end)
input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_2, function() input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_2, function()
window.get_focused():toggle_tag("2") local _ = window.get_focused() and window.get_focused():toggle_tag("2")
end) end)
input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_3, function() input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_3, function()
window.get_focused():toggle_tag("3") local _ = window.get_focused() and window.get_focused():toggle_tag("3")
end) end)
input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_4, function() input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_4, function()
window.get_focused():toggle_tag("4") local _ = window.get_focused() and window.get_focused():toggle_tag("4")
end) end)
input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_5, function() input.keybind({ mod_key, "Shift", "Alt" }, keys.KEY_5, function()
window.get_focused():toggle_tag("5") local _ = window.get_focused() and window.get_focused():toggle_tag("5")
end) end)
end) end)