From 383d7eca84a7e971e4833d2c205637eb45f1ac25 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Fri, 3 May 2024 02:55:46 -0700 Subject: [PATCH] Add current view tags support --- protocol/river-status-unstable-v1.xml | 5 +++-- src/main.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/protocol/river-status-unstable-v1.xml b/protocol/river-status-unstable-v1.xml index e9629dd..8ba02dc 100644 --- a/protocol/river-status-unstable-v1.xml +++ b/protocol/river-status-unstable-v1.xml @@ -100,7 +100,7 @@ - + This interface allows clients to receive information about the current focus of a seat. Note that (un)focused_output events will only be sent @@ -128,13 +128,14 @@ - + Sent once on binding the interface and again whenever the focused view or a property thereof changes. The title may be an empty string if no view is focused or the focused view did not set a title. + diff --git a/src/main.rs b/src/main.rs index 04fd7f5..8fbbabf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -53,6 +53,7 @@ struct Output { name: Option, title: String, geometry: OutputGeometry, + current_view_tags: Tags, focused_tags: Tags, urgent_tags: Tags, populated_tags: Vec, @@ -153,10 +154,11 @@ fn handle_river_seat_status( zriver_seat_status_v1::Event::FocusedOutput { output } => { env.focused_output = Some(output.as_ref().id()); }, - zriver_seat_status_v1::Event::FocusedView { title } => { + zriver_seat_status_v1::Event::FocusedView { title, tags } => { if let Some(focused_output) = env.focused_output { if let Some(output) = env.outputs.get_mut(&focused_output) { output.title = title; + output.current_view_tags = Tags(tags); } } }, @@ -198,10 +200,10 @@ fn handle_river_output_status( let output_id = output.as_ref().id(); match event { zriver_output_status_v1::Event::FocusedTags { - tags: focused_tags, + tags, } => { if let Some(output) = env.outputs.get_mut(&output_id) { - output.focused_tags = Tags(focused_tags); + output.focused_tags = Tags(tags); } }, zriver_output_status_v1::Event::ViewTags { @@ -307,7 +309,7 @@ fn global_manager_callback( let seat: Main = registry.bind(version, id); seat.quick_assign(handle_seat_event); }, - "zriver_status_manager_v1" => { + "zriver_status_manager_v1" if version >= 4 => { let status_manager = registry.bind(version, id); if let Some(env) = env.get::() { env.status_manager = Some(status_manager);