mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
feat: add idle inhibitor for ipc
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
import Quickshell.Io
|
||||
|
||||
import "./IdleInhibitor.qml"
|
||||
|
||||
IpcHandler {
|
||||
property var appLauncherPanel
|
||||
property var lockScreen
|
||||
property IdleInhibitor idleInhibitor
|
||||
|
||||
target: "globalIPC"
|
||||
|
||||
function toggleIdleInhibitor(): void {
|
||||
idleInhibitor.toggle()
|
||||
}
|
||||
|
||||
// Toggle Applauncher visibility
|
||||
function toggleLauncher(): void {
|
||||
if (!appLauncherPanel) {
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import Quickshell.Io
|
||||
|
||||
Process {
|
||||
id: idleRoot
|
||||
|
||||
// Example: systemd-inhibit to prevent idle/sleep
|
||||
command: ["systemd-inhibit", "--what=idle:sleep", "--who=noctalia", "--why=User requested", "sleep", "infinity"]
|
||||
|
||||
// Keep process running in background
|
||||
property bool isRunning: running
|
||||
|
||||
onStarted: {
|
||||
console.log("[IdleInhibitor] Process started - idle inhibited")
|
||||
}
|
||||
|
||||
onExited: function(exitCode, exitStatus) {
|
||||
console.log("[IdleInhibitor] Process finished:", exitCode)
|
||||
}
|
||||
|
||||
// Control functions
|
||||
function start() {
|
||||
if (!running) {
|
||||
console.log("[IdleInhibitor] Starting idle inhibitor...")
|
||||
running = true
|
||||
}
|
||||
}
|
||||
|
||||
function stop() {
|
||||
if (running) {
|
||||
// Force stop the process by setting running to false
|
||||
running = false
|
||||
console.log("[IdleInhibitor] Stopping idle inhibitor...")
|
||||
}
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
if (running) {
|
||||
stop()
|
||||
} else {
|
||||
start()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user