mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2025-12-06 06:36:15 +00:00
IdleInhibitor: initialize at startup, remove persistent setting (#505)
This commit is contained in:
@@ -207,7 +207,6 @@
|
||||
"fontFixed": "DejaVu Sans Mono",
|
||||
"fontDefaultScale": 1,
|
||||
"fontFixedScale": 1,
|
||||
"idleInhibitorEnabled": false,
|
||||
"tooltipsEnabled": true
|
||||
},
|
||||
"brightness": {
|
||||
|
||||
@@ -342,7 +342,6 @@ Singleton {
|
||||
property string fontFixed: "DejaVu Sans Mono"
|
||||
property real fontDefaultScale: 1.0
|
||||
property real fontFixedScale: 1.0
|
||||
property bool idleInhibitorEnabled: false
|
||||
property bool tooltipsEnabled: true
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,9 @@ Singleton {
|
||||
// Different inhibitor strategies
|
||||
property string strategy: "systemd" // "systemd", "wayland", or "auto"
|
||||
|
||||
Component.onCompleted: {
|
||||
Logger.i("IdleInhibitor", "Service started")
|
||||
function init() {
|
||||
Logger.d("IdleInhibitor", "Service started")
|
||||
detectStrategy()
|
||||
|
||||
// Restore previous state from settings
|
||||
if (Settings.data.ui.idleInhibitorEnabled) {
|
||||
addInhibitor("manual", "Restored from previous session")
|
||||
Logger.d("IdleInhibitor", "Restored previous manual inhibition state")
|
||||
}
|
||||
}
|
||||
|
||||
// Auto-detect the best strategy
|
||||
@@ -162,15 +156,13 @@ Singleton {
|
||||
function manualToggle() {
|
||||
if (activeInhibitors.includes("manual")) {
|
||||
removeInhibitor("manual")
|
||||
Settings.data.ui.idleInhibitorEnabled = false
|
||||
ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.keep-awake.disabled"))
|
||||
Logger.i("IdleInhibitor", "Manual inhibition disabled and saved to settings")
|
||||
Logger.i("IdleInhibitor", "Manual inhibition disabled")
|
||||
return false
|
||||
} else {
|
||||
addInhibitor("manual", "Manually activated by user")
|
||||
Settings.data.ui.idleInhibitorEnabled = true
|
||||
ToastService.showNotice(I18n.tr("tooltips.keep-awake"), I18n.tr("toast.keep-awake.enabled"))
|
||||
Logger.i("IdleInhibitor", "Manual inhibition enabled and saved to settings")
|
||||
Logger.i("IdleInhibitor", "Manual inhibition enabled (will reset on next session)")
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user