Merge pull request 'feat(tray): has_tray_host command so the first-close dialog can tell when there is no tray (#37)' (#40) from fix/no-tray-host into main
Build Lotus Chat Desktop / prepare (push) Successful in 3s
Build Lotus Chat Desktop / build-linux (push) Successful in 27m15s
Build Lotus Chat Desktop / build-windows (push) Successful in 29m45s
Build Lotus Chat Desktop / build-arch (push) Successful in 12s
Build Lotus Chat Desktop / update-manifest (push) Successful in 2s
Build Lotus Chat Desktop / prepare (push) Successful in 3s
Build Lotus Chat Desktop / build-linux (push) Successful in 27m15s
Build Lotus Chat Desktop / build-windows (push) Successful in 29m45s
Build Lotus Chat Desktop / build-arch (push) Successful in 12s
Build Lotus Chat Desktop / update-manifest (push) Successful in 2s
This commit was merged in pull request #40.
This commit is contained in:
@@ -658,6 +658,30 @@ fn read_start_minimized(app: &tauri::AppHandle) -> bool {
|
||||
.unwrap_or(true)
|
||||
}
|
||||
|
||||
/// cinny-desktop #37: whether a tray host exists to show our tray icon. On
|
||||
/// stock GNOME there is no StatusNotifier host, so "keep running in the tray"
|
||||
/// hides the window with no icon to bring it back. Always true off Linux.
|
||||
#[tauri::command]
|
||||
fn has_tray_host() -> bool {
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let Ok(conn) = zbus::blocking::Connection::session() else {
|
||||
return false;
|
||||
};
|
||||
let Ok(proxy) = zbus::blocking::fdo::DBusProxy::new(&conn) else {
|
||||
return false;
|
||||
};
|
||||
let Ok(name) = zbus::names::BusName::try_from("org.kde.StatusNotifierWatcher") else {
|
||||
return false;
|
||||
};
|
||||
proxy.name_has_owner(name).unwrap_or(false)
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
{
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn get_start_minimized(app: tauri::AppHandle) -> bool {
|
||||
read_start_minimized(&app)
|
||||
@@ -977,6 +1001,7 @@ pub fn run() {
|
||||
builder = builder
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
set_badge_count,
|
||||
has_tray_host,
|
||||
set_tray_unread,
|
||||
get_tray_dnd,
|
||||
set_tray_update_ready,
|
||||
|
||||
Reference in New Issue
Block a user