Add current view tags support

This commit is contained in:
Alexander Rosenberg 2024-05-03 02:55:46 -07:00
parent c78e2df00d
commit 383d7eca84
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 9 additions and 6 deletions

View File

@ -100,7 +100,7 @@
</event> </event>
</interface> </interface>
<interface name="zriver_seat_status_v1" version="3"> <interface name="zriver_seat_status_v1" version="4">
<description summary="track seat focus"> <description summary="track seat focus">
This interface allows clients to receive information about the current This interface allows clients to receive information about the current
focus of a seat. Note that (un)focused_output events will only be sent focus of a seat. Note that (un)focused_output events will only be sent
@ -128,13 +128,14 @@
<arg name="output" type="object" interface="wl_output"/> <arg name="output" type="object" interface="wl_output"/>
</event> </event>
<event name="focused_view"> <event name="focused_view" since="4">
<description summary="information on the focused view"> <description summary="information on the focused view">
Sent once on binding the interface and again whenever the focused Sent once on binding the interface and again whenever the focused
view or a property thereof changes. The title may be an empty string 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. if no view is focused or the focused view did not set a title.
</description> </description>
<arg name="title" type="string" summary="title of the focused view"/> <arg name="title" type="string" summary="title of the focused view"/>
<arg name="tags" type="uint" summary="32-bit bitfield"/>
</event> </event>
<event name="mode" since="3"> <event name="mode" since="3">

View File

@ -53,6 +53,7 @@ struct Output {
name: Option<String>, name: Option<String>,
title: String, title: String,
geometry: OutputGeometry, geometry: OutputGeometry,
current_view_tags: Tags,
focused_tags: Tags, focused_tags: Tags,
urgent_tags: Tags, urgent_tags: Tags,
populated_tags: Vec<u32>, populated_tags: Vec<u32>,
@ -153,10 +154,11 @@ fn handle_river_seat_status(
zriver_seat_status_v1::Event::FocusedOutput { output } => { zriver_seat_status_v1::Event::FocusedOutput { output } => {
env.focused_output = Some(output.as_ref().id()); 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(focused_output) = env.focused_output {
if let Some(output) = env.outputs.get_mut(&focused_output) { if let Some(output) = env.outputs.get_mut(&focused_output) {
output.title = title; 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(); let output_id = output.as_ref().id();
match event { match event {
zriver_output_status_v1::Event::FocusedTags { zriver_output_status_v1::Event::FocusedTags {
tags: focused_tags, tags,
} => { } => {
if let Some(output) = env.outputs.get_mut(&output_id) { 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 { zriver_output_status_v1::Event::ViewTags {
@ -307,7 +309,7 @@ fn global_manager_callback(
let seat: Main<WlSeat> = registry.bind(version, id); let seat: Main<WlSeat> = registry.bind(version, id);
seat.quick_assign(handle_seat_event); seat.quick_assign(handle_seat_event);
}, },
"zriver_status_manager_v1" => { "zriver_status_manager_v1" if version >= 4 => {
let status_manager = registry.bind(version, id); let status_manager = registry.bind(version, id);
if let Some(env) = env.get::<Env>() { if let Some(env) = env.get::<Env>() {
env.status_manager = Some(status_manager); env.status_manager = Some(status_manager);