fix some floating windows being split

This commit is contained in:
Alex Janka 2024-07-26 12:25:14 +10:00
parent ab95a4b019
commit b6bc571b52
4 changed files with 20 additions and 16 deletions

2
Cargo.lock generated
View file

@ -653,7 +653,7 @@ dependencies = [
[[package]]
name = "sway-flash-indicator"
version = "0.2.0"
version = "0.2.1"
dependencies = [
"directories",
"futures-util",

View file

@ -1,6 +1,6 @@
[package]
name = "sway-flash-indicator"
version = "0.2.0"
version = "0.2.1"
edition = "2021"
[dependencies]

View file

@ -1,7 +1,7 @@
# Maintainer: Alex Janka <alex@alexjanka.com>
pkgname=sway-flash-indicator
pkgver=0.2.0
pkgver=0.2.1
pkgrel=1
pkgdesc="flashes sway indicator border rather than always showing it"
arch=('x86_64' 'aarch64')

View file

@ -60,13 +60,16 @@ async fn main() -> Res<()> {
}
}
swayipc_async::Event::Window(window)
// TODO: change on window closed also
// the node we're given is the one that closes
if window.change != swayipc_async::WindowChange::Mark =>
{
// TODO: also change on window closed -
// the node we're given is the one that closes
let node = window.container;
if node.node_type == swayipc_async::NodeType::Con {
let (width, height) = (node.window_rect.width, node.window_rect.height);
if width == 0 || height == 0 {
continue;
}
let ratio = (width as f64) / (height as f64);
let autosplit_ratio =
CONFIG.get().ok_or(Error::NoMatchingConfig)?.autosplit_ratio;
@ -78,6 +81,7 @@ async fn main() -> Res<()> {
log::warn!("error {e:?} setting split");
}
}
}
_ => {}
}
}