mirror of
https://github.com/Dasemu/Grove.git
synced 2026-11-26 23:36:11 +00:00
fix(gui): keep an autostarted window from opening during login
On Plasma Wayland an autostarted grove-gui could end up with a task bar entry that shows nothing (window mapped while the compositor starts). - A --hidden start waits for the StatusNotifier watcher instead of opening the window when the tray is not up yet (ksni assume_sni_available) - Show requests from other launches in the first 20 s after a --hidden start (session restore) are ignored and logged - Every window show is logged with its reason; the session type at start Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011GZUAGhGYoiLvmfXweQnDY
This commit is contained in:
4 files changed
+112
-16
No files matched your search
@@ -22,12 +22,18 @@ pub struct GroveTray {
|
||||
|
||||
pub type TrayHandle = Handle<GroveTray>;
|
||||
|
||||
/// Starts the tray service. Fails when there is no D-Bus session.
|
||||
pub fn spawn(on_action: Arc<dyn Fn(Action) + Send + Sync>) -> Result<TrayHandle, ksni::Error> {
|
||||
/// Starts the tray service. Fails when there is no D-Bus session. With `wait_for_host` a
|
||||
/// missing StatusNotifier watcher/host is not an error: the item registers as soon as the
|
||||
/// desktop's tray comes up (an autostarted app usually runs before Plasma's tray is ready).
|
||||
pub fn spawn(
|
||||
on_action: Arc<dyn Fn(Action) + Send + Sync>,
|
||||
wait_for_host: bool,
|
||||
) -> Result<TrayHandle, ksni::Error> {
|
||||
GroveTray {
|
||||
agg: Aggregate::default(),
|
||||
on_action,
|
||||
}
|
||||
.assume_sni_available(wait_for_host)
|
||||
.spawn()
|
||||
}
|
||||
|
||||
@@ -48,6 +54,17 @@ impl ksni::Tray for GroveTray {
|
||||
"grove".into()
|
||||
}
|
||||
|
||||
fn watcher_online(&self) {
|
||||
crate::log::line("tray: StatusNotifier watcher is online; icon registered");
|
||||
}
|
||||
|
||||
fn watcher_offline(&self, reason: ksni::OfflineReason) -> bool {
|
||||
crate::log::line(&format!(
|
||||
"tray: StatusNotifier watcher offline ({reason:?}); waiting for it"
|
||||
));
|
||||
true
|
||||
}
|
||||
|
||||
fn title(&self) -> String {
|
||||
"Grove".into()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user