mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-26 21:58:10 +01:00
commit
969acf7049
16 changed files with 1288 additions and 1433 deletions
34
.github/workflows/ldoc.yml
vendored
Normal file
34
.github/workflows/ldoc.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
# From https://github.com/lunarmodules/ldoc/blob/master/.github/workflows/doc.yml
|
||||
|
||||
# Based on https://gist.github.com/domenic/ec8b0fc8ab45f39403dd
|
||||
name: Build Docs
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
build:
|
||||
name: Build docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Lua
|
||||
uses: leafo/gh-actions-lua@v8
|
||||
with:
|
||||
luaVersion: 5.4
|
||||
- name: Setup Lua Rocks
|
||||
uses: leafo/gh-actions-luarocks@v4
|
||||
- name: Setup dependencies
|
||||
run: luarocks install ldoc
|
||||
- name: Build docs
|
||||
run: cd ./api/lua/doc && ldoc . && cd ../../..
|
||||
- name: Deploy
|
||||
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./api/lua/doc/doc
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -12,3 +12,5 @@ Cargo.lock
|
|||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
api/lua/doc/doc
|
||||
|
|
1395
api/lua/doc.md
1395
api/lua/doc.md
File diff suppressed because it is too large
Load diff
7
api/lua/doc/config.ld
Normal file
7
api/lua/doc/config.ld
Normal file
|
@ -0,0 +1,7 @@
|
|||
project = "Pinnacle"
|
||||
format = "markdown"
|
||||
description = "A very, VERY WIP Smithay-based Wayland compositor"
|
||||
boilerplate = true
|
||||
multimodule = true
|
||||
no_space_before_args = true
|
||||
style = true
|
180
api/lua/doc/index.html
Normal file
180
api/lua/doc/index.html
Normal file
|
@ -0,0 +1,180 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="ldoc.css" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
|
||||
<div id="main">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>Pinnacle</h1>
|
||||
|
||||
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
<li><a href="#Fields">Fields</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><strong>ProcessModule</strong></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>ProcessModule</code></h1>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#process_module.spawn">process_module.spawn (command, callback)</a></td>
|
||||
<td class="summary">Spawn a process with an optional callback for its stdout, stderr, and exit information.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#process_module.spawn_once">process_module.spawn_once (command, callback)</a></td>
|
||||
<td class="summary">Spawn a process only if it isn't already running, with an optional callback for its stdout, stderr, and exit information.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2><a href="#Fields">Fields</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#args">args</a></td>
|
||||
<td class="summary">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "process_module.spawn"></a>
|
||||
<strong>process_module.spawn (command, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Spawn a process with an optional callback for its stdout, stderr, and exit information. </p>
|
||||
|
||||
<p><code>callback</code> has the following parameters:
|
||||
- <code>stdout</code> - The process's stdout printed this line.
|
||||
- <code>stderr</code> - The process's stderr printed this line.
|
||||
- <code>exit_code</code> - The process exited with this code.
|
||||
- <code>exit_msg</code> - The process exited with this message.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">command</span>
|
||||
string|string[] The command as one whole string or a table of each of its arguments
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
fun(stdout: string|nil, stderr: string|nil, exit<em>code: integer|nil, exit</em>msg: string|nil)? A callback to do something whenever the process's stdout or stderr print a line, or when the process exits.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "process_module.spawn_once"></a>
|
||||
<strong>process_module.spawn_once (command, callback)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Spawn a process only if it isn't already running, with an optional callback for its stdout, stderr, and exit information. </p>
|
||||
|
||||
<p><code>callback</code> has the following parameters:
|
||||
- <code>stdout</code>: The process's stdout printed this line.
|
||||
- <code>stderr</code>: The process's stderr printed this line.
|
||||
- <code>exit_code</code>: The process exited with this code.
|
||||
- <code>exit_msg</code>: The process exited with this message.</p>
|
||||
|
||||
<p><a href="index.html#process_module.spawn_once">spawn_once</a> checks for the process using <code>pgrep</code>. If your system doesn't have <code>pgrep</code>, this won't work properly.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">command</span>
|
||||
string|string[] The command as one whole string or a table of each of its arguments
|
||||
</li>
|
||||
<li><span class="parameter">callback</span>
|
||||
fun(stdout: string|nil, stderr: string|nil, exit<em>code: integer|nil, exit</em>msg: string|nil)? A callback to do something whenever the process's stdout or stderr print a line, or when the process exits.
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "args"></a>
|
||||
<strong>args</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul>
|
||||
<li><span class="parameter">args</span>
|
||||
Args
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
|
||||
<i style="float:right;">Last updated 2023-07-22 11:35:14 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
21
api/lua/doc/input.lua
Normal file
21
api/lua/doc/input.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---Input and keybinds
|
||||
---@module InputModule
|
||||
local input_module = {}
|
||||
|
||||
---Set a keybind. If called with an already existing keybind, it gets replaced.
|
||||
---
|
||||
---### Example
|
||||
--- -- Set `Super + Return` to open Alacritty
|
||||
--- input.keybind({ "Super" }, input.keys.Return, function()
|
||||
--- process.spawn("Alacritty")
|
||||
--- end)
|
||||
---@tparam Modifier[] modifiers Which modifiers need to be pressed for the keybind to trigger.
|
||||
---@tparam Keys key The key for the keybind.
|
||||
---@tparam function action What to do.
|
||||
function input_module.keybind(modifiers, key, action) end
|
320
api/lua/doc/ldoc.css
Normal file
320
api/lua/doc/ldoc.css
Normal file
|
@ -0,0 +1,320 @@
|
|||
/* BEGIN RESET
|
||||
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.com/yui/license.html
|
||||
version: 2.8.2r1
|
||||
*/
|
||||
html {
|
||||
color: #e4e4e5;
|
||||
background: #202020; /* Background of page if it doesn't fill the screen */
|
||||
}
|
||||
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
fieldset,img {
|
||||
border: 0;
|
||||
}
|
||||
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
del,ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
caption,th {
|
||||
text-align: left;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
q:before,q:after {
|
||||
content: '';
|
||||
}
|
||||
abbr,acronym {
|
||||
border: 0;
|
||||
font-variant: normal;
|
||||
}
|
||||
sup {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sub {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
legend {
|
||||
color: #000;
|
||||
}
|
||||
input,button,textarea,select,optgroup,option {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
input,button,textarea,select {*font-size:100%;
|
||||
}
|
||||
/* END RESET */
|
||||
|
||||
body { /* Body of window (makes it look like sidebars) */
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: arial, helvetica, geneva, sans-serif;
|
||||
background-color: #202020; margin: 0px;
|
||||
}
|
||||
|
||||
code, tt { font-family: "JetBrains Mono", monospace; font-size: 1em; }
|
||||
span.parameter { font-family: "JetBrains Mono", monospace; }
|
||||
span.parameter:after { content:":"; }
|
||||
span.types:before { content:"("; }
|
||||
span.types:after { content:")"; }
|
||||
.type { font-weight: bold; font-style:italic }
|
||||
|
||||
body, p, td, th { font-size: 1em; line-height: 1.2em;}
|
||||
|
||||
p, ul { margin: 10px 0 0 0px;}
|
||||
|
||||
strong { font-weight: bold;}
|
||||
|
||||
em { font-style: italic;}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
margin: 20px 0 20px 0;
|
||||
}
|
||||
h2, h3, h4 { margin: 15px 0 10px 0; }
|
||||
h2 { font-size: 1.25em; }
|
||||
h3 { font-size: 1.15em; }
|
||||
h4 { font-size: 1.06em; }
|
||||
|
||||
a:link { font-weight: bold; color: #33b1ff; text-decoration: none; }
|
||||
a:visited { font-weight: bold; color: #33b1ff; text-decoration: none; }
|
||||
a:link:hover { text-decoration: underline; }
|
||||
|
||||
hr {
|
||||
color:#cccccc;
|
||||
background: #00007f;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
blockquote { margin-left: 3em; }
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
|
||||
p.name {
|
||||
font-family: "JetBrains Mono", "Andale Mono", monospace;
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #2a2a2a;
|
||||
border: 1px solid #505050;
|
||||
padding: 10px;
|
||||
margin: 10px 0 10px 0;
|
||||
overflow: auto;
|
||||
font-family: "JetBrains Mono", "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
pre.example {
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
table.index { border: 1px #00007f; }
|
||||
table.index td { text-align: left; vertical-align: top; }
|
||||
|
||||
#container {
|
||||
/* margin-left: 1em; */
|
||||
/* margin-right: 1em; */
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#product {
|
||||
text-align: center;
|
||||
border-bottom: 0px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#product big {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #101010;
|
||||
border-left: 0px solid #cccccc;
|
||||
}
|
||||
|
||||
#navigation { /* Sidebar */
|
||||
float: left;
|
||||
width: 20%;
|
||||
vertical-align: top;
|
||||
background-color: #101010;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
#navigation h1 {
|
||||
padding: 0.2em;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#navigation h2 { /* Sidebar subheaders */
|
||||
background-color:#2a2a2a;
|
||||
font-size:1.1em;
|
||||
color:#e4e4e5;
|
||||
text-align: left;
|
||||
padding:0.2em;
|
||||
margin: 0px;
|
||||
border-top:0px solid #dddddd;
|
||||
border-bottom:0px solid #dddddd;
|
||||
}
|
||||
|
||||
#navigation ul
|
||||
{
|
||||
font-size:1em;
|
||||
list-style-type: none;
|
||||
margin: 1px 1px 10px 1px;
|
||||
}
|
||||
|
||||
#navigation li {
|
||||
text-indent: -1em;
|
||||
display: block;
|
||||
margin: 3px 0px 0px 22px;
|
||||
}
|
||||
|
||||
#navigation li li a {
|
||||
margin: 0px 3px 0px -1em;
|
||||
}
|
||||
|
||||
#content { /* Content background (the stuff with the actual docs) */
|
||||
margin-left: 20%;
|
||||
width: 80% - 32px;
|
||||
border-left: 0px solid #cccccc;
|
||||
border-right: 0px solid #cccccc;
|
||||
background-color: #202020;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
#content h1 {
|
||||
/* margin: 0%; */
|
||||
}
|
||||
|
||||
#about { /* The about footer */
|
||||
clear: both;
|
||||
/* margin: 5px; */
|
||||
border-top: 2px solid #505050;
|
||||
background-color: #202020;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#about i { /* The two text thingys in the footer */
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font: 12pt "Times New Roman", "TimeNR", Times, serif;
|
||||
}
|
||||
a { font-weight: bold; color: #004080; text-decoration: underline; }
|
||||
|
||||
#main {
|
||||
background-color: #ffffff;
|
||||
border-left: 0px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin-left: 2%;
|
||||
margin-right: 2%;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 1em;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
display: none;
|
||||
}
|
||||
pre.example {
|
||||
font-family: "JetBrains Mono", "Andale Mono", monospace;
|
||||
font-size: 10pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
table.module_list {
|
||||
border-width: 0px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.module_list td {
|
||||
border-width: 2px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #505050;
|
||||
}
|
||||
table.module_list td.name { background-color: #2a2a2a; min-width: 200px; vertical-align: top; } /* Modules/Classes Name section */
|
||||
table.module_list td.summary { background-color: #161616; width: 80%; vertical-align: top; } /* Summary section */
|
||||
|
||||
/* Same stuff but for function tables */
|
||||
table.function_list {
|
||||
border-width: 0px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.function_list td {
|
||||
border-width: 2px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #505050;
|
||||
}
|
||||
table.function_list td.name { background-color: #2a2a2a; min-width: 200px; vertical-align: top; }
|
||||
table.function_list td.summary { width: 100%; vertical-align: top; }
|
||||
|
||||
ul.nowrap {
|
||||
overflow:auto;
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
|
||||
dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;}
|
||||
dl.table h3, dl.function h3 {font-size: .95em;}
|
||||
|
||||
/* stop sublists from having initial vertical space */
|
||||
ul ul { margin-top: 0px; }
|
||||
ol ul { margin-top: 0px; }
|
||||
ol ol { margin-top: 0px; }
|
||||
ul ol { margin-top: 0px; }
|
||||
|
||||
/* make the target distinct; helps when we're navigating to a function */
|
||||
a:target + * {
|
||||
background-color: #FF9;
|
||||
}
|
||||
|
||||
|
||||
/* styles for prettification of source */
|
||||
pre .comment { color: #558817; }
|
||||
pre .constant { color: #a8660d; }
|
||||
pre .escape { color: #844631; }
|
||||
pre .keyword { color: #aa5050; font-weight: bold; }
|
||||
pre .library { color: #0e7c6b; }
|
||||
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
|
||||
pre .string { color: #8080ff; }
|
||||
pre .number { color: #f8660d; }
|
||||
pre .function-name { color: #60447f; }
|
||||
pre .operator { color: #2239a8; font-weight: bold; }
|
||||
pre .preprocessor, pre .prepro { color: #a33243; }
|
||||
pre .global { color: #800080; }
|
||||
pre .user-keyword { color: #800080; }
|
||||
pre .prompt { color: #558817; }
|
||||
pre .url { color: #272fc2; text-decoration: underline; }
|
||||
|
182
api/lua/doc/output.lua
Normal file
182
api/lua/doc/output.lua
Normal file
|
@ -0,0 +1,182 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---Output management
|
||||
---@module OutputModule
|
||||
local output_module = {}
|
||||
|
||||
---Get an output by its name.
|
||||
---
|
||||
---"Name" in this sense does not mean its model or manufacturer;
|
||||
---rather, "name" is the name of the connector the output is connected to.
|
||||
---This should be something like "HDMI-A-0", "eDP-1", or similar.
|
||||
---
|
||||
---### Example
|
||||
--- local monitor = output.get_by_name("DP-1")
|
||||
--- print(monitor.name) -- should print `DP-1`
|
||||
---@tparam string name The name of the output.
|
||||
---@treturn Output|nil output The output, or nil if none have the provided name.
|
||||
function output_module.get_by_name(name) end
|
||||
|
||||
---Note: This may or may not be what is reported by other monitor listing utilities. Pinnacle currently fails to pick up one of my monitors' models when it is correctly picked up by tools like wlr-randr. I'll fix this in the future.
|
||||
---
|
||||
---Get outputs by their model.
|
||||
---This is something like "DELL E2416H" or whatever gibberish monitor manufacturers call their displays.
|
||||
---@tparam string model The model of the output(s).
|
||||
---@treturn Output[] outputs All outputs with this model.
|
||||
function output_module.get_by_model(model) end
|
||||
|
||||
---Get outputs by their resolution.
|
||||
---
|
||||
---@tparam integer width The width of the outputs, in pixels.
|
||||
---@tparam integer height The height of the outputs, in pixels.
|
||||
---@treturn Output[] outputs All outputs with this resolution.
|
||||
function output_module.get_by_res(width, height) end
|
||||
|
||||
---Get the currently focused output. This is currently implemented as the one with the cursor on it.
|
||||
---
|
||||
---This function may return nil, which means you may get a warning if you try to use it without checking for nil.
|
||||
---Usually this function will not be nil unless you unplug all monitors, so instead of checking,
|
||||
---you can ignore the warning by either forcing the type to be non-nil with an inline comment:
|
||||
--- local op = output.get_focused() --[[@as Output]]
|
||||
---or by disabling nil check warnings for the line:
|
||||
--- local op = output.get_focused()
|
||||
--- ---@diagnostic disable-next-line:need-check-nil
|
||||
--- local tags_on_output = op:tags()
|
||||
---Type checking done by Lua LS isn't perfect.
|
||||
---Note that directly using the result of this function inline will *not* raise a warning, so be careful.
|
||||
--- local tags = output.get_focused():tags() -- will NOT warn for nil
|
||||
---@treturn Output|nil output The output, or nil if none are focused.
|
||||
function output_module.get_focused() end
|
||||
|
||||
---Connect a function to be run on all current and future outputs.
|
||||
---
|
||||
---When called, `connect_for_all` will immediately run `func` with all currently connected outputs.
|
||||
---If a new output is connected, `func` will also be called with it.
|
||||
---
|
||||
---Please note: this function will be run *after* Pinnacle processes your entire config.
|
||||
---For example, if you define tags in `func` but toggle them directly after `connect_for_all`, nothing will happen as the tags haven't been added yet.
|
||||
---@tparam function func The function that will be run. This takes an `Output` object.
|
||||
function output_module.connect_for_all(func) end
|
||||
|
||||
---Get the output the specified tag is on.
|
||||
---@tparam Tag tag
|
||||
---@treturn Output|nil
|
||||
---@see TagModule.output
|
||||
---@see Tag.output
|
||||
function output_module.get_for_tag(tag) end
|
||||
|
||||
---Get the specified output's make.
|
||||
---@tparam Output op
|
||||
---@treturn string|nil
|
||||
---@see Output.make
|
||||
function output_module.make(op) end
|
||||
|
||||
---Get the specified output's model.
|
||||
---@tparam Output op
|
||||
---@treturn string|nil
|
||||
---@see Output.model
|
||||
function output_module.model(op) end
|
||||
|
||||
---Get the specified output's location in the global space, in pixels.
|
||||
---@tparam Output op
|
||||
---@treturn table|nil { x: integer, y: integer }
|
||||
---@see Output.loc
|
||||
function output_module.loc(op) end
|
||||
|
||||
---Get the specified output's resolution in pixels.
|
||||
---@tparam Output op
|
||||
---@treturn table|nil { w: integer, h: integer }
|
||||
---@see Output.res
|
||||
function output_module.res(op) end
|
||||
|
||||
---Get the specified output's refresh rate in millihertz.
|
||||
---For example, 60Hz will be returned as 60000.
|
||||
---@tparam Output op
|
||||
---@treturn integer|nil
|
||||
---@see Output.refresh_rate
|
||||
function output_module.refresh_rate(op) end
|
||||
|
||||
---Get the specified output's physical size in millimeters.
|
||||
---@tparam Output op
|
||||
---@treturn table|nil { w: integer, h: integer }
|
||||
---@see Output.physical_size
|
||||
function output_module.physical_size(op) end
|
||||
|
||||
---Get whether or not the specified output is focused. This is currently defined as having the cursor on it.
|
||||
---@tparam Output op
|
||||
---@treturn boolean|nil
|
||||
---@see Output.focused
|
||||
function output_module.focused(op) end
|
||||
|
||||
---Get the specified output's tags.
|
||||
---@tparam Output op
|
||||
---@see TagModule.get_on_output
|
||||
---@see Output.tags
|
||||
function output_module.tags(op) end
|
||||
|
||||
---Add tags to the specified output.
|
||||
---@tparam Output op
|
||||
---@tparam string ... The names of the tags you want to add. You can also pass in a table.
|
||||
---@see TagModule.add
|
||||
---@see Output.add_tags
|
||||
function output_module.add_tags(op, ...) end
|
||||
|
||||
----------------------------------------------------------
|
||||
|
||||
---Output objects
|
||||
---@classmod Output
|
||||
local output = {}
|
||||
|
||||
---Get this output's name. This is something like "eDP-1" or "HDMI-A-0".
|
||||
---@treturn string
|
||||
function output:name() end
|
||||
|
||||
---Get all tags on this output.
|
||||
---@treturn Tag[]
|
||||
---@see OutputModule.tags
|
||||
function output:tags() end
|
||||
|
||||
---Add tags to this output.
|
||||
---@tparam string ... The names of the tags you want to add. You can also pass in a table.
|
||||
---@see OutputModule.add_tags
|
||||
function output:add_tags(...) end
|
||||
|
||||
---Get this output's make.
|
||||
---@treturn string|nil
|
||||
---@see OutputModule.make
|
||||
function output:make() end
|
||||
|
||||
---Get this output's model.
|
||||
---@treturn string|nil
|
||||
---@see OutputModule.model
|
||||
function output:model() end
|
||||
|
||||
---Get this output's location in the global space, in pixels.
|
||||
---@treturn table|nil { x: integer, y: integer }
|
||||
---@see OutputModule.loc
|
||||
function output:loc() end
|
||||
|
||||
---Get this output's resolution in pixels.
|
||||
---@treturn table|nil { w: integer, h: integer }
|
||||
---@see OutputModule.res
|
||||
function output:res() end
|
||||
|
||||
---Get this output's refresh rate in millihertz.
|
||||
---For example, 60Hz will be returned as 60000.
|
||||
---@treturn integer|nil
|
||||
---@see OutputModule.refresh_rate
|
||||
function output:refresh_rate() end
|
||||
|
||||
---Get this output's physical size in millimeters.
|
||||
---@treturn table|nil { w: integer, h: integer }
|
||||
---@see OutputModule.physical_size
|
||||
function output:physical_size() end
|
||||
|
||||
---Get whether or not this output is focused. This is currently defined as having the cursor on it.
|
||||
---@treturn boolean|nil
|
||||
---@see OutputModule.focused
|
||||
function output:focused() end
|
30
api/lua/doc/pinnacle.lua
Normal file
30
api/lua/doc/pinnacle.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---The configuration entry point.
|
||||
---@module Pinnacle
|
||||
local pinnacle = {
|
||||
---Input and keybinds
|
||||
---@tparam InputModule input
|
||||
---@see InputModule
|
||||
input = nil,
|
||||
---Window management
|
||||
---@tparam WindowModule window
|
||||
---@see WindowModule
|
||||
window = nil,
|
||||
---Process management
|
||||
---@tparam ProcessModule process
|
||||
---@see ProcessModule
|
||||
process = nil,
|
||||
---Tag management
|
||||
---@tparam TagModule tag
|
||||
---@see TagModule
|
||||
tag = nil,
|
||||
---Output management
|
||||
---@tparam OutputModule output
|
||||
---@see OutputModule
|
||||
output = nil,
|
||||
}
|
33
api/lua/doc/process.lua
Normal file
33
api/lua/doc/process.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---This file houses LDoc documentation with dummy functions.---
|
||||
|
||||
---Process management
|
||||
---@module ProcessModule
|
||||
local process_module = {}
|
||||
|
||||
---Spawn a process with an optional callback for its stdout, stderr, and exit information.
|
||||
---
|
||||
---`callback` has the following parameters:<br>
|
||||
--- - `stdout` - The process's stdout printed this line.<br>
|
||||
--- - `stderr` - The process's stderr printed this line.<br>
|
||||
--- - `exit_code` - The process exited with this code.<br>
|
||||
--- - `exit_msg` - The process exited with this message.<br>
|
||||
---@tparam string|string[] command The command as one whole string or a table of each of its arguments
|
||||
---@tparam function callback A callback to do something whenever the process's stdout or stderr print a line, or when the process exits.
|
||||
function process_module.spawn(command, callback) end
|
||||
|
||||
---Spawn a process only if it isn't already running, with an optional callback for its stdout, stderr, and exit information.
|
||||
---
|
||||
---`callback` has the following parameters:<br>
|
||||
--- - `stdout` - The process's stdout printed this line.<br>
|
||||
--- - `stderr` - The process's stderr printed this line.<br>
|
||||
--- - `exit_code` - The process exited with this code.<br>
|
||||
--- - `exit_msg` - The process exited with this message.<br>
|
||||
---@tparam string|string[] command The command as one whole string or a table of each of its arguments
|
||||
---@tparam function callback A callback to do something whenever the process's stdout or stderr print a line, or when the process exits.
|
||||
function process_module.spawn_once(command, callback) end
|
167
api/lua/doc/tag.lua
Normal file
167
api/lua/doc/tag.lua
Normal file
|
@ -0,0 +1,167 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---Tag management
|
||||
---@module TagModule
|
||||
local tag_module = {}
|
||||
|
||||
---@alias Layout
|
||||
---| "MasterStack" # One master window on the left with all other windows stacked to the right.
|
||||
---| "Dwindle" # Windows split in half towards the bottom right corner.
|
||||
---| "Spiral" # Windows split in half in a spiral.
|
||||
---| "CornerTopLeft" # One main corner window in the top left with a column of windows on the right and a row on the bottom.
|
||||
---| "CornerTopRight" # One main corner window in the top right with a column of windows on the left and a row on the bottom.
|
||||
---| "CornerBottomLeft" # One main corner window in the bottom left with a column of windows on the right and a row on the top.
|
||||
---| "CornerBottomRight" # One main corner window in the bottom right with a column of windows on the left and a row on the top.
|
||||
|
||||
---Add tags to the specified output.
|
||||
---
|
||||
---### Examples
|
||||
--- local op = output.get_by_name("DP-1")
|
||||
--- if op ~= nil then
|
||||
--- tag.add(op, "1", "2", "3", "4", "5") -- Add tags with names 1-5
|
||||
--- end
|
||||
---You can also pass in a table.
|
||||
--- local tags = {"Terminal", "Browser", "Code", "Potato", "Email"}
|
||||
--- tag.add(op, tags) -- Add tags with those names
|
||||
---@tparam Output output The output you want these tags to be added to.
|
||||
---@tparam string ... The names of the new tags you want to add.
|
||||
---@see Output.add_tags
|
||||
function tag_module.add(output, ...) end
|
||||
|
||||
---Toggle a tag on the specified output. If `output` isn't specified, toggle it on the currently focused output instead.
|
||||
---
|
||||
---### Example
|
||||
--- -- Assuming all tags are toggled off...
|
||||
--- local op = output.get_by_name("DP-1")
|
||||
--- tag.toggle("1", op)
|
||||
--- tag.toggle("2", op)
|
||||
--- -- will cause windows on both tags 1 and 2 to be displayed at the same time.
|
||||
---@tparam string name The name of the tag.
|
||||
---@tparam ?Output output The output.
|
||||
---@see Tag.toggle
|
||||
function tag_module.toggle(name, output) end
|
||||
|
||||
---Switch to a tag on the specified output, deactivating any other active tags on it.
|
||||
---If `output` is not specified, this uses the currently focused output instead.
|
||||
---Alternatively, provide a tag object instead of a name and output.
|
||||
---
|
||||
---This is used to replicate what a traditional workspace is on some other Wayland compositors.
|
||||
---
|
||||
---### Examples
|
||||
--- -- Switches to and displays *only* windows on tag `3` on the focused output.
|
||||
--- tag.switch_to("3")
|
||||
---@tparam string name The name of the tag.
|
||||
---@tparam ?Output output The output.
|
||||
---@see Tag.switch_to
|
||||
function tag_module.switch_to(name, output) end
|
||||
|
||||
---Set a layout for the tag on the specified output. If no output is provided, set it for the tag on the currently focused one.
|
||||
---Alternatively, provide a tag object instead of a name and output.
|
||||
---
|
||||
---### Examples
|
||||
--- -- Set tag `1` on `DP-1` to the `Dwindle` layout
|
||||
--- tag.set_layout("1", "Dwindle", output.get_by_name("DP-1"))
|
||||
---
|
||||
--- -- Do the same as above. Note: if you have more than one tag named `1` then this picks the first one.
|
||||
--- local t = tag.get_by_name("1")[1]
|
||||
--- tag.set_layout(t, "Dwindle")
|
||||
---@tparam string name The name of the tag.
|
||||
---@tparam Layout layout The layout.
|
||||
---@tparam ?Output output The output.
|
||||
---@see Tag.set_layout
|
||||
function tag_module.set_layout(name, layout, output) end
|
||||
|
||||
---Get all tags on the specified output.
|
||||
---
|
||||
---### Example
|
||||
--- local op = output.get_focused()
|
||||
--- if op ~= nil then
|
||||
--- local tags = tag.get_on_output(op) -- All tags on the focused output
|
||||
--- end
|
||||
---@tparam Output output
|
||||
---@treturn Tag[]
|
||||
---@see Output.tags
|
||||
function tag_module.get_on_output(output) end
|
||||
|
||||
---Get all tags with this name across all outputs.
|
||||
---
|
||||
---### Example
|
||||
--- -- Given one monitor with the tags "OBS", "OBS", "VSCode", and "Spotify"...
|
||||
--- local tags = tag.get_by_name("OBS")
|
||||
--- -- ...will have 2 tags in `tags`, while...
|
||||
--- local no_tags = tag.get_by_name("Firefox")
|
||||
--- -- ...will have `no_tags` be empty.
|
||||
---@tparam string name The name of the tag(s) you want.
|
||||
---@treturn Tag[]
|
||||
function tag_module.get_by_name(name) end
|
||||
|
||||
---Get all tags across all outputs.
|
||||
---
|
||||
---### Example
|
||||
--- -- With two monitors with the same tags: "1", "2", "3", "4", and "5"...
|
||||
--- local tags = tag.get_all()
|
||||
--- -- ...`tags` should have 10 tags, with 5 pairs of those names across both outputs.
|
||||
---@treturn Tag[]
|
||||
function tag_module.get_all() end
|
||||
|
||||
---Get the specified tag's name.
|
||||
---
|
||||
---### Example
|
||||
--- -- Assuming the tag `Terminal` exists...
|
||||
--- print(tag.name(tag.get_by_name("Terminal")[1]))
|
||||
--- -- ...should print `Terminal`.
|
||||
---@tparam Tag t
|
||||
---@treturn string|nil
|
||||
---@see Tag.name
|
||||
function tag_module.name(t) end
|
||||
|
||||
---Get whether or not the specified tag is active.
|
||||
---@tparam Tag t
|
||||
---@treturn boolean|nil
|
||||
---@see Tag.active
|
||||
function tag_module.active(t) end
|
||||
|
||||
---Get the output the specified tag is on.
|
||||
---@tparam Tag t
|
||||
---@treturn Output|nil
|
||||
---@see OutputModule.get_for_tag
|
||||
---@see Tag.output
|
||||
function tag_module.output(t) end
|
||||
|
||||
-----------------------------------------------------
|
||||
|
||||
---Tag objects
|
||||
---@classmod Tag
|
||||
local tag = {}
|
||||
|
||||
---Get this tag's active status.
|
||||
---@treturn boolean|nil active `true` if the tag is active, `false` if not, and `nil` if the tag doesn't exist.
|
||||
---@see TagModule.active
|
||||
function tag:active() end
|
||||
|
||||
---Get this tag's name.
|
||||
---@treturn string|nil name The name of this tag, or nil if it doesn't exist.
|
||||
---@see TagModule.name
|
||||
function tag:name() end
|
||||
|
||||
---Get this tag's output.
|
||||
---@treturn Output|nil output The output this tag is on, or nil if the tag doesn't exist.
|
||||
---@see TagModule.output
|
||||
function tag:output() end
|
||||
|
||||
---Switch to this tag.
|
||||
---@see TagModule.switch_to
|
||||
function tag:switch_to() end
|
||||
|
||||
---Toggle this tag.
|
||||
---@see TagModule.toggle
|
||||
function tag:toggle() end
|
||||
|
||||
---Set this tag's layout.
|
||||
---@tparam Layout layout
|
||||
---@see TagModule.set_layout
|
||||
function tag:set_layout(layout) end
|
277
api/lua/doc/window.lua
Normal file
277
api/lua/doc/window.lua
Normal file
|
@ -0,0 +1,277 @@
|
|||
-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
-- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
--
|
||||
-- SPDX-License-Identifier: MPL-2.0
|
||||
|
||||
---Window management
|
||||
---@module WindowModule
|
||||
local window_module = {}
|
||||
|
||||
---Get all windows with the specified class (usually the name of the application).
|
||||
---@tparam string class The class. For example, Alacritty's class is "Alacritty".
|
||||
---@treturn Window[]
|
||||
function window_module.get_by_class(class) end
|
||||
|
||||
---Get all windows with the specified title.
|
||||
---@tparam string title The title.
|
||||
---@treturn Window[]
|
||||
function window_module.get_by_title(title) end
|
||||
|
||||
---Get the currently focused window.
|
||||
---@treturn Window|nil
|
||||
function window_module.get_focused() end
|
||||
|
||||
---Get all windows.
|
||||
---@treturn Window[]
|
||||
function window_module.get_all() end
|
||||
|
||||
---Toggle the tag with the given name and (optional) output for the specified window.
|
||||
---You can also provide a tag object instead of a name and output.
|
||||
---@tparam Window w
|
||||
---@tparam string name
|
||||
---@tparam ?Output output
|
||||
---@see Window.toggle_tag
|
||||
function window_module.toggle_tag(w, name, output) end
|
||||
|
||||
---Move the specified window to the tag with the given name and (optional) output.
|
||||
---You can also provide a tag object instead of a name and output.
|
||||
---@tparam Window w
|
||||
---@tparam string name
|
||||
---@tparam ?Output output
|
||||
---@see Window.move_to_tag
|
||||
function window_module.move_to_tag(w, name, output) end
|
||||
|
||||
---Set the specified window's size.
|
||||
---
|
||||
---### Examples
|
||||
---local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- window.set_size(win, { w = 500, h = 500 }) -- make the window square and 500 pixels wide/tall
|
||||
--- window.set_size(win, { h = 300 }) -- keep the window's width but make it 300 pixels tall
|
||||
--- window.set_size(win, {}) -- do absolutely nothing useful
|
||||
--- end
|
||||
---@tparam Window win
|
||||
---@tparam table size A table of the form { w: integer?, h: integer? }
|
||||
---@see Window.set_size
|
||||
function window_module.set_size(win, size) end
|
||||
|
||||
---Close the specified window.
|
||||
---
|
||||
---This only sends a close *event* to the window and is the same as just clicking the X button in the titlebar.
|
||||
---This will trigger save prompts in applications like GIMP.
|
||||
---
|
||||
---### Example
|
||||
--- local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- window.close(win) -- close the currently focused window
|
||||
--- end
|
||||
---@tparam Window win
|
||||
---@see Window.close
|
||||
function window_module.close(win) end
|
||||
|
||||
---Toggle the specified window between tiled and floating.
|
||||
---@tparam Window win
|
||||
---@see Window.toggle_floating
|
||||
function window_module.toggle_floating(win) end
|
||||
|
||||
---Get the specified window's size.
|
||||
---
|
||||
---### Example
|
||||
--- -- With a 4K monitor, given a focused fullscreen window `win`...
|
||||
--- local size = window.size(win)
|
||||
--- -- ...should have size equal to `{ w = 3840, h = 2160 }`.
|
||||
---@tparam Window win
|
||||
---@treturn table|nil size The size of the window in the form { w: integer, h: integer }, or nil if it doesn't exist.
|
||||
---@see Window.size
|
||||
function window_module.size(win) end
|
||||
|
||||
---Get the specified window's location in the global space.
|
||||
---
|
||||
---Think of your monitors as being laid out on a big sheet.
|
||||
---The top left of the sheet if you trim it down is (0, 0).
|
||||
---The location of this window is relative to that point.
|
||||
---
|
||||
---### Example
|
||||
--- -- With two 1080p monitors side by side and set up as such,
|
||||
--- -- if a window `win` is fullscreen on the right one...
|
||||
--- local loc = window.loc(win)
|
||||
--- -- ...should have loc equal to `{ x = 1920, y = 0 }`.
|
||||
---@tparam Window win
|
||||
---@treturn table|nil loc The location of the window in the form { x: integer, y: integer }, or nil if it's not on-screen or alive.
|
||||
---@see Window.loc
|
||||
function window_module.loc(win) end
|
||||
|
||||
---Get the specified window's class. This is usually the name of the application.
|
||||
---
|
||||
---### Example
|
||||
--- -- With Alacritty focused...
|
||||
--- local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- print(window.class(win))
|
||||
--- end
|
||||
--- -- ...should print "Alacritty".
|
||||
---@tparam Window win
|
||||
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
||||
---@see Window.class
|
||||
function window_module.class(win) end
|
||||
|
||||
---Get the specified window's title.
|
||||
---
|
||||
---### Example
|
||||
--- -- With Alacritty focused...
|
||||
--- local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- print(window.title(win))
|
||||
--- end
|
||||
--- -- ...should print the directory Alacritty is in or what it's running (what's in its title bar).
|
||||
---@tparam Window win
|
||||
---@treturn string|nil title This window's title, or nil if it doesn't exist.
|
||||
---@see Window.title
|
||||
function window_module.title(win) end
|
||||
|
||||
---Get this window's floating status.
|
||||
---
|
||||
---### Example
|
||||
--- -- With the focused window floating...
|
||||
--- local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- print(window.floating(win))
|
||||
--- end
|
||||
--- -- ...should print `true`.
|
||||
---@tparam Window win
|
||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||
---@see Window.floating
|
||||
function window_module.floating(win) end
|
||||
|
||||
---Get whether or not this window is focused.
|
||||
---
|
||||
---### Example
|
||||
--- local win = window.get_focused()
|
||||
--- if win ~= nil then
|
||||
--- print(window.focused(win)) -- Should print `true`
|
||||
--- end
|
||||
---@tparam Window win
|
||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||
---@see Window.focused
|
||||
function window_module.focused(win) end
|
||||
|
||||
--------------------------------------------------------
|
||||
|
||||
---Window objects
|
||||
---@classmod Window
|
||||
local window = {}
|
||||
|
||||
---Set this window's size.
|
||||
---
|
||||
---### Examples
|
||||
--- window.get_focused():set_size({ w = 500, h = 500 }) -- make the window square and 500 pixels wide/tall
|
||||
--- window.get_focused():set_size({ h = 300 }) -- keep the window's width but make it 300 pixels tall
|
||||
--- window.get_focused():set_size({}) -- do absolutely nothing useful
|
||||
---@tparam table size A table of the form { `w`: `integer?`, `h`: `integer?` }
|
||||
---@see WindowModule.set_size
|
||||
function window:set_size(size) end
|
||||
|
||||
---Move this window to a tag, removing all other ones.
|
||||
---
|
||||
---### Example
|
||||
--- -- With the focused window on tags 1, 2, 3, and 4...
|
||||
--- window.get_focused():move_to_tag("5")
|
||||
--- -- ...will make the window only appear on tag 5.
|
||||
---@tparam string name
|
||||
---@tparam ?Output output
|
||||
---@see WindowModule.move_to_tag
|
||||
function window:move_to_tag(name, output) end
|
||||
|
||||
---Toggle the specified tag for this window.
|
||||
---
|
||||
---Note: toggling off all tags currently makes a window not response to layouting.
|
||||
---
|
||||
---### Example
|
||||
--- -- With the focused window only on tag 1...
|
||||
--- window.get_focused():toggle_tag("2")
|
||||
--- -- ...will also make the window appear on tag 2.
|
||||
---@tparam string name
|
||||
---@tparam ?Output output
|
||||
---@see WindowModule.toggle_tag
|
||||
function window:toggle_tag(name, output) end
|
||||
|
||||
---Close this window.
|
||||
---
|
||||
---This only sends a close *event* to the window and is the same as just clicking the X button in the titlebar.
|
||||
---This will trigger save prompts in applications like GIMP.
|
||||
---
|
||||
---### Example
|
||||
--- window.get_focused():close() -- close the currently focused window
|
||||
---@see WindowModule.close
|
||||
function window:close() end
|
||||
|
||||
---Toggle this window's floating status.
|
||||
---
|
||||
---### Example
|
||||
--- window.get_focused():toggle_floating() -- toggles the focused window between tiled and floating
|
||||
---@see WindowModule.toggle_floating
|
||||
function window:toggle_floating() end
|
||||
|
||||
---Get this window's size.
|
||||
---
|
||||
---### Example
|
||||
--- -- With a 4K monitor, given a focused fullscreen window...
|
||||
--- local size = window.get_focused():size()
|
||||
--- -- ...should have size equal to `{ w = 3840, h = 2160 }`.
|
||||
---@treturn table|nil size The size of the window in the form { `w`: `integer`, `h`: `integer` }, or nil if it doesn't exist.
|
||||
---@see WindowModule.size
|
||||
function window:size() end
|
||||
|
||||
---Get this window's location in the global space.
|
||||
---
|
||||
---Think of your monitors as being laid out on a big sheet.
|
||||
---The top left of the sheet if you trim it down is (0, 0).
|
||||
---The location of this window is relative to that point.
|
||||
---
|
||||
---### Example
|
||||
--- -- With two 1080p monitors side by side and set up as such,
|
||||
--- -- if a window is fullscreen on the right one...
|
||||
--- local loc = that_window:loc()
|
||||
--- -- ...should have loc equal to `{ x = 1920, y = 0 }`.
|
||||
---@treturn table|nil loc The location of the window in the form { `x`: `integer`, `y`: `integer` }, or nil if it's not on-screen or alive.
|
||||
---@see WindowModule.loc
|
||||
function window:loc() end
|
||||
|
||||
---Get this window's class. This is usually the name of the application.
|
||||
---
|
||||
---### Example
|
||||
--- -- With Alacritty focused...
|
||||
--- print(window.get_focused():class())
|
||||
--- -- ...should print "Alacritty".
|
||||
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
||||
---@see WindowModule.class
|
||||
function window:class() end
|
||||
|
||||
---Get this window's title.
|
||||
---
|
||||
---### Example
|
||||
--- -- With Alacritty focused...
|
||||
--- print(window.get_focused():title())
|
||||
--- -- ...should print the directory Alacritty is in or what it's running (what's in its title bar).
|
||||
---@treturn string|nil title This window's title, or nil if it doesn't exist.
|
||||
---@see WindowModule.title
|
||||
function window:title() end
|
||||
|
||||
---Get this window's floating status.
|
||||
---
|
||||
---### Example
|
||||
--- -- With the focused window floating...
|
||||
--- print(window.get_focused():floating())
|
||||
--- -- ...should print `true`.
|
||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||
---@see WindowModule.floating
|
||||
function window:floating() end
|
||||
|
||||
---Get whether or not this window is focused.
|
||||
---
|
||||
---### Example
|
||||
--- print(window.get_focused():focused()) -- should print `true`.
|
||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||
---@see WindowModule.focused
|
||||
function window:focused() end
|
|
@ -7,25 +7,24 @@
|
|||
---@meta _
|
||||
|
||||
---@class _Msg
|
||||
---@field SetKeybind { key: Keys, modifiers: Modifier[], callback_id: integer }
|
||||
---@field SetMousebind { button: integer }
|
||||
---@field SetKeybind { key: Keys, modifiers: Modifier[], callback_id: integer }?
|
||||
---@field SetMousebind { button: integer }?
|
||||
--Windows
|
||||
---@field CloseWindow { window_id: WindowId }
|
||||
---@field ToggleFloating { window_id: WindowId }
|
||||
---@field SetWindowSize { window_id: WindowId, width: integer?, height: integer? }
|
||||
---@field MoveWindowToTag { window_id: WindowId, tag_id: TagId }
|
||||
---@field ToggleTagOnWindow { window_id: WindowId, tag_id: TagId }
|
||||
--
|
||||
---@field Spawn { command: string[], callback_id: integer? }
|
||||
---@field Request Request
|
||||
---@field CloseWindow { window_id: WindowId }?
|
||||
---@field ToggleFloating { window_id: WindowId }?
|
||||
---@field SetWindowSize { window_id: WindowId, width: integer?, height: integer? }?
|
||||
---@field MoveWindowToTag { window_id: WindowId, tag_id: TagId }?
|
||||
---@field ToggleTagOnWindow { window_id: WindowId, tag_id: TagId }?
|
||||
---@field Spawn { command: string[], callback_id: integer? }?
|
||||
---@field Request Request?
|
||||
--Tags
|
||||
---@field ToggleTag { tag_id: TagId }
|
||||
---@field SwitchToTag { tag_id: TagId }
|
||||
---@field AddTags { output_name: string, tag_names: string[] }
|
||||
---@field RemoveTags { tag_ids: TagId[] }
|
||||
---@field SetLayout { tag_id: TagId, layout: Layout }
|
||||
---@field ToggleTag { tag_id: TagId }?
|
||||
---@field SwitchToTag { tag_id: TagId }?
|
||||
---@field AddTags { output_name: string, tag_names: string[] }?
|
||||
---@field RemoveTags { tag_ids: TagId[] }?
|
||||
---@field SetLayout { tag_id: TagId, layout: Layout }?
|
||||
--Outputs
|
||||
---@field ConnectForAllOutputs { callback_id: integer }
|
||||
---@field ConnectForAllOutputs { callback_id: integer }?
|
||||
|
||||
---@alias Msg _Msg | "Quit"
|
||||
|
||||
|
@ -33,22 +32,22 @@
|
|||
|
||||
---@class __Request
|
||||
--Windows
|
||||
---@field GetWindowProps { window_id: WindowId }
|
||||
---@field GetWindowProps { window_id: WindowId }?
|
||||
--Outputs
|
||||
---@field GetOutputProps { output_name: string }
|
||||
---@field GetOutputProps { output_name: string }?
|
||||
--Tags
|
||||
---@field GetTagProps { tag_id: TagId }
|
||||
---@field GetTagProps { tag_id: TagId }?
|
||||
|
||||
---@alias _Request __Request | "GetWindows" | "GetOutputs" | "GetTags"
|
||||
---@alias Request { request_id: integer, request: _Request }
|
||||
|
||||
---@class IncomingMsg
|
||||
---@field CallCallback { callback_id: integer, args: Args? }
|
||||
---@field RequestResponse { request_id: integer, response: RequestResponse }
|
||||
---@field CallCallback { callback_id: integer, args: Args? }?
|
||||
---@field RequestResponse { request_id: integer, response: RequestResponse }?
|
||||
|
||||
---@class Args
|
||||
---@field Spawn { stdout: string?, stderr: string?, exit_code: integer?, exit_msg: string? }
|
||||
---@field ConnectForAllOutputs { output_name: string }
|
||||
---@field Spawn { stdout: string?, stderr: string?, exit_code: integer?, exit_msg: string? }?
|
||||
---@field ConnectForAllOutputs { output_name: string }?
|
||||
|
||||
---@alias WindowId integer
|
||||
---@alias TagId integer
|
||||
|
@ -57,13 +56,13 @@
|
|||
|
||||
---@class RequestResponse
|
||||
--Windows
|
||||
---@field Window { window_id: WindowId|nil }
|
||||
---@field Windows { window_ids: WindowId[] }
|
||||
---@field WindowProps { size: integer[]?, loc: integer[]?, class: string?, title: string?, floating: boolean?, focused: boolean? }
|
||||
---@field Window { window_id: WindowId|nil }?
|
||||
---@field Windows { window_ids: WindowId[] }?
|
||||
---@field WindowProps { size: integer[]?, loc: integer[]?, class: string?, title: string?, floating: boolean?, focused: boolean? }?
|
||||
--Outputs
|
||||
---@field Output { output_name: OutputName? }
|
||||
---@field Outputs { output_names: OutputName[] }
|
||||
---@field OutputProps { make: string?, model: string?, loc: integer[]?, res: integer[]?, refresh_rate: integer?, physical_size: integer[]?, focused: boolean?, tag_ids: integer[]? }
|
||||
---@field Output { output_name: OutputName? }?
|
||||
---@field Outputs { output_names: OutputName[] }?
|
||||
---@field OutputProps { make: string?, model: string?, loc: integer[]?, res: integer[]?, refresh_rate: integer?, physical_size: integer[]?, focused: boolean?, tag_ids: integer[]? }?
|
||||
--Tags
|
||||
---@field Tags { tag_ids: TagId[] }
|
||||
---@field TagProps { active: boolean?, name: string?, output_name: string? }
|
||||
---@field Tags { tag_ids: TagId[] }?
|
||||
---@field TagProps { active: boolean?, name: string?, output_name: string? }?
|
||||
|
|
|
@ -157,7 +157,7 @@ function output_module.get_by_res(width, height)
|
|||
|
||||
local output_names = response.RequestResponse.response.Outputs.output_names
|
||||
|
||||
---@type Output
|
||||
---@type Output[]
|
||||
local outputs = {}
|
||||
for _, output_name in pairs(output_names) do
|
||||
local o = create_output(output_name)
|
||||
|
|
|
@ -12,10 +12,10 @@ local process_module = {}
|
|||
---Spawn a process with an optional callback for its stdout, stderr, and exit information.
|
||||
---
|
||||
---`callback` has the following parameters:
|
||||
--- - `stdout`: The process's stdout printed this line.
|
||||
--- - `stderr`: The process's stderr printed this line.
|
||||
--- - `exit_code`: The process exited with this code.
|
||||
--- - `exit_msg`: The process exited with this message.
|
||||
--- - `stdout` - The process's stdout printed this line.
|
||||
--- - `stderr` - The process's stderr printed this line.
|
||||
--- - `exit_code` - The process exited with this code.
|
||||
--- - `exit_msg` - The process exited with this message.
|
||||
---@param command string|string[] The command as one whole string or a table of each of its arguments
|
||||
---@param callback fun(stdout: string|nil, stderr: string|nil, exit_code: integer|nil, exit_msg: string|nil)? A callback to do something whenever the process's stdout or stderr print a line, or when the process exits.
|
||||
function process_module.spawn(command, callback)
|
||||
|
|
|
@ -182,8 +182,6 @@ end
|
|||
---```lua
|
||||
----- Switches to and displays *only* windows on tag `3` on the focused output.
|
||||
---tag.switch_to("3")
|
||||
---
|
||||
---local
|
||||
---```
|
||||
---@param name string The name of the tag.
|
||||
---@param output Output? The output.
|
||||
|
|
Loading…
Reference in a new issue