From 488f2fb99dc58cb5013fac2f0a726ab9473008fd Mon Sep 17 00:00:00 2001 From: Alex Janka Date: Tue, 30 Jul 2024 16:00:51 +1000 Subject: [PATCH] exit on sway shutdown --- Cargo.lock | 2 +- Cargo.toml | 2 +- packaging/PKGBUILD | 2 +- src/main.rs | 5 +++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1a8f849..23ba347 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -653,7 +653,7 @@ dependencies = [ [[package]] name = "sway-flash-indicator" -version = "0.3.0" +version = "0.3.1" dependencies = [ "directories", "futures-util", diff --git a/Cargo.toml b/Cargo.toml index 0fc0c91..51375f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-flash-indicator" -version = "0.3.0" +version = "0.3.1" edition = "2021" [dependencies] diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index 9331c57..3834e4c 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Alex Janka pkgname=sway-flash-indicator -pkgver=0.3.0 +pkgver=0.3.1 pkgrel=1 pkgdesc="flashes sway indicator border rather than always showing it" arch=('x86_64' 'aarch64') diff --git a/src/main.rs b/src/main.rs index 13e17e9..caf4456 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,6 +39,7 @@ async fn main() -> Res<()> { .subscribe([ swayipc_async::EventType::Binding, swayipc_async::EventType::Window, + swayipc_async::EventType::Shutdown, ]) .await?; @@ -111,6 +112,9 @@ async fn main() -> Res<()> { } } } + swayipc_async::Event::Shutdown(_) => { + return Ok(()); + } _ => {} } } @@ -163,6 +167,7 @@ async fn code_trigger + std::cmp::PartialEq>( connection .run_command(format!("swap container with con_id {}", other.id)) .await?; + // tokio::time::sleep(std::time::Duration::from_millis(50)).await; } connection