1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-06 05:25:41 -05:00

niri: connect directly to socket rather than running commands

This commit is contained in:
bbedward
2025-08-07 15:52:02 -04:00
parent fc13ed5c3a
commit 3dae0ec5e3
4 changed files with 191 additions and 273 deletions

View File

@@ -3,6 +3,7 @@ import QtQuick.Controls
import Quickshell
import Quickshell.Io
import qs.Common
import qs.Services
import qs.Widgets
DankModal {
@@ -14,25 +15,20 @@ DankModal {
property string powerConfirmMessage: ""
function executePowerAction(action) {
let command = [];
switch (action) {
case "logout":
command = ["niri", "msg", "action", "quit", "-s"];
NiriService.quit();
break;
case "suspend":
command = ["systemctl", "suspend"];
Quickshell.execDetached(["systemctl", "suspend"]);
break;
case "reboot":
command = ["systemctl", "reboot"];
Quickshell.execDetached(["systemctl", "reboot"]);
break;
case "poweroff":
command = ["systemctl", "poweroff"];
Quickshell.execDetached(["systemctl", "poweroff"]);
break;
}
if (command.length > 0) {
Quickshell.execDetached(command);
}
}
visible: powerConfirmVisible