Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions watchers/src/watchers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ async fn filter_first_supported(
));
}
WatcherType::ActiveWindow => {
#[cfg(feature = "gnome")]
watch!(create_watcher::<gnome_window::WindowWatcher>(
client,
"Gnome window (extension)"
));
#[cfg(feature = "kwin_window")]
watch!(create_watcher::<kwin_window::WindowWatcher>(
client,
"KWin window (script)"
));
watch!(create_watcher::<
wl_foreign_toplevel_management::WindowWatcher,
>(
Expand All @@ -111,17 +121,6 @@ async fn filter_first_supported(
"Cosmic Wayland window (cosmic-toplevel-info-unstable-v1)"
)
);
// XWayland gives _NET_WM_NAME on some windows in KDE, but not on others
#[cfg(feature = "kwin_window")]
watch!(create_watcher::<kwin_window::WindowWatcher>(
client,
"KWin window (script)"
));
#[cfg(feature = "gnome")]
watch!(create_watcher::<gnome_window::WindowWatcher>(
client,
"Gnome window (extension)"
));
watch!(create_watcher::<x11_window::WindowWatcher>(
client,
"X11 window"
Expand Down
11 changes: 11 additions & 0 deletions watchers/src/watchers/wl_cosmic_toplevel_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,20 @@ struct ToplevelState {
sender: mpsc::Sender<WindowData>,
}

fn is_cosmic() -> bool {
if let Ok(de) = std::env::var("XDG_CURRENT_DESKTOP") {
de.to_lowercase().contains("cosmic")
} else {
false
}
}

fn initialize_state(
sender: mpsc::Sender<WindowData>,
) -> anyhow::Result<(ToplevelState, EventQueue<ToplevelState>)> {
if !is_cosmic() {
return Err(anyhow!("Not in COSMIC environment"));
}
let conn = Connection::connect_to_env()?;
let (globals, event_queue) = registry_queue_init(&conn)?;
let qh: QueueHandle<ToplevelState> = event_queue.handle();
Expand Down
Loading