aurora36149c1
aurora: launch apps in their own scope, not aurora.service
+14 −8
5 files changed
- M .config/quickshell/aurora/Devices.qml +1 −1
- M .config/quickshell/aurora/Dock.qml +2 −2
- M .config/quickshell/aurora/Net.qml +1 −2
- M .config/quickshell/aurora/Runner.qml +3 −3
- M .config/quickshell/aurora/Session.qml +7 −0
| @@ -34,7 +34,7 @@ Singleton { | |||
| 34 | 34 | if (phones[i].key === key && phones[i].mounted) { xdgOpen(phones[i].path); return true } | |
| 35 | 35 | return false | |
| 36 | 36 | } | |
| 37 | − | function xdgOpen(path) { Quickshell.execDetached(["xdg-open", path]) } | |
| 37 | + | function xdgOpen(path) { Session.launch(["xdg-open", path]) } | |
| 38 | 38 | // unmount this filesystem and lock its LUKS container; the disk stays powered, so it can be mounted again | |
| 39 | 39 | function eject(key) { | |
| 40 | 40 | if (key.indexOf("mtp://") === 0) { | |
| @@ -66,7 +66,7 @@ PanelWindow { | |||
| 66 | 66 | } | |
| 67 | 67 | ||
| 68 | 68 | function activate(a) { | |
| 69 | − | if (a.wins.length === 0) { if (a.entry) a.entry.execute(); return } | |
| 69 | + | if (a.wins.length === 0) { if (a.entry) Session.launch(a.entry.command, a.entry.workingDirectory); return } | |
| 70 | 70 | // focus the next window of that app after the active one (cycles) | |
| 71 | 71 | var act = Hyprland.activeToplevel, i = -1 | |
| 72 | 72 | for (var k = 0; k < a.wins.length; k++) if (act && a.wins[k].address === act.address) i = k | |
| @@ -166,7 +166,7 @@ PanelWindow { | |||
| 166 | 166 | onEntered: { hide.stop(); win.shown = true } | |
| 167 | 167 | onClicked: m => { | |
| 168 | 168 | if (m.button === Qt.RightButton) Settings.togglePin(cell.modelData.id) | |
| 169 | − | else if (m.button === Qt.MiddleButton) { if (cell.modelData.entry) cell.modelData.entry.execute() } | |
| 169 | + | else if (m.button === Qt.MiddleButton) { if (cell.modelData.entry) Session.launch(cell.modelData.entry.command, cell.modelData.entry.workingDirectory) } | |
| 170 | 170 | else win.activate(cell.modelData) | |
| 171 | 171 | } | |
| 172 | 172 | } | |
| @@ -96,8 +96,7 @@ Singleton { | |||
| 96 | 96 | } | |
| 97 | 97 | ||
| 98 | 98 | function openPortal() { | |
| 99 | − | Quickshell.execDetached(["sh", "-c", 'exec ${BROWSER:-xdg-open} "$1"', "sh", | |
| 100 | − | portalUrl !== "" ? portalUrl : probeUrl]) | |
| 99 | + | Session.launch(["sh", "-c", 'exec ${BROWSER:-xdg-open} "$1"', "sh", portalUrl !== "" ? portalUrl : probeUrl]) | |
| 101 | 100 | } | |
| 102 | 101 | ||
| 103 | 102 | // manual "sign in" (IPC): open the portal if there is one, else say why not | |
| @@ -322,7 +322,7 @@ PanelWindow { | |||
| 322 | 322 | ||
| 323 | 323 | // ---- launching ---- | |
| 324 | 324 | function exec(cmd, term) { | |
| 325 | − | Quickshell.execDetached({ command: term ? ["foot", "-e"].concat(cmd) : cmd, workingDirectory: home }) | |
| 325 | + | Session.launch(term ? ["foot", "-e"].concat(cmd) : cmd, home) | |
| 326 | 326 | } | |
| 327 | 327 | function trigger(i, term) { | |
| 328 | 328 | if (dmenu) { | |
| @@ -343,9 +343,9 @@ PanelWindow { | |||
| 343 | 343 | switch (it.kind) { | |
| 344 | 344 | case "app": | |
| 345 | 345 | if (term || it.entry.runInTerminal) exec(it.entry.command, true) | |
| 346 | − | else it.entry.execute() | |
| 346 | + | else Session.launch(it.entry.command, it.entry.workingDirectory) | |
| 347 | 347 | break | |
| 348 | − | case "act": it.action.execute(); break | |
| 348 | + | case "act": Session.launch(it.action.command); break | |
| 349 | 349 | case "bin": exec([it.name], term); break | |
| 350 | 350 | case "sh": exec(["sh", "-c", it.name], term); break | |
| 351 | 351 | case "calc": if (it.value !== "") Quickshell.execDetached(["wl-copy", "--", it.value]); break | |
| @@ -15,6 +15,13 @@ Singleton { | |||
| 15 | 15 | { id: "display", icon: Theme.iMonitor, label: "display off", confirm: false } | |
| 16 | 16 | ] | |
| 17 | 17 | ||
| 18 | + | // Start an app in its own systemd scope. Spawned straight from quickshell it would sit in aurora.service's cgroup: | |
| 19 | + | // killed on every `systemctl --user restart aurora`, and one that ignores SIGTERM stalls the restart for 90s. | |
| 20 | + | function launch(cmd, wd) { | |
| 21 | + | Quickshell.execDetached({ command: ["systemd-run", "--user", "--scope", "--quiet", "--collect", "--"].concat(cmd), | |
| 22 | + | workingDirectory: wd || Quickshell.env("HOME") }) | |
| 23 | + | } | |
| 24 | + | ||
| 18 | 25 | function run(id) { | |
| 19 | 26 | switch (id) { | |
| 20 | 27 | case "lock": Quickshell.execDetached(["loginctl", "lock-session"]); break | |