mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-22 19:24:01 -04:00
launcher: name launch scopes app-dms-<id>-<random> so portals see the app id
Fixes #3814
This commit is contained in:
+1
-1
@@ -3,7 +3,7 @@ module github.com/AvengeMedia/DankMaterialShell/core
|
||||
go 1.27.1
|
||||
|
||||
require (
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261009141806-0a6056424f6d
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261019011452-dbde56fb9274
|
||||
github.com/AvengeMedia/dgop v1.6.3-0.20261015133851-bf93d6b75cf2
|
||||
github.com/Wifx/gonetworkmanager/v2 v2.2.0
|
||||
github.com/alecthomas/chroma/v2 v2.27.0
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
||||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261009141806-0a6056424f6d h1:KKnkT4qIXhulbh665IuV/sPHYMYcF5pwxsYCHCSOl5E=
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261009141806-0a6056424f6d/go.mod h1:oNWfG/2In/Znsrq03ZhNP1dCwHmHHm3nOVu6oXgkYIc=
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261019011452-dbde56fb9274 h1:iPydJ2zMmGZZR7WzEVCRKS15gUlBjmYk++SFtDbmlak=
|
||||
github.com/AvengeMedia/dankgo v1.6.3-0.20261019011452-dbde56fb9274/go.mod h1:oNWfG/2In/Znsrq03ZhNP1dCwHmHHm3nOVu6oXgkYIc=
|
||||
github.com/AvengeMedia/dgop v1.6.3-0.20261015133851-bf93d6b75cf2 h1:oOkpidPu7DJENdRTseCMw6pqyo12KNoGEC+Uim9pFHo=
|
||||
github.com/AvengeMedia/dgop v1.6.3-0.20261015133851-bf93d6b75cf2/go.mod h1:8TFIP72NLxCbogF2hHU6sXj3RoTbHQW8beeCrisHs/Y=
|
||||
github.com/Microsoft/go-winio v0.6.3 h1:M/52tsoyTfwaxajLnXZm7PqkbMGRH8iSWP+8fcg9MQ4=
|
||||
|
||||
+1
-1
Submodule dank-qml-common updated: b3dc38d175...51978d3ba6
Generated
+3
-3
@@ -3,11 +3,11 @@
|
||||
"dank-qml-common": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1792372175,
|
||||
"narHash": "sha256-LfTuMjjNEKXX6NMLwJ6VV1TVdgKX52bBGMlkY/8LAzw=",
|
||||
"lastModified": 1792374447,
|
||||
"narHash": "sha256-FlzldJJuGPxyb6IHnzYLi8HQE1Yg222UnY0KcKnKGik=",
|
||||
"owner": "AvengeMedia",
|
||||
"repo": "dank-qml-common",
|
||||
"rev": "b3dc38d175e2f4f1767da1b05f0b599a1e2015b9",
|
||||
"rev": "51978d3ba6be3138ee39bb0c7f07e156a82805b6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
inherit version;
|
||||
pname = "dms-shell";
|
||||
src = ./core;
|
||||
vendorHash = "sha256-z4nGF6hSbETEh/J98xtf9WaHAZ2tBZcOPFYcSsXAtp8=";
|
||||
vendorHash = "sha256-DitIB779oOFcW+gVuMpDOWkQgYgczZ2qVSQaDgzirKY=";
|
||||
|
||||
subPackages = [ "cmd/dms" ];
|
||||
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
.pragma library
|
||||
|
||||
// systemd.unit(5) "String Escaping for Inclusion in Unit Names"
|
||||
function escape(str) {
|
||||
let out = "";
|
||||
for (const ch of str) {
|
||||
if (/[A-Za-z0-9:_.]/.test(ch)) {
|
||||
out += ch;
|
||||
continue;
|
||||
}
|
||||
if (ch === "/") {
|
||||
out += "-";
|
||||
continue;
|
||||
}
|
||||
const code = ch.codePointAt(0);
|
||||
out += code < 128 ? "\\x" + code.toString(16).padStart(2, "0") : encodeURIComponent(ch).replace(/%/g, "\\x").toLowerCase();
|
||||
}
|
||||
return out.startsWith(".") ? "\\x2e" + out.slice(1) : out;
|
||||
}
|
||||
|
||||
function hasUnitName(args) {
|
||||
return args.some(arg => arg === "--unit" || arg === "-u" || arg.startsWith("--unit="));
|
||||
}
|
||||
|
||||
// app-<launcher>-<ApplicationID>-<RANDOM>.scope per systemd.io/DESKTOP_ENVIRONMENTS, the shape xdg-desktop-portal maps back to a desktop id
|
||||
function prefixArgs(prefix, desktopId, suffix) {
|
||||
const args = prefix.split(" ");
|
||||
if (args[0] !== "systemd-run" || !args.includes("--scope") || !desktopId || hasUnitName(args))
|
||||
return args;
|
||||
const unit = `app-dms-${escape(desktopId)}-${suffix}`;
|
||||
if (unit.length + ".scope".length > 255)
|
||||
return args;
|
||||
return [args[0], `--unit=${unit}`].concat(args.slice(1));
|
||||
}
|
||||
|
||||
function randomSuffix() {
|
||||
return Date.now().toString(36) + Math.floor(Math.random() * 1679616).toString(36);
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import Quickshell.I3
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import "../Common/SleepLock.js" as SleepLock
|
||||
import "../Common/LaunchUnit.js" as LaunchUnit
|
||||
|
||||
Singleton {
|
||||
id: root
|
||||
@@ -367,7 +368,7 @@ printf 'uwsm=%s\nelogind=%s\nloginctl=%s\nsystemctl=%s\nusermgr=%s\nhibernate=%s
|
||||
}
|
||||
|
||||
if (prefix.length > 0)
|
||||
cmd = prefix.split(" ").concat(cmd);
|
||||
cmd = LaunchUnit.prefixArgs(prefix, desktopEntry.id, LaunchUnit.randomSuffix()).concat(cmd);
|
||||
|
||||
Quickshell.execDetached({
|
||||
command: cmd,
|
||||
@@ -406,7 +407,7 @@ printf 'uwsm=%s\nelogind=%s\nloginctl=%s\nsystemctl=%s\nusermgr=%s\nhibernate=%s
|
||||
}
|
||||
|
||||
if (prefix.length > 0)
|
||||
cmd = prefix.split(" ").concat(cmd);
|
||||
cmd = LaunchUnit.prefixArgs(prefix, desktopEntry.id, LaunchUnit.randomSuffix()).concat(cmd);
|
||||
|
||||
Quickshell.execDetached({
|
||||
command: cmd,
|
||||
|
||||
Reference in New Issue
Block a user