pinnacle/api/lua/example_config.lua
2023-06-30 21:34:07 -05:00

65 lines
2.4 KiB
Lua

-- SPDX-License-Identifier: MIT
-- Just like in Awesome, if you want access to Luarocks packages, this needs to be called.
-- NOTE: The loader doesn't load from the local Luarocks directory (probably in ~/.luarocks),
-- | so if you have any rocks installed with --local,
-- | you may need to add those paths to package.path and package.cpath.
-- Alternatively, you can add
-- eval $(luarocks path --bin)
-- to your shell's startup script to permanently have access to Luarocks in all your Lua files.
pcall(require, "luarocks.loader")
-- Neovim users be like:
require("pinnacle").setup(function(pinnacle)
local input = pinnacle.input -- Key and mouse binds
local client = pinnacle.client -- Window management
local process = pinnacle.process -- Process spawning
local tag = pinnacle.tag -- Tag management
-- Every key supported by xkbcommon.
-- Support for just putting in a string of a key is intended.
local keys = input.keys
-- Keybinds ----------------------------------------------------------------------
input.keybind({ "Ctrl", "Alt" }, keys.q, pinnacle.quit)
input.keybind({ "Ctrl", "Alt" }, keys.c, client.close_window)
input.keybind({ "Ctrl", "Alt" }, keys.space, client.toggle_floating)
input.keybind({ "Ctrl" }, keys.Return, function()
process.spawn("alacritty", function(stdout, stderr, exit_code, exit_msg)
-- do something with the output here; remember to check for nil!
end)
end)
input.keybind({ "Ctrl" }, keys.KEY_1, function()
process.spawn("kitty")
end)
input.keybind({ "Ctrl" }, keys.KEY_2, function()
process.spawn("foot")
end)
input.keybind({ "Ctrl" }, keys.KEY_3, function()
process.spawn("nautilus")
end)
-- Tags ---------------------------------------------------------------------------
tag.add("1", "2", "3", "4", "5")
tag.toggle("1")
input.keybind({ "Ctrl", "Shift" }, keys.KEY_1, function()
tag.toggle("1")
end)
input.keybind({ "Ctrl", "Shift" }, keys.KEY_2, function()
tag.toggle("2")
end)
input.keybind({ "Ctrl", "Shift" }, keys.KEY_3, function()
tag.toggle("3")
end)
input.keybind({ "Ctrl", "Shift" }, keys.KEY_4, function()
tag.toggle("4")
end)
input.keybind({ "Ctrl", "Shift" }, keys.KEY_5, function()
tag.toggle("5")
end)
end)