mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-14 08:01:14 +01:00
Move all examples to Usage section
This commit is contained in:
parent
a5f9d0eff8
commit
b3c072734a
7 changed files with 154 additions and 330 deletions
5
.github/workflows/ldoc.yml
vendored
5
.github/workflows/ldoc.yml
vendored
|
@ -9,6 +9,10 @@ on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
|
env:
|
||||||
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build docs
|
name: Build docs
|
||||||
|
@ -32,3 +36,4 @@ jobs:
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./api/lua/doc/doc
|
publish_dir: ./api/lua/doc/doc
|
||||||
|
destination_dir: $BRANCH_NAME
|
||||||
|
|
|
@ -4,4 +4,4 @@ description = "A very, VERY WIP Smithay-based Wayland compositor"
|
||||||
boilerplate = true
|
boilerplate = true
|
||||||
multimodule = true
|
multimodule = true
|
||||||
no_space_before_args = true
|
no_space_before_args = true
|
||||||
style = true
|
style = true -- Use the ldoc.css in the current dir
|
||||||
|
|
|
@ -1,180 +0,0 @@
|
||||||
<!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>
|
|
|
@ -70,8 +70,8 @@ body { /* Body of window (makes it look like sidebars) */
|
||||||
background-color: #202020; margin: 0px;
|
background-color: #202020; margin: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
code, tt { font-family: "JetBrains Mono", monospace; font-size: 1em; }
|
code, tt { font-family: "JetBrains Mono", "Consolas", monospace; font-size: 1em; }
|
||||||
span.parameter { font-family: "JetBrains Mono", monospace; }
|
span.parameter { font-family: "JetBrains Mono", "Consolas", monospace; }
|
||||||
span.parameter:after { content:":"; }
|
span.parameter:after { content:":"; }
|
||||||
span.types:before { content:"("; }
|
span.types:before { content:"("; }
|
||||||
span.types:after { content:")"; }
|
span.types:after { content:")"; }
|
||||||
|
@ -122,8 +122,8 @@ pre {
|
||||||
font-family: "JetBrains Mono", "Andale Mono", monospace;
|
font-family: "JetBrains Mono", "Andale Mono", monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
pre.example {
|
pre.example { /* Usage blocks */
|
||||||
font-size: .85em;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
table.index { border: 1px #00007f; }
|
table.index { border: 1px #00007f; }
|
||||||
|
@ -297,24 +297,23 @@ ul ol { margin-top: 0px; }
|
||||||
|
|
||||||
/* make the target distinct; helps when we're navigating to a function */
|
/* make the target distinct; helps when we're navigating to a function */
|
||||||
a:target + * {
|
a:target + * {
|
||||||
background-color: #FF9;
|
background-color: #535353;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* styles for prettification of source */
|
/* styles for prettification of source */
|
||||||
pre .comment { color: #558817; }
|
pre .comment { color: #9e9fa0; }
|
||||||
pre .constant { color: #a8660d; }
|
pre .constant { color: #5ae0df; }
|
||||||
pre .escape { color: #844631; }
|
pre .escape { color: #2dc7c4; }
|
||||||
pre .keyword { color: #aa5050; font-weight: bold; }
|
pre .keyword { color: #be95ff; font-weight: bold; }
|
||||||
pre .library { color: #0e7c6b; }
|
pre .library { color: #ee5396; }
|
||||||
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
|
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
|
||||||
pre .string { color: #8080ff; }
|
pre .string { color: #25be6a; }
|
||||||
pre .number { color: #f8660d; }
|
pre .number { color: #3ddbd9; }
|
||||||
pre .function-name { color: #60447f; }
|
pre .function-name { color: #8cb6ff; }
|
||||||
pre .operator { color: #2239a8; font-weight: bold; }
|
pre .operator { color: #b6b8bb; font-weight: bold; }
|
||||||
pre .preprocessor, pre .prepro { color: #a33243; }
|
pre .preprocessor, pre .prepro { color: #ff91c1; }
|
||||||
pre .global { color: #800080; }
|
pre .global { color: #ee5396; }
|
||||||
pre .user-keyword { color: #800080; }
|
pre .user-keyword { color: #ee5396; }
|
||||||
pre .prompt { color: #558817; }
|
pre .prompt { color: #558817; }
|
||||||
pre .url { color: #272fc2; text-decoration: underline; }
|
pre .url { color: #5ae0df; text-decoration: underline; }
|
||||||
|
|
||||||
|
|
|
@ -14,9 +14,9 @@ local output_module = {}
|
||||||
---rather, "name" is the name of the connector the output is connected to.
|
---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.
|
---This should be something like "HDMI-A-0", "eDP-1", or similar.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- local monitor = output.get_by_name("DP-1")
|
---local monitor = output.get_by_name("DP-1")
|
||||||
--- print(monitor.name) -- should print `DP-1`
|
---print(monitor.name) -- should print `DP-1`
|
||||||
---@tparam string name The name of the output.
|
---@tparam string name The name of the output.
|
||||||
---@treturn Output|nil output The output, or nil if none have the provided name.
|
---@treturn Output|nil output The output, or nil if none have the provided name.
|
||||||
function output_module.get_by_name(name) end
|
function output_module.get_by_name(name) end
|
||||||
|
|
|
@ -19,14 +19,14 @@ local tag_module = {}
|
||||||
|
|
||||||
---Add tags to the specified output.
|
---Add tags to the specified output.
|
||||||
---
|
---
|
||||||
---### Examples
|
---@usage
|
||||||
--- local op = output.get_by_name("DP-1")
|
---local op = output.get_by_name("DP-1")
|
||||||
--- if op ~= nil then
|
---if op ~= nil then
|
||||||
--- tag.add(op, "1", "2", "3", "4", "5") -- Add tags with names 1-5
|
--- tag.add(op, "1", "2", "3", "4", "5") -- Add tags with names 1-5
|
||||||
--- end
|
---end
|
||||||
---You can also pass in a table.
|
--- -- You can also pass in a table.
|
||||||
--- local tags = {"Terminal", "Browser", "Code", "Potato", "Email"}
|
---local tags = {"Terminal", "Browser", "Code", "Potato", "Email"}
|
||||||
--- tag.add(op, tags) -- Add tags with those names
|
---tag.add(op, tags) -- Add tags with those names
|
||||||
---@tparam Output output The output you want these tags to be added to.
|
---@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.
|
---@tparam string ... The names of the new tags you want to add.
|
||||||
---@see Output.add_tags
|
---@see Output.add_tags
|
||||||
|
@ -34,11 +34,11 @@ 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.
|
---Toggle a tag on the specified output. If `output` isn't specified, toggle it on the currently focused output instead.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- Assuming all tags are toggled off...
|
--- -- Assuming all tags are toggled off...
|
||||||
--- local op = output.get_by_name("DP-1")
|
---local op = output.get_by_name("DP-1")
|
||||||
--- tag.toggle("1", op)
|
---tag.toggle("1", op)
|
||||||
--- tag.toggle("2", op)
|
---tag.toggle("2", op)
|
||||||
--- -- will cause windows on both tags 1 and 2 to be displayed at the same time.
|
--- -- 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 string name The name of the tag.
|
||||||
---@tparam ?Output output The output.
|
---@tparam ?Output output The output.
|
||||||
|
@ -51,9 +51,9 @@ function tag_module.toggle(name, output) end
|
||||||
---
|
---
|
||||||
---This is used to replicate what a traditional workspace is on some other Wayland compositors.
|
---This is used to replicate what a traditional workspace is on some other Wayland compositors.
|
||||||
---
|
---
|
||||||
---### Examples
|
---@usage
|
||||||
--- -- Switches to and displays *only* windows on tag `3` on the focused output.
|
--- -- Switches to and displays *only* windows on tag `3` on the focused output.
|
||||||
--- tag.switch_to("3")
|
---tag.switch_to("3")
|
||||||
---@tparam string name The name of the tag.
|
---@tparam string name The name of the tag.
|
||||||
---@tparam ?Output output The output.
|
---@tparam ?Output output The output.
|
||||||
---@see Tag.switch_to
|
---@see Tag.switch_to
|
||||||
|
@ -62,13 +62,13 @@ 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.
|
---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.
|
---Alternatively, provide a tag object instead of a name and output.
|
||||||
---
|
---
|
||||||
---### Examples
|
---@usage
|
||||||
--- -- Set tag `1` on `DP-1` to the `Dwindle` layout
|
--- -- Set tag `1` on `DP-1` to the `Dwindle` layout
|
||||||
--- tag.set_layout("1", "Dwindle", output.get_by_name("DP-1"))
|
--- 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.
|
--- -- 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]
|
---local t = tag.get_by_name("1")[1]
|
||||||
--- tag.set_layout(t, "Dwindle")
|
---tag.set_layout(t, "Dwindle")
|
||||||
---@tparam string name The name of the tag.
|
---@tparam string name The name of the tag.
|
||||||
---@tparam Layout layout The layout.
|
---@tparam Layout layout The layout.
|
||||||
---@tparam ?Output output The output.
|
---@tparam ?Output output The output.
|
||||||
|
@ -77,11 +77,11 @@ function tag_module.set_layout(name, layout, output) end
|
||||||
|
|
||||||
---Get all tags on the specified output.
|
---Get all tags on the specified output.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- local op = output.get_focused()
|
---local op = output.get_focused()
|
||||||
--- if op ~= nil then
|
---if op ~= nil then
|
||||||
--- local tags = tag.get_on_output(op) -- All tags on the focused output
|
--- local tags = tag.get_on_output(op) -- All tags on the focused output
|
||||||
--- end
|
---end
|
||||||
---@tparam Output output
|
---@tparam Output output
|
||||||
---@treturn Tag[]
|
---@treturn Tag[]
|
||||||
---@see Output.tags
|
---@see Output.tags
|
||||||
|
@ -89,11 +89,11 @@ function tag_module.get_on_output(output) end
|
||||||
|
|
||||||
---Get all tags with this name across all outputs.
|
---Get all tags with this name across all outputs.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- Given one monitor with the tags "OBS", "OBS", "VSCode", and "Spotify"...
|
--- -- Given one monitor with the tags "OBS", "OBS", "VSCode", and "Spotify"...
|
||||||
--- local tags = tag.get_by_name("OBS")
|
---local tags = tag.get_by_name("OBS")
|
||||||
--- -- ...will have 2 tags in `tags`, while...
|
--- -- ...will have 2 tags in `tags`, while...
|
||||||
--- local no_tags = tag.get_by_name("Firefox")
|
---local no_tags = tag.get_by_name("Firefox")
|
||||||
--- -- ...will have `no_tags` be empty.
|
--- -- ...will have `no_tags` be empty.
|
||||||
---@tparam string name The name of the tag(s) you want.
|
---@tparam string name The name of the tag(s) you want.
|
||||||
---@treturn Tag[]
|
---@treturn Tag[]
|
||||||
|
@ -101,18 +101,18 @@ function tag_module.get_by_name(name) end
|
||||||
|
|
||||||
---Get all tags across all outputs.
|
---Get all tags across all outputs.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With two monitors with the same tags: "1", "2", "3", "4", and "5"...
|
--- -- With two monitors with the same tags: "1", "2", "3", "4", and "5"...
|
||||||
--- local tags = tag.get_all()
|
---local tags = tag.get_all()
|
||||||
--- -- ...`tags` should have 10 tags, with 5 pairs of those names across both outputs.
|
--- -- ...`tags` should have 10 tags, with 5 pairs of those names across both outputs.
|
||||||
---@treturn Tag[]
|
---@treturn Tag[]
|
||||||
function tag_module.get_all() end
|
function tag_module.get_all() end
|
||||||
|
|
||||||
---Get the specified tag's name.
|
---Get the specified tag's name.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- Assuming the tag `Terminal` exists...
|
--- -- Assuming the tag `Terminal` exists...
|
||||||
--- print(tag.name(tag.get_by_name("Terminal")[1]))
|
---print(tag.name(tag.get_by_name("Terminal")[1]))
|
||||||
--- -- ...should print `Terminal`.
|
--- -- ...should print `Terminal`.
|
||||||
---@tparam Tag t
|
---@tparam Tag t
|
||||||
---@treturn string|nil
|
---@treturn string|nil
|
||||||
|
|
|
@ -44,13 +44,13 @@ function window_module.move_to_tag(w, name, output) end
|
||||||
|
|
||||||
---Set the specified window's size.
|
---Set the specified window's size.
|
||||||
---
|
---
|
||||||
---### Examples
|
---@usage
|
||||||
---local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---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, { 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, { h = 300 }) -- keep the window's width but make it 300 pixels tall
|
||||||
--- window.set_size(win, {}) -- do absolutely nothing useful
|
--- window.set_size(win, {}) -- do absolutely nothing useful
|
||||||
--- end
|
---end
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@tparam table size A table of the form { w: integer?, h: integer? }
|
---@tparam table size A table of the form { w: integer?, h: integer? }
|
||||||
---@see Window.set_size
|
---@see Window.set_size
|
||||||
|
@ -61,11 +61,11 @@ function window_module.set_size(win, size) end
|
||||||
---This only sends a close *event* to the window and is the same as just clicking the X button in the titlebar.
|
---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.
|
---This will trigger save prompts in applications like GIMP.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---if win ~= nil then
|
||||||
--- window.close(win) -- close the currently focused window
|
--- window.close(win) -- close the currently focused window
|
||||||
--- end
|
---end
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@see Window.close
|
---@see Window.close
|
||||||
function window_module.close(win) end
|
function window_module.close(win) end
|
||||||
|
@ -77,9 +77,9 @@ function window_module.toggle_floating(win) end
|
||||||
|
|
||||||
---Get the specified window's size.
|
---Get the specified window's size.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With a 4K monitor, given a focused fullscreen window `win`...
|
--- -- With a 4K monitor, given a focused fullscreen window `win`...
|
||||||
--- local size = window.size(win)
|
---local size = window.size(win)
|
||||||
--- -- ...should have size equal to `{ w = 3840, h = 2160 }`.
|
--- -- ...should have size equal to `{ w = 3840, h = 2160 }`.
|
||||||
---@tparam Window win
|
---@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.
|
---@treturn table|nil size The size of the window in the form { w: integer, h: integer }, or nil if it doesn't exist.
|
||||||
|
@ -92,10 +92,10 @@ function window_module.size(win) end
|
||||||
---The top left of the sheet if you trim it down is (0, 0).
|
---The top left of the sheet if you trim it down is (0, 0).
|
||||||
---The location of this window is relative to that point.
|
---The location of this window is relative to that point.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With two 1080p monitors side by side and set up as such,
|
--- -- With two 1080p monitors side by side and set up as such,
|
||||||
--- -- if a window `win` is fullscreen on the right one...
|
--- -- if a window `win` is fullscreen on the right one...
|
||||||
--- local loc = window.loc(win)
|
---local loc = window.loc(win)
|
||||||
--- -- ...should have loc equal to `{ x = 1920, y = 0 }`.
|
--- -- ...should have loc equal to `{ x = 1920, y = 0 }`.
|
||||||
---@tparam Window win
|
---@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.
|
---@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.
|
||||||
|
@ -104,12 +104,12 @@ function window_module.loc(win) end
|
||||||
|
|
||||||
---Get the specified window's class. This is usually the name of the application.
|
---Get the specified window's class. This is usually the name of the application.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With Alacritty focused...
|
--- -- With Alacritty focused...
|
||||||
--- local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---if win ~= nil then
|
||||||
--- print(window.class(win))
|
--- print(window.class(win))
|
||||||
--- end
|
---end
|
||||||
--- -- ...should print "Alacritty".
|
--- -- ...should print "Alacritty".
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
||||||
|
@ -118,12 +118,12 @@ function window_module.class(win) end
|
||||||
|
|
||||||
---Get the specified window's title.
|
---Get the specified window's title.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With Alacritty focused...
|
--- -- With Alacritty focused...
|
||||||
--- local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---if win ~= nil then
|
||||||
--- print(window.title(win))
|
--- print(window.title(win))
|
||||||
--- end
|
---end
|
||||||
--- -- ...should print the directory Alacritty is in or what it's running (what's in its title bar).
|
--- -- ...should print the directory Alacritty is in or what it's running (what's in its title bar).
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@treturn string|nil title This window's title, or nil if it doesn't exist.
|
---@treturn string|nil title This window's title, or nil if it doesn't exist.
|
||||||
|
@ -132,12 +132,12 @@ function window_module.title(win) end
|
||||||
|
|
||||||
---Get this window's floating status.
|
---Get this window's floating status.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With the focused window floating...
|
--- -- With the focused window floating...
|
||||||
--- local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---if win ~= nil then
|
||||||
--- print(window.floating(win))
|
--- print(window.floating(win))
|
||||||
--- end
|
---end
|
||||||
--- -- ...should print `true`.
|
--- -- ...should print `true`.
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||||
|
@ -146,11 +146,11 @@ function window_module.floating(win) end
|
||||||
|
|
||||||
---Get whether or not this window is focused.
|
---Get whether or not this window is focused.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- local win = window.get_focused()
|
---local win = window.get_focused()
|
||||||
--- if win ~= nil then
|
---if win ~= nil then
|
||||||
--- print(window.focused(win)) -- Should print `true`
|
--- print(window.focused(win)) -- Should print `true`
|
||||||
--- end
|
---end
|
||||||
---@tparam Window win
|
---@tparam Window win
|
||||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||||
---@see Window.focused
|
---@see Window.focused
|
||||||
|
@ -164,19 +164,19 @@ local window = {}
|
||||||
|
|
||||||
---Set this window's size.
|
---Set this window's size.
|
||||||
---
|
---
|
||||||
---### Examples
|
---@usage
|
||||||
--- window.get_focused():set_size({ w = 500, h = 500 }) -- make the window square and 500 pixels wide/tall
|
---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({ h = 300 }) -- keep the window's width but make it 300 pixels tall
|
||||||
--- window.get_focused():set_size({}) -- do absolutely nothing useful
|
---window.get_focused():set_size({}) -- do absolutely nothing useful
|
||||||
---@tparam table size A table of the form { `w`: `integer?`, `h`: `integer?` }
|
---@tparam table size A table of the form { `w`: `integer?`, `h`: `integer?` }
|
||||||
---@see WindowModule.set_size
|
---@see WindowModule.set_size
|
||||||
function window:set_size(size) end
|
function window:set_size(size) end
|
||||||
|
|
||||||
---Move this window to a tag, removing all other ones.
|
---Move this window to a tag, removing all other ones.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With the focused window on tags 1, 2, 3, and 4...
|
--- -- With the focused window on tags 1, 2, 3, and 4...
|
||||||
--- window.get_focused():move_to_tag("5")
|
---window.get_focused():move_to_tag("5")
|
||||||
--- -- ...will make the window only appear on tag 5.
|
--- -- ...will make the window only appear on tag 5.
|
||||||
---@tparam string name
|
---@tparam string name
|
||||||
---@tparam ?Output output
|
---@tparam ?Output output
|
||||||
|
@ -187,9 +187,9 @@ function window:move_to_tag(name, output) end
|
||||||
---
|
---
|
||||||
---Note: toggling off all tags currently makes a window not response to layouting.
|
---Note: toggling off all tags currently makes a window not response to layouting.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With the focused window only on tag 1...
|
--- -- With the focused window only on tag 1...
|
||||||
--- window.get_focused():toggle_tag("2")
|
---window.get_focused():toggle_tag("2")
|
||||||
--- -- ...will also make the window appear on tag 2.
|
--- -- ...will also make the window appear on tag 2.
|
||||||
---@tparam string name
|
---@tparam string name
|
||||||
---@tparam ?Output output
|
---@tparam ?Output output
|
||||||
|
@ -201,23 +201,23 @@ function window:toggle_tag(name, output) end
|
||||||
---This only sends a close *event* to the window and is the same as just clicking the X button in the titlebar.
|
---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.
|
---This will trigger save prompts in applications like GIMP.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- window.get_focused():close() -- close the currently focused window
|
---window.get_focused():close() -- close the currently focused window
|
||||||
---@see WindowModule.close
|
---@see WindowModule.close
|
||||||
function window:close() end
|
function window:close() end
|
||||||
|
|
||||||
---Toggle this window's floating status.
|
---Toggle this window's floating status.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- window.get_focused():toggle_floating() -- toggles the focused window between tiled and floating
|
---window.get_focused():toggle_floating() -- toggles the focused window between tiled and floating
|
||||||
---@see WindowModule.toggle_floating
|
---@see WindowModule.toggle_floating
|
||||||
function window:toggle_floating() end
|
function window:toggle_floating() end
|
||||||
|
|
||||||
---Get this window's size.
|
---Get this window's size.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With a 4K monitor, given a focused fullscreen window...
|
--- -- With a 4K monitor, given a focused fullscreen window...
|
||||||
--- local size = window.get_focused():size()
|
---local size = window.get_focused():size()
|
||||||
--- -- ...should have size equal to `{ w = 3840, h = 2160 }`.
|
--- -- ...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.
|
---@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
|
---@see WindowModule.size
|
||||||
|
@ -229,10 +229,10 @@ function window:size() end
|
||||||
---The top left of the sheet if you trim it down is (0, 0).
|
---The top left of the sheet if you trim it down is (0, 0).
|
||||||
---The location of this window is relative to that point.
|
---The location of this window is relative to that point.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With two 1080p monitors side by side and set up as such,
|
--- -- With two 1080p monitors side by side and set up as such,
|
||||||
--- -- if a window is fullscreen on the right one...
|
--- -- if a window is fullscreen on the right one...
|
||||||
--- local loc = that_window:loc()
|
---local loc = that_window:loc()
|
||||||
--- -- ...should have loc equal to `{ x = 1920, y = 0 }`.
|
--- -- ...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.
|
---@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
|
---@see WindowModule.loc
|
||||||
|
@ -240,9 +240,9 @@ function window:loc() end
|
||||||
|
|
||||||
---Get this window's class. This is usually the name of the application.
|
---Get this window's class. This is usually the name of the application.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With Alacritty focused...
|
--- -- With Alacritty focused...
|
||||||
--- print(window.get_focused():class())
|
---print(window.get_focused():class())
|
||||||
--- -- ...should print "Alacritty".
|
--- -- ...should print "Alacritty".
|
||||||
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
---@treturn string|nil class This window's class, or nil if it doesn't exist.
|
||||||
---@see WindowModule.class
|
---@see WindowModule.class
|
||||||
|
@ -250,9 +250,9 @@ function window:class() end
|
||||||
|
|
||||||
---Get this window's title.
|
---Get this window's title.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With Alacritty focused...
|
--- -- With Alacritty focused...
|
||||||
--- print(window.get_focused():title())
|
---print(window.get_focused():title())
|
||||||
--- -- ...should print the directory Alacritty is in or what it's running (what's in its title bar).
|
--- -- ...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.
|
---@treturn string|nil title This window's title, or nil if it doesn't exist.
|
||||||
---@see WindowModule.title
|
---@see WindowModule.title
|
||||||
|
@ -260,9 +260,9 @@ function window:title() end
|
||||||
|
|
||||||
---Get this window's floating status.
|
---Get this window's floating status.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- -- With the focused window floating...
|
--- -- With the focused window floating...
|
||||||
--- print(window.get_focused():floating())
|
---print(window.get_focused():floating())
|
||||||
--- -- ...should print `true`.
|
--- -- ...should print `true`.
|
||||||
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||||
---@see WindowModule.floating
|
---@see WindowModule.floating
|
||||||
|
@ -270,8 +270,8 @@ function window:floating() end
|
||||||
|
|
||||||
---Get whether or not this window is focused.
|
---Get whether or not this window is focused.
|
||||||
---
|
---
|
||||||
---### Example
|
---@usage
|
||||||
--- print(window.get_focused():focused()) -- should print `true`.
|
---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.
|
---@treturn boolean|nil floating `true` if it's floating, `false` if it's tiled, or nil if it doesn't exist.
|
||||||
---@see WindowModule.focused
|
---@see WindowModule.focused
|
||||||
function window:focused() end
|
function window:focused() end
|
||||||
|
|
Loading…
Reference in a new issue