Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Linux: put the island at the top on GNOME and keep it through Super+D

Beto Doescherb30dd8e3eb33
diff --git a/README.md b/README.md
index 09985a4c..9090ccf0 100644
--- a/README.md
+++ b/README.md
@@ -88,7 +88,7 @@ Check a download with `sha256sum -c SHA256SUMS --ignore-missing`. Gemini CLI, An
The island sits on the top edge on compositors with layer-shell — COSMIC, KDE
Plasma, Hyprland, Sway and other wlroots compositors. GNOME has no layer-shell,
-so there it opens as a regular window. See [`windows/README.md`](windows/README.md#linux).
+so there it runs through XWayland as a dock window at the top of the screen. See [`windows/README.md`](windows/README.md#linux).
### Build from source
diff --git a/windows/README.md b/windows/README.md
index 60374024..8dca2cd5 100644
--- a/windows/README.md
+++ b/windows/README.md
@@ -166,8 +166,12 @@ What changes on Linux:
- **The island** is a gtk-layer-shell overlay anchored to the top edge, over any
top panel, on compositors that support it: COSMIC, KDE Plasma, Hyprland, Sway
- and other wlroots compositors. GNOME has no layer-shell, so there the island
- is a regular window. `COUCOU_LAYER_SHELL=0` forces that mode anywhere.
+ and other wlroots compositors. GNOME has no layer-shell and ignores where a
+ Wayland window asks to go, so there Coucou runs through XWayland as a dock
+ window: top centre, on every workspace, still there after Super+D.
+ `COUCOU_X11=0` keeps the native Wayland window, `COUCOU_DOCK=0` makes it a
+ utility window instead of a dock. `COUCOU_LAYER_SHELL=0` forces the regular
+ window anywhere.
- **Click-through** is the window's input region, kept equal to the island
shape, so the compositor sends every other click to what is underneath.
- **Mochi's eyes** follow the pointer only while it is over the island: Wayland
diff --git a/windows/src-tauri/src/platform/linux.rs b/windows/src-tauri/src/platform/linux.rs
index e748a336..9f9c6501 100644
--- a/windows/src-tauri/src/platform/linux.rs
+++ b/windows/src-tauri/src/platform/linux.rs
@@ -60,6 +60,7 @@ pub fn local_dir() -> PathBuf {
/// every launch, so each launch would rewrite the system's registry with
/// plugin paths that vanish once Coucou quits. Give ours its own file.
pub fn prepare_environment() {
+ prefer_x11_on_gnome();
if std::env::var_os("APPIMAGE").is_none() || std::env::var_os("GST_REGISTRY").is_some() {
return;
}
@@ -69,6 +70,24 @@ pub fn prepare_environment() {
}
}
+/// GNOME on Wayland has no layer-shell and ignores where a regular window asks
+/// to go, so the island lands in the middle of the screen. Through XWayland it
+/// can be placed, and a Dock window survives "show desktop" (Super+D).
+/// An inherited GDK_BACKEND=wayland is overridden too: editors and terminals
+/// pass theirs down to every child. COUCOU_X11=0 keeps the Wayland window.
+fn prefer_x11_on_gnome() {
+ let env = |k: &str| std::env::var(k).unwrap_or_default();
+ if should_prefer_x11(&env("XDG_SESSION_TYPE"), &env("XDG_CURRENT_DESKTOP"), &env("COUCOU_X11")) {
+ std::env::set_var("GDK_BACKEND", "x11");
+ }
+}
+
+fn should_prefer_x11(session: &str, desktop: &str, opt: &str) -> bool {
+ session.eq_ignore_ascii_case("wayland")
+ && desktop.split(':').any(|d| d.eq_ignore_ascii_case("gnome"))
+ && opt != "0"
+}
+
pub fn local_time() -> LocalTime {
let mut tm: libc::tm = unsafe { std::mem::zeroed() };
unsafe {
@@ -223,6 +242,18 @@ pub fn make_non_activating(win: &WebviewWindow) {
};
crate::log::line(format!("island is a regular window ({why})"));
gw.set_accept_focus(false);
+ if !gw.is_realized() {
+ // On X11 a Dock is kept above everything and is the only kind of
+ // window, besides the desktop, that "show desktop" leaves alone.
+ // COUCOU_DOCK=0 falls back to a utility window.
+ let dock = std::env::var("COUCOU_DOCK").map(|v| v != "0").unwrap_or(true);
+ gw.set_type_hint(if dock {
+ gtk::gdk::WindowTypeHint::Dock
+ } else {
+ gtk::gdk::WindowTypeHint::Utility
+ });
+ }
+ gw.set_keep_above(true);
return;
}
// tao gives undecorated Wayland windows an empty titlebar to force
@@ -333,6 +364,14 @@ mod tests {
let _ = std::fs::remove_dir_all(&base);
}
+ #[test]
+ fn x11_is_only_preferred_on_gnome_wayland_unless_opted_out() {
+ assert!(should_prefer_x11("wayland", "ubuntu:GNOME", ""));
+ assert!(!should_prefer_x11("x11", "ubuntu:GNOME", ""));
+ assert!(!should_prefer_x11("wayland", "KDE", ""));
+ assert!(!should_prefer_x11("wayland", "GNOME", "0"));
+ }
+
#[test]
fn private_dirs_are_closed_to_everyone_else() {
use std::os::unix::fs::MetadataExt;