From 4202454c437d035c8270c717f76a19d661ce0be8 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Fri, 4 Aug 2023 17:01:37 -0500 Subject: [PATCH] Update docs and example config --- api/lua/doc/output.lua | 30 ++++++++++++++++++++++++++++++ api/lua/example_config.lua | 9 +++++++++ api/lua/output.lua | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 73 insertions(+), 2 deletions(-) diff --git a/api/lua/doc/output.lua b/api/lua/doc/output.lua index e6213f4..2812674 100644 --- a/api/lua/doc/output.lua +++ b/api/lua/doc/output.lua @@ -222,6 +222,13 @@ function output:set_loc(loc) end ---Set this output's location to the right of `op`. --- +--- top center bottom +--- ┌────────┬──────┐ ┌────────┐ ┌────────┐ +--- │op │self │ │op ├──────┐ │op │ +--- │ ├──────┘ │ │self │ │ ├──────┐ +--- │ │ │ ├──────┘ │ │self │ +--- └────────┘ └────────┘ └────────┴──────┘ +--- ---This will fail if `op` is an invalid output. ---@tparam Output op ---@tparam[opt="top"] string alignment One of `top`, `center`, or `bottom`. This is how you want to align the `self` output. @@ -230,6 +237,13 @@ function output:set_loc_right_of(op, alignment) end ---Set this output's location to the left of `op`. --- +--- top center bottom +--- ┌──────┬────────┐ ┌────────┐ ┌────────┐ +--- │self │op │ ┌──────┤op │ │op │ +--- └──────┤ │ │self │ │ ┌──────┤ │ +--- │ │ └──────┤ │ │self │ │ +--- └────────┘ └────────┘ └──────┴────────┘ +--- ---This will fail if `op` is an invalid output. ---@tparam Output op ---@tparam[opt="top"] string alignment One of `top`, `center`, or `bottom`. This is how you want to align the `self` output. @@ -238,6 +252,14 @@ function output:set_loc_left_of(op, alignment) end ---Set this output's location to the top of `op`. --- +--- left center right +--- ┌──────┐ ┌──────┐ ┌──────┐ +--- │self │ │self │ │self │ +--- ├──────┴─┐ ┌┴──────┴┐ ┌─┴──────┤ +--- │op │ │op │ │op │ +--- │ │ │ │ │ │ +--- └────────┘ └────────┘ └────────┘ +--- ---This will fail if `op` is an invalid output. ---@tparam Output op ---@tparam[opt="left"] string alignment One of `left`, `center`, or `right`. This is how you want to align the `self` output. @@ -246,6 +268,14 @@ function output:set_loc_top_of(op, alignment) end ---Set this output's location to the bottom of `op`. --- +--- ┌────────┐ ┌────────┐ ┌────────┐ +--- │op │ │op │ │op │ +--- │ │ │ │ │ │ +--- ├──────┬─┘ └┬──────┬┘ └─┬──────┤ +--- │self │ │self │ │self │ +--- └──────┘ └──────┘ └──────┘ +--- left center right +--- ---This will fail if `op` is an invalid output. ---@tparam Output op ---@tparam[opt="left"] string alignment One of `left`, `center`, or `right`. This is how you want to align the `self` output. diff --git a/api/lua/example_config.lua b/api/lua/example_config.lua index ad29b3a..e2ceae7 100644 --- a/api/lua/example_config.lua +++ b/api/lua/example_config.lua @@ -27,6 +27,15 @@ require("pinnacle").setup(function(pinnacle) local terminal = "alacritty" + -- Outputs ----------------------------------------------------------------------- + + -- You can set your own monitor layout as I have done below for my monitors. + + -- local lg = output.get_by_name("DP-2") --[[@as Output]] + -- local dell = output.get_by_name("DP-3") --[[@as Output]] + -- + -- dell:set_loc_left_of(lg, "bottom") + -- Keybinds ---------------------------------------------------------------------- input.keybind({ mod_key, "Alt" }, keys.q, pinnacle.quit) diff --git a/api/lua/output.lua b/api/lua/output.lua index 0004d8d..8bbdc39 100644 --- a/api/lua/output.lua +++ b/api/lua/output.lua @@ -175,6 +175,14 @@ end ---Set this output's location to the right of the specified output. --- +---``` +--- top center bottom +--- ┌────────┬──────┐ ┌────────┐ ┌────────┐ +--- │op │self │ │op ├──────┐ │op │ +--- │ ├──────┘ │ │self │ │ ├──────┐ +--- │ │ │ ├──────┘ │ │self │ +--- └────────┘ └────────┘ └────────┴──────┘ +---``` ---This will fail if `op` is an invalid output. ---@param op Output ---@param alignment AlignmentVertical? How you want to align the `self` output. Defaults to `top`. @@ -185,6 +193,14 @@ end ---Set this output's location to the left of the specified output. --- +---``` +--- top center bottom +--- ┌──────┬────────┐ ┌────────┐ ┌────────┐ +--- │self │op │ ┌──────┤op │ │op │ +--- └──────┤ │ │self │ │ ┌──────┤ │ +--- │ │ └──────┤ │ │self │ │ +--- └────────┘ └────────┘ └──────┴────────┘ +---``` ---This will fail if `op` is an invalid output. ---@param op Output ---@param alignment AlignmentVertical? How you want to align the `self` output. Defaults to `top`. @@ -238,6 +254,15 @@ end ---Set this output's location to the top of the specified output. --- +---``` +--- left center right +--- ┌──────┐ ┌──────┐ ┌──────┐ +--- │self │ │self │ │self │ +--- ├──────┴─┐ ┌┴──────┴┐ ┌─┴──────┤ +--- │op │ │op │ │op │ +--- │ │ │ │ │ │ +--- └────────┘ └────────┘ └────────┘ +---``` ---This will fail if `op` is an invalid output. ---@param op Output ---@param alignment AlignmentHorizontal? How you want to align the `self` output. Defaults to `left`. @@ -248,6 +273,15 @@ end ---Set this output's location to the bottom of the specified output. --- +---``` +--- ┌────────┐ ┌────────┐ ┌────────┐ +--- │op │ │op │ │op │ +--- │ │ │ │ │ │ +--- ├──────┬─┘ └┬──────┬┘ └─┬──────┤ +--- │self │ │self │ │self │ +--- └──────┘ └──────┘ └──────┘ +--- left center right +---``` ---This will fail if `op` is an invalid output. ---@param op Output ---@param alignment AlignmentHorizontal? How you want to align the `self` output. Defaults to `left`. @@ -256,8 +290,6 @@ function output:set_loc_bottom_of(op, alignment) set_loc_vertical(self, op, "bottom", alignment) end --- TODO: ---------------------------------------------------------------------------------- - ------------------------------------------------------ ---Get an output by its name.