Cinnamon-Extension automatisch aktivieren; README: Desktop-Integration explizit
- Neu cinnamon.rs: erweitert org.cinnamon enabled-extensions idempotent um ai-control-popup@local; Aufruf im SNI-Zweig von init_tray (is_cinnamon). - README: GNOME-/Cinnamon-Extension und KWin-Script mit Pfad und Aufgabe benannt, Auto-Aktivierung dokumentiert (inkl. GNOME-Randfall nach Erstinstallation); Cinnamon-X11-Aussage korrigiert (Initial-Fokus).
This commit is contained in:
@@ -79,10 +79,12 @@ Or avoid the topic entirely and build from source (below) — self-built apps ar
|
||||
|
||||
Releases carry a `.deb`, an `.rpm`, and an AppImage.
|
||||
|
||||
- **deb / rpm** — recommended. Both also install the GNOME Shell extension and the KWin script that provide the tray/popup integration on GNOME and KDE Wayland (into `/usr/share/gnome-shell/extensions/` and `/usr/share/kwin/scripts/`).
|
||||
- **deb / rpm** — recommended. Both install three desktop-integration pieces alongside the app: the **GNOME Shell extension** `ai-control-popup@local` (tray button + popup on GNOME, `/usr/share/gnome-shell/extensions/`), the **Cinnamon extension** `ai-control-popup@local` (popup placement on Wayland, initial focus on X11, `/usr/share/cinnamon/extensions/`), and the **KWin script** `ai-control-popup` (popup placement on KDE Wayland, `/usr/share/kwin/scripts/`).
|
||||
- **AppImage** — runs on desktops with a standard tray (KDE, XFCE, Cinnamon). On GNOME it refuses to start and points to the deb/rpm: the tray there needs the shell extension, which an installation-free AppImage cannot provide.
|
||||
|
||||
Tray integration by desktop: GNOME via the bundled shell extension, KDE Wayland via StatusNotifierItem plus the bundled KWin script for popup placement, KDE X11/XFCE/Cinnamon via StatusNotifierItem directly. On Cinnamon **Wayland** sessions a bundled Cinnamon extension additionally places the popup at the tray icon (a Wayland client cannot position its own window); Cinnamon X11 needs no extension.
|
||||
Tray integration by desktop: GNOME via the bundled shell extension, KDE Wayland via StatusNotifierItem plus the bundled KWin script for popup placement, KDE X11/XFCE/Cinnamon via StatusNotifierItem directly. On Cinnamon the bundled extension additionally places the popup at the tray icon on **Wayland** (a Wayland client cannot position its own window) and gives it initial focus on **X11** (Muffin's focus-stealing prevention would otherwise drop it).
|
||||
|
||||
The app **enables the matching piece automatically** on each start, per user and without prompting: GNOME via `gnome-extensions enable`, Cinnamon via the `org.cinnamon enabled-extensions` gsettings key, KDE via `kwriteconfig6` + KWin reconfigure. Cinnamon and KDE pick the change up immediately. GNOME Shell only scans for newly installed extensions at session start, so right after the very first package install the enable call can come too early — the tray button then appears after the next login; from then on it is always active.
|
||||
|
||||
### Installer tests
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//! Cinnamon-Extension pro Benutzer aktivieren — analog zu
|
||||
//! `gnome-extensions enable`. Systemweit liegt sie aus dem Paket; Cinnamon
|
||||
//! lädt sie sofort, sobald die UUID in enabled-extensions auftaucht.
|
||||
|
||||
use std::process::Command;
|
||||
|
||||
const UUID: &str = "ai-control-popup@local";
|
||||
|
||||
pub(super) fn enable_extension() {
|
||||
let Ok(out) = Command::new("gsettings")
|
||||
.args(["get", "org.cinnamon", "enabled-extensions"])
|
||||
.output()
|
||||
else {
|
||||
return;
|
||||
};
|
||||
let list = String::from_utf8_lossy(&out.stdout);
|
||||
if list.contains(UUID) {
|
||||
return;
|
||||
}
|
||||
// GVariant-Liste erweitern: "['a']" → "['a', 'ai-control-popup@local']",
|
||||
// leer ("[]" bzw. typannotiert "@as []") → "['ai-control-popup@local']".
|
||||
let inner = list
|
||||
.trim()
|
||||
.trim_start_matches("@as")
|
||||
.trim()
|
||||
.trim_start_matches('[')
|
||||
.trim_end_matches(']')
|
||||
.trim();
|
||||
let new = if inner.is_empty() {
|
||||
format!("['{UUID}']")
|
||||
} else {
|
||||
format!("[{inner}, '{UUID}']")
|
||||
};
|
||||
let _ = Command::new("gsettings")
|
||||
.args(["set", "org.cinnamon", "enabled-extensions", &new])
|
||||
.status();
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
//! Der Klick-Weg unterscheidet sich je Desktop (GNOME-Extension vs.
|
||||
//! StatusNotifierItem), das Ergebnis ist überall dasselbe Popup-Fenster.
|
||||
|
||||
mod cinnamon;
|
||||
mod desktop;
|
||||
mod gnome;
|
||||
mod kwin;
|
||||
@@ -67,6 +68,13 @@ fn is_kde() -> bool {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Cinnamon meldet sich je nach Session als „X-Cinnamon" oder „Cinnamon".
|
||||
fn is_cinnamon() -> bool {
|
||||
std::env::var("XDG_CURRENT_DESKTOP")
|
||||
.map(|d| d.to_uppercase().contains("CINNAMON"))
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
// ---------- Secrets ----------
|
||||
|
||||
/// apiKeyHelper-Kommando eines apikey-Pools: liest den Key aus dem Keyring
|
||||
@@ -108,6 +116,10 @@ pub(crate) fn init_tray(app: &tauri::AppHandle, cb: TrayCallbacks) -> Result<(),
|
||||
// KDE-Wayland: das Popup-Positionieren übernimmt das KWin-Script.
|
||||
if is_kde() {
|
||||
kwin::enable_script();
|
||||
} else if is_cinnamon() {
|
||||
// Wayland-Platzierung + X11-Fokus kommen aus der Cinnamon-Extension;
|
||||
// sie liegt systemweit aus dem Paket, aktiviert wird pro Benutzer.
|
||||
cinnamon::enable_extension();
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user