mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-17 18:11:30 +01:00
Add output to window rule
This commit is contained in:
parent
946f732502
commit
178ee9464b
3 changed files with 20 additions and 6 deletions
|
@ -13,6 +13,7 @@ local function convert_tag_params(cond)
|
|||
---@diagnostic disable-next-line
|
||||
tag = tag:id()
|
||||
end
|
||||
---@diagnostic disable-next-line
|
||||
cond.tag = tag
|
||||
end
|
||||
|
||||
|
@ -89,13 +90,12 @@ function window_rules.add(...)
|
|||
local rules = { ... }
|
||||
|
||||
for _, rule in pairs(rules) do
|
||||
---@diagnostic disable-next-line a lil cheating
|
||||
---@diagnostic disable-next-line
|
||||
rule.cond = convert_tag_params(rule.cond)
|
||||
|
||||
if rule.rule.tags then
|
||||
local tags = {}
|
||||
for _, tag in pairs(rule.rule.tags) do
|
||||
---@type TagId|Tag|nil
|
||||
local t = require("tag").create_tag_from_params(tag)
|
||||
if t then
|
||||
---@diagnostic disable-next-line
|
||||
|
@ -106,7 +106,12 @@ function window_rules.add(...)
|
|||
rule.rule.tags = tags
|
||||
end
|
||||
|
||||
RPrint(rule)
|
||||
if rule.rule.output and type(rule.rule.output) == "table" then
|
||||
rule.rule.output = rule
|
||||
.rule
|
||||
.output--[[@as Output]]
|
||||
:name()
|
||||
end
|
||||
|
||||
SendMsg({
|
||||
AddWindowRule = {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
---@field location { [1]: integer, [2]: integer }? The location the window will spawn at. If the window spawns tiled, it will instead snap to this location when set to floating.
|
||||
|
||||
---@class WindowRule Attributes the window will be spawned with.
|
||||
---@field output OutputName? The output this window will be spawned on. TODO:
|
||||
---@field output (Output|OutputName)? The output this window will be spawned on. TODO:
|
||||
---@field tags (Tag|TagTable|TagTableNamed|string)[]? The tags this window will be spawned with.
|
||||
---@field floating_or_tiled ("Floating"|"Tiled")? Whether or not this window will be spawned floating or tiled.
|
||||
---@field fullscreen_or_maximized FullscreenOrMaximized? Whether or not this window will be spawned fullscreen, maximized, or forced to neither.
|
||||
|
|
|
@ -127,8 +127,17 @@ impl XdgShellHandler for State {
|
|||
location,
|
||||
} = rule;
|
||||
|
||||
if let Some(_output_name) = output {
|
||||
// TODO:
|
||||
// TODO: If both `output` and `tags` are specified, `tags` will apply over
|
||||
// | `output`.
|
||||
|
||||
if let Some(output_name) = output {
|
||||
if let Some(output) = output_name.output(&data.state) {
|
||||
let tags = output.with_state(|state| {
|
||||
state.focused_tags().cloned().collect::<Vec<_>>()
|
||||
});
|
||||
|
||||
window.with_state(|state| state.tags = tags.clone());
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(tag_ids) = tags {
|
||||
|
|
Loading…
Reference in a new issue