From 5193082cf50333ffce956f1a6bb4fca1fbdf3b6f Mon Sep 17 00:00:00 2001 From: Seaotatop Date: Wed, 21 Jun 2023 18:03:27 -0500 Subject: [PATCH] Add comments --- api/lua/example_config.lua | 10 ++++++++++ api/lua/input.lua | 6 +++--- api/lua/pinnacle.lua | 6 ++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/api/lua/example_config.lua b/api/lua/example_config.lua index 343fcf1..8723fdf 100644 --- a/api/lua/example_config.lua +++ b/api/lua/example_config.lua @@ -1,3 +1,13 @@ +-- 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 diff --git a/api/lua/input.lua b/api/lua/input.lua index a9cbb3f..ed8862f 100644 --- a/api/lua/input.lua +++ b/api/lua/input.lua @@ -1,4 +1,4 @@ -local M = { +local input = { keys = require("keys"), } @@ -6,7 +6,7 @@ local M = { ---@param key Keys The key for the keybind. NOTE: uppercase and lowercase characters are considered different. ---@param modifiers Modifiers[] Which modifiers need to be pressed for the keybind to trigger. ---@param action fun() What to run. -function M.keybind(modifiers, key, action) +function input.keybind(modifiers, key, action) table.insert(CallbackTable, action) SendMsg({ SetKeybind = { @@ -17,4 +17,4 @@ function M.keybind(modifiers, key, action) }) end -return M +return input diff --git a/api/lua/pinnacle.lua b/api/lua/pinnacle.lua index 91bb76c..6e354c6 100644 --- a/api/lua/pinnacle.lua +++ b/api/lua/pinnacle.lua @@ -40,9 +40,15 @@ local function read_exact(socket_fd, count) end ---@class Pinnacle +---The main Pinnacle table, where all of the config options come from. +--- +---While you *can* import the fields directly, all config must be in the `setup` function, so you might as well just use the provided table. The ability to directly `require` fields may be dropped in the future. local pinnacle = { + ---Key and mouse binds input = require("input"), + ---Window management client = require("client"), + ---Process spawning process = require("process"), }