add force_stacking
This commit is contained in:
parent
b47d623a05
commit
5e236b2d3d
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -1041,7 +1041,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "sway-flash-indicator"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"futures-util",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sway-flash-indicator"
|
||||
version = "0.6.2"
|
||||
version = "0.6.3"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: Alex Janka <alex@alexjanka.com>
|
||||
|
||||
pkgname=sway-flash-indicator
|
||||
pkgver=0.6.2
|
||||
pkgver=0.6.3
|
||||
pkgrel=1
|
||||
pkgdesc="flashes sway indicator border rather than always showing it"
|
||||
arch=('x86_64' 'aarch64')
|
||||
|
|
|
@ -12,6 +12,7 @@ pub struct Config {
|
|||
pub flash_colour: colour::Format,
|
||||
pub autosplit_enabled: bool,
|
||||
pub autosplit_ratio: f64,
|
||||
pub force_stacking: Vec<String>,
|
||||
pub force_tabbed: Vec<String>,
|
||||
pub output_blocklist: Vec<String>,
|
||||
#[serde(default = "default_log_dir")]
|
||||
|
@ -131,6 +132,7 @@ impl Default for Config {
|
|||
flash_colour: colour::parse_hex("#ff0000").unwrap(),
|
||||
autosplit_enabled: true,
|
||||
autosplit_ratio: 1.0,
|
||||
force_stacking: Vec::new(),
|
||||
force_tabbed: Vec::new(),
|
||||
output_blocklist: Vec::new(),
|
||||
log_dir: std::path::PathBuf::new(),
|
||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -77,14 +77,13 @@ async fn main() -> Res<()> {
|
|||
let node = window.container;
|
||||
let tree = command_connection.get_tree().await?;
|
||||
let config = CONFIG.get().await;
|
||||
if window.change == swayipc_async::WindowChange::New
|
||||
&& node.app_id.as_ref().is_some_and(|app_id| {
|
||||
if window.change == swayipc_async::WindowChange::New {
|
||||
if node.app_id.as_ref().is_some_and(|app_id| {
|
||||
config
|
||||
.force_tabbed
|
||||
.iter()
|
||||
.any(|name| name.eq_ignore_ascii_case(app_id))
|
||||
})
|
||||
{
|
||||
}) {
|
||||
if let Some(parent) = tree.find_as_ref(|n| n.focus.contains(&node.id)) {
|
||||
if parent.layout == swayipc_async::NodeLayout::SplitH
|
||||
|| parent.layout == swayipc_async::NodeLayout::SplitV
|
||||
|
@ -93,10 +92,26 @@ async fn main() -> Res<()> {
|
|||
command_connection.run_command("layout tabbed").await?;
|
||||
}
|
||||
}
|
||||
} else if node.app_id.as_ref().is_some_and(|app_id| {
|
||||
config
|
||||
.force_stacking
|
||||
.iter()
|
||||
.any(|name| name.eq_ignore_ascii_case(app_id))
|
||||
}) {
|
||||
if let Some(parent) = tree.find_as_ref(|n| n.focus.contains(&node.id)) {
|
||||
if parent.layout == swayipc_async::NodeLayout::SplitH
|
||||
|| parent.layout == swayipc_async::NodeLayout::SplitV
|
||||
{
|
||||
command_connection.run_command("splith").await?;
|
||||
command_connection.run_command("layout stacking").await?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if window.change == swayipc_async::WindowChange::New
|
||||
&& node.app_id == Some(String::from("code-url-handler"))
|
||||
if node
|
||||
.app_id
|
||||
.as_ref()
|
||||
.is_some_and(|app_id| app_id.eq_ignore_ascii_case("code-url-handler"))
|
||||
{
|
||||
recent_code = Some((std::time::Instant::now(), node.id));
|
||||
} else if recent_code.is_some_and(|(t, _)| {
|
||||
|
@ -105,6 +120,7 @@ async fn main() -> Res<()> {
|
|||
}) {
|
||||
recent_code = None;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some((_, id)) = recent_code {
|
||||
if id == node.id && window.change == swayipc_async::WindowChange::Focus {
|
||||
|
|
Loading…
Reference in a new issue