1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-13 08:52:50 -05:00

qmlfmt with 4 space

This commit is contained in:
bbedward
2025-08-20 00:05:14 -04:00
parent 6e0977c719
commit b688bbfe83
154 changed files with 28809 additions and 27639 deletions

View File

@@ -3,7 +3,8 @@ import Quickshell
import Quickshell.Io
import qs.Common
pragma Singleton
pragma ComponentBehavior: Bound
pragma ComponentBehavior
Singleton {
id: root
@@ -11,100 +12,98 @@ Singleton {
property bool inhibitorAvailable: true
property bool idleInhibited: false
property string inhibitReason: "Keep system awake"
signal inhibitorChanged()
signal inhibitorChanged
function enableIdleInhibit() {
if (idleInhibited) return;
idleInhibited = true;
inhibitorChanged();
if (idleInhibited)
return
idleInhibited = true
inhibitorChanged()
}
function disableIdleInhibit() {
if (!idleInhibited) return;
idleInhibited = false;
inhibitorChanged();
if (!idleInhibited)
return
idleInhibited = false
inhibitorChanged()
}
function toggleIdleInhibit() {
if (idleInhibited) {
disableIdleInhibit();
disableIdleInhibit()
} else {
enableIdleInhibit();
enableIdleInhibit()
}
}
function setInhibitReason(reason) {
inhibitReason = reason;
inhibitReason = reason
if (idleInhibited) {
const wasActive = idleInhibited;
idleInhibited = false;
const wasActive = idleInhibited
idleInhibited = false
Qt.callLater(() => {
if (wasActive) idleInhibited = true;
});
if (wasActive)
idleInhibited = true
})
}
}
Process {
id: idleInhibitProcess
command: {
if (!idleInhibited) {
return ["true"];
return ["true"]
}
return [
"systemd-inhibit",
"--what=idle",
"--who=quickshell",
"--why=" + inhibitReason,
"--mode=block",
"sleep", "infinity"
];
return ["systemd-inhibit", "--what=idle", "--who=quickshell", "--why="
+ inhibitReason, "--mode=block", "sleep", "infinity"]
}
running: idleInhibited
onExited: function(exitCode) {
onExited: function (exitCode) {
if (idleInhibited && exitCode !== 0) {
console.warn("IdleInhibitorService: Inhibitor process crashed with exit code:", exitCode);
idleInhibited = false;
ToastService.showWarning("Idle inhibitor failed");
console.warn("IdleInhibitorService: Inhibitor process crashed with exit code:",
exitCode)
idleInhibited = false
ToastService.showWarning("Idle inhibitor failed")
}
}
}
IpcHandler {
function toggle() : string {
root.toggleIdleInhibit();
return root.idleInhibited ? "Idle inhibit enabled" : "Idle inhibit disabled";
function toggle(): string {
root.toggleIdleInhibit()
return root.idleInhibited ? "Idle inhibit enabled" : "Idle inhibit disabled"
}
function enable() : string {
root.enableIdleInhibit();
return "Idle inhibit enabled";
function enable(): string {
root.enableIdleInhibit()
return "Idle inhibit enabled"
}
function disable() : string {
root.disableIdleInhibit();
return "Idle inhibit disabled";
function disable(): string {
root.disableIdleInhibit()
return "Idle inhibit disabled"
}
function status() : string {
return root.idleInhibited ? "Idle inhibit is enabled" : "Idle inhibit is disabled";
function status(): string {
return root.idleInhibited ? "Idle inhibit is enabled" : "Idle inhibit is disabled"
}
function reason(newReason: string) : string {
function reason(newReason: string): string {
if (!newReason) {
return "Current reason: " + root.inhibitReason;
return "Current reason: " + root.inhibitReason
}
root.setInhibitReason(newReason);
return "Inhibit reason set to: " + newReason;
root.setInhibitReason(newReason)
return "Inhibit reason set to: " + newReason
}
target: "inhibit"
}
}
}