mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
SystemTrayService: add service to init tray faster (#689)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
pragma Singleton
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import qs.Commons
|
||||
|
||||
|
||||
/**
|
||||
* SystemTrayService
|
||||
* This service ensures that Quickshell's SystemTray service is initialized
|
||||
* early in the shell startup to avoid programs that should stay in tray, not having access to one (let's hope this works).
|
||||
*/
|
||||
Singleton {
|
||||
id: root
|
||||
|
||||
property bool initialized: false
|
||||
|
||||
Component.onCompleted: {
|
||||
if (SystemTray && SystemTray.items) {
|
||||
Logger.i("SystemTrayService", "SystemTray service initialized")
|
||||
initialized = true
|
||||
|
||||
// Monitor for tray items to confirm it's working
|
||||
if (SystemTray.items.valuesChanged) {
|
||||
Logger.d("SystemTrayService", "SystemTray is ready and monitoring for items")
|
||||
}
|
||||
} else {
|
||||
Logger.w("SystemTrayService", "SystemTray service not available")
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
// Explicit initialization function
|
||||
if (!initialized && SystemTray && SystemTray.items) {
|
||||
Logger.i("SystemTrayService", "SystemTray service initialized via init()")
|
||||
initialized = true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
// Qt & Quickshell Core
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
|
||||
// Commons & Services
|
||||
import qs.Commons
|
||||
@@ -68,6 +69,7 @@ ShellRoot {
|
||||
sourceComponent: Item {
|
||||
Component.onCompleted: {
|
||||
Logger.i("Shell", "---------------------------")
|
||||
SystemTrayService.init()
|
||||
WallpaperService.init()
|
||||
AppThemeService.init()
|
||||
ColorSchemeService.init()
|
||||
|
||||
Reference in New Issue
Block a user