From 9fe6d49195bc338e6b3f8af3d66cd3595cc2c7c4 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Fri, 11 Aug 2023 21:15:45 +0100 Subject: [PATCH] build: update to latest hyprland-rs Resolves #269 --- Cargo.lock | 42 +++++++++++++++++++----------- Cargo.toml | 3 ++- src/clients/compositor/hyprland.rs | 25 ++++++++++-------- 3 files changed, 43 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b103a23..b8836b3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1434,9 +1434,9 @@ dependencies = [ [[package]] name = "hyprland" -version = "0.3.1" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d341e36a776cd092622daf2439a484247f3dc7d25eab7b286cc88ac85120d3" +checksum = "5b1eac91e67a2db723b96dee0883a7b3ccce55d1ee26e7373c497505f7a3c4b8" dependencies = [ "async-trait", "derive_more", @@ -1457,9 +1457,9 @@ dependencies = [ [[package]] name = "hyprland-macros" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d6c35c4399e9db5eb8272c5379eb5dccab14ac27a21487301c523fa644b4c04" +checksum = "c941d3d52e979612af8cb94e8de49000c7fada2014a7791d173ab41339f4e4eb" dependencies = [ "quote 1.0.28", "syn 2.0.28", @@ -1741,7 +1741,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] @@ -2360,13 +2360,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.4" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.2", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", ] [[package]] @@ -2378,6 +2379,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -2386,9 +2398,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" @@ -2760,24 +2772,24 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "strum" -version = "0.24.1" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "063e6045c0e62079840579a7e47a355ae92f60eb74daaf156fb1e84ba164e63f" +checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" dependencies = [ "strum_macros", ] [[package]] name = "strum_macros" -version = "0.24.3" +version = "0.25.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" +checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" dependencies = [ "heck 0.4.1", "proc-macro2", "quote 1.0.28", "rustversion", - "syn 1.0.109", + "syn 2.0.28", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6ba7a7c..756e96d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" license = "MIT" description = "Customisable GTK Layer Shell wlroots/sway bar" repository = "https://github.com/jakestanger/ironbar" +categories = ["gui"] keywords = ["gtk", "bar", "wayland", "wlroots", "gtk-layer-shell"] [features] @@ -130,7 +131,7 @@ zbus = { version = "3.14.1", optional = true } # workspaces swayipc-async = { version = "2.0.1", optional = true } -hyprland = { version = "=0.3.1", optional = true } +hyprland = { version = "0.3.8", optional = true } futures-util = { version = "0.3.21", optional = true } # shared diff --git a/src/clients/compositor/hyprland.rs b/src/clients/compositor/hyprland.rs index 73fdfd9..54329f3 100644 --- a/src/clients/compositor/hyprland.rs +++ b/src/clients/compositor/hyprland.rs @@ -3,7 +3,7 @@ use crate::{arc_mut, lock, send}; use color_eyre::Result; use hyprland::data::{Workspace as HWorkspace, Workspaces}; use hyprland::dispatch::{Dispatch, DispatchType, WorkspaceIdentifierWithSpecial}; -use hyprland::event_listener::EventListenerMutable as EventListener; +use hyprland::event_listener::EventListener; use hyprland::prelude::*; use hyprland::shared::WorkspaceType; use lazy_static::lazy_static; @@ -46,7 +46,7 @@ impl EventClient { let lock = lock.clone(); let active = active.clone(); - event_listener.add_workspace_added_handler(move |workspace_type, _state| { + event_listener.add_workspace_added_handler(move |workspace_type| { let _lock = lock!(lock); debug!("Added workspace: {workspace_type:?}"); @@ -69,7 +69,7 @@ impl EventClient { let lock = lock.clone(); let active = active.clone(); - event_listener.add_workspace_change_handler(move |workspace_type, _state| { + event_listener.add_workspace_change_handler(move |workspace_type| { let _lock = lock!(lock); let mut prev_workspace = lock!(active); @@ -105,9 +105,9 @@ impl EventClient { let lock = lock.clone(); let active = active.clone(); - event_listener.add_active_monitor_change_handler(move |event_data, _state| { + event_listener.add_active_monitor_change_handler(move |event_data| { let _lock = lock!(lock); - let workspace_type = event_data.1; + let workspace_type = event_data.workspace; let mut prev_workspace = lock!(active); @@ -134,9 +134,9 @@ impl EventClient { let tx = tx.clone(); let lock = lock.clone(); - event_listener.add_workspace_moved_handler(move |event_data, _state| { + event_listener.add_workspace_moved_handler(move |event_data| { let _lock = lock!(lock); - let workspace_type = event_data.1; + let workspace_type = event_data.workspace; debug!("Received workspace move: {workspace_type:?}"); let mut prev_workspace = lock!(active); @@ -158,7 +158,7 @@ impl EventClient { } { - event_listener.add_workspace_destroy_handler(move |workspace_type, _state| { + event_listener.add_workspace_destroy_handler(move |workspace_type| { let _lock = lock!(lock); debug!("Received workspace destroy: {workspace_type:?}"); @@ -221,9 +221,12 @@ impl EventClient { impl WorkspaceClient for EventClient { fn focus(&self, id: String) -> Result<()> { - Dispatch::call(DispatchType::Workspace( - WorkspaceIdentifierWithSpecial::Name(&id), - ))?; + let identifier = match id.parse::() { + Ok(inum) => WorkspaceIdentifierWithSpecial::Id(inum), + Err(_) => WorkspaceIdentifierWithSpecial::Name(&id), + }; + + Dispatch::call(DispatchType::Workspace(identifier))?; Ok(()) }