fix for multiseat
Note: It panics if the seat doesn't exist
This commit is contained in:
parent
ab22aa63a8
commit
917e796dfa
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -78,6 +78,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"wayland-client",
|
||||
"wayland-commons",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
@ -120,6 +121,17 @@ dependencies = [
|
||||
"wayland-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols"
|
||||
version = "0.28.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95df3317872bcf9eec096c864b69aa4769a1d5d6291a5b513f8ba0af0efbd52c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"wayland-commons",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-scanner"
|
||||
version = "0.28.5"
|
||||
|
@ -10,6 +10,6 @@ edition = "2018"
|
||||
wayland-scanner = "0.28.5"
|
||||
|
||||
[dependencies]
|
||||
wayland-scanner = "0.28.5"
|
||||
wayland-protocols = "0.28.5"
|
||||
wayland-commons = "0.28.5"
|
||||
wayland-client = "0.28.5"
|
||||
|
15
src/main.rs
15
src/main.rs
@ -4,15 +4,16 @@ use crate::wayland::river_status_unstable_v1::{
|
||||
zriver_output_status_v1, zriver_seat_status_v1, zriver_status_manager_v1::ZriverStatusManagerV1,
|
||||
};
|
||||
use wayland_client::protocol::{
|
||||
wl_seat,
|
||||
wl_output::WlOutput,
|
||||
wl_seat::WlSeat,
|
||||
wl_seat::Event
|
||||
};
|
||||
use wayland_client::{Display, GlobalManager, Main};
|
||||
|
||||
struct Globals {
|
||||
seats: Vec<Main<WlSeat>>,
|
||||
outputs: Vec<Main<WlOutput>>,
|
||||
// xdg_outputs: Vec<Main<WlOutput>>,
|
||||
status_manager: Option<Main<ZriverStatusManagerV1>>,
|
||||
}
|
||||
|
||||
@ -25,6 +26,7 @@ fn main() {
|
||||
Globals {
|
||||
seats: Vec::new(),
|
||||
outputs: Vec::new(),
|
||||
// xdg_outputs: Vec::new(),
|
||||
status_manager: None,
|
||||
}
|
||||
};
|
||||
@ -106,18 +108,13 @@ fn main() {
|
||||
.get_river_seat_status(&seat);
|
||||
seat.quick_assign(move |_, event, mut seat_name| {
|
||||
match event {
|
||||
Event::Name{ name } => if String::new().eq(seat_name.get::<String>().unwrap())
|
||||
|| name.eq(seat_name.get::<String>().unwrap()) {
|
||||
wl_seat::Event::Name{ name } => if enable_title && seat_name.get::<String>().unwrap().len() == 0 || name.eq(seat_name.get::<String>().unwrap()) {
|
||||
seat_status.quick_assign(move |_, event, _| match event {
|
||||
zriver_seat_status_v1::Event::FocusedView { title } => {
|
||||
if enable_title {
|
||||
println!("{}", title)
|
||||
}
|
||||
}
|
||||
zriver_seat_status_v1::Event::FocusedView { title } => println!("{}", title),
|
||||
_ => {}
|
||||
})
|
||||
},
|
||||
_ => seat_status.quick_assign(move |_, _, _| {})
|
||||
_ => {}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
extern crate wayland_client;
|
||||
extern crate wayland_commons;
|
||||
extern crate wayland_protocols;
|
||||
|
||||
// Re-export only the actual code, and then only use this re-export
|
||||
// The `generated` module below is just some boilerplate to properly isolate stuff
|
||||
@ -25,6 +26,7 @@ pub mod wayland {
|
||||
pub(crate) use wayland_commons::smallvec;
|
||||
pub(crate) use wayland_commons::wire::{Argument, ArgumentType, Message, MessageDesc};
|
||||
pub(crate) use wayland_commons::{Interface, MessageGroup};
|
||||
// pub(crate) use wayland_protocols::unstable::xdg_output::v1::client::zxdg_output_v1::Event;
|
||||
// If you protocol interacts with objects from other protocols, you'll need to import
|
||||
// their modules, like so:
|
||||
pub(crate) use wayland_client::protocol::{wl_region, wl_seat, wl_surface};
|
||||
|
Loading…
Reference in New Issue
Block a user