@narumitw/pi-caffeinate 0.49.3 → 0.49.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -53
- package/dist/index.ts +1112 -0
- package/dist/index.ts.map +7 -0
- package/package.json +16 -8
- package/src/caffeinate.ts +315 -67
- package/src/dbus-inhibit.ts +152 -0
- package/src/inhibitors.ts +7 -1
package/src/inhibitors.ts
CHANGED
|
@@ -9,6 +9,8 @@ export interface InhibitorCommand {
|
|
|
9
9
|
description: string;
|
|
10
10
|
releaseOnStdinClose?: boolean;
|
|
11
11
|
custom?: boolean;
|
|
12
|
+
/** Display mode also needs D-Bus because logind idle inhibition misses some compositors. */
|
|
13
|
+
addDbusIdleInhibit?: boolean;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export function getInhibitorCommand(mode: CaffeinateMode): InhibitorCommand | undefined {
|
|
@@ -29,7 +31,7 @@ export function getInhibitorCommand(mode: CaffeinateMode): InhibitorCommand | un
|
|
|
29
31
|
return windowsPowerInhibitorCommand("powershell.exe", mode);
|
|
30
32
|
}
|
|
31
33
|
if (commandExists("systemd-inhibit")) {
|
|
32
|
-
const what = mode === "
|
|
34
|
+
const what = mode === "display" ? "idle:sleep" : "sleep";
|
|
33
35
|
return parentBoundUnixCommand(
|
|
34
36
|
"systemd-inhibit",
|
|
35
37
|
[
|
|
@@ -41,6 +43,7 @@ export function getInhibitorCommand(mode: CaffeinateMode): InhibitorCommand | un
|
|
|
41
43
|
"infinity",
|
|
42
44
|
],
|
|
43
45
|
`systemd-inhibit (${formatMode(mode)})`,
|
|
46
|
+
mode === "display",
|
|
44
47
|
);
|
|
45
48
|
}
|
|
46
49
|
if (commandExists("caffeinate")) {
|
|
@@ -48,6 +51,7 @@ export function getInhibitorCommand(mode: CaffeinateMode): InhibitorCommand | un
|
|
|
48
51
|
"caffeinate",
|
|
49
52
|
macCaffeinateArgs(mode),
|
|
50
53
|
caffeinateDescription(mode),
|
|
54
|
+
mode === "display",
|
|
51
55
|
);
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -67,6 +71,7 @@ function parentBoundUnixCommand(
|
|
|
67
71
|
command: string,
|
|
68
72
|
args: string[],
|
|
69
73
|
description: string,
|
|
74
|
+
addDbusIdleInhibit = false,
|
|
70
75
|
): InhibitorCommand {
|
|
71
76
|
return {
|
|
72
77
|
command: "sh",
|
|
@@ -79,6 +84,7 @@ function parentBoundUnixCommand(
|
|
|
79
84
|
...args,
|
|
80
85
|
],
|
|
81
86
|
description,
|
|
87
|
+
...(addDbusIdleInhibit ? { addDbusIdleInhibit: true } : {}),
|
|
82
88
|
};
|
|
83
89
|
}
|
|
84
90
|
|