diff --git a/src/state.rs b/src/state.rs index 0ab568f06..ffabe61f0 100644 --- a/src/state.rs +++ b/src/state.rs @@ -108,6 +108,7 @@ use smithay::{ virtual_keyboard::VirtualKeyboardManagerState, xdg_activation::XdgActivationState, xdg_foreign::XdgForeignState, + xdg_system_bell::XdgSystemBellState, xwayland_keyboard_grab::XWaylandKeyboardGrabState, xwayland_shell::XWaylandShellState, }, @@ -704,6 +705,8 @@ impl State { let a11y_keyboard_monitor_state = A11yKeyboardMonitorState::new(&async_executor); + XdgSystemBellState::new::(dh); + State { common: Common { config, diff --git a/src/wayland/handlers/mod.rs b/src/wayland/handlers/mod.rs index b057c8c27..a270fc576 100644 --- a/src/wayland/handlers/mod.rs +++ b/src/wayland/handlers/mod.rs @@ -46,5 +46,6 @@ pub mod workspace; pub mod xdg_activation; pub mod xdg_foreign; pub mod xdg_shell; +pub mod xdg_system_bell; pub mod xwayland_keyboard_grab; pub mod xwayland_shell; diff --git a/src/wayland/handlers/xdg_system_bell.rs b/src/wayland/handlers/xdg_system_bell.rs new file mode 100644 index 000000000..21848a64b --- /dev/null +++ b/src/wayland/handlers/xdg_system_bell.rs @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-3.0-only + +use crate::{state::State, wayland::protocols::workspace::State as WState}; +use smithay::{ + delegate_xdg_system_bell, reexports::wayland_server::protocol::wl_surface::WlSurface, + wayland::xdg_system_bell::XdgSystemBellHandler, +}; + +impl XdgSystemBellHandler for State { + fn ring(&mut self, surface: Option) { + let shell = self.common.shell.read(); + + if let Some(surface) = surface { + if let Some((workspace, _output)) = shell.workspace_for_surface(&surface) { + let mut workspace_guard = self.common.workspace_state.update(); + workspace_guard.add_workspace_state(&workspace, WState::Urgent); + } + } + } +} + +delegate_xdg_system_bell!(State);