1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

launcher: set default launch prefix, if launching from systemd

- prevents apps dying when stopping the systemd unit
This commit is contained in:
bbedward
2025-11-22 00:23:06 -05:00
parent bcfa508da5
commit 58bf189941
2 changed files with 19 additions and 2 deletions

View File

@@ -57,6 +57,11 @@ func getRuntimeDir() string {
return os.TempDir()
}
func hasSystemdRun() bool {
_, err := exec.LookPath("systemd-run")
return err == nil
}
func getPIDFilePath() string {
return filepath.Join(getRuntimeDir(), fmt.Sprintf("danklinux-%d.pid", os.Getpid()))
}
@@ -165,6 +170,10 @@ func runShellInteractive(session bool) {
cmd.Env = append(cmd.Env, "QT_LOGGING_RULES="+qtRules)
}
if isSessionManaged && hasSystemdRun() {
cmd.Env = append(cmd.Env, "DMS_DEFAULT_LAUNCH_PREFIX=systemd-run --user --scope")
}
homeDir, err := os.UserHomeDir()
if err == nil && os.Getenv("DMS_DISABLE_HOT_RELOAD") == "" {
if !strings.HasPrefix(configPath, homeDir) {
@@ -387,6 +396,10 @@ func runShellDaemon(session bool) {
cmd.Env = append(cmd.Env, "QT_LOGGING_RULES="+qtRules)
}
if isSessionManaged && hasSystemdRun() {
cmd.Env = append(cmd.Env, "DMS_DEFAULT_LAUNCH_PREFIX=systemd-run --user --scope")
}
homeDir, err := os.UserHomeDir()
if err == nil && os.Getenv("DMS_DISABLE_HOT_RELOAD") == "" {
if !strings.HasPrefix(configPath, homeDir) {

View File

@@ -152,7 +152,9 @@ Singleton {
cmd = ["prime-run"].concat(cmd)
}
const prefix = SettingsData.launchPrefix?.trim() || ""
const userPrefix = SettingsData.launchPrefix?.trim() || ""
const defaultPrefix = Quickshell.env("DMS_DEFAULT_LAUNCH_PREFIX") || ""
const prefix = userPrefix.length > 0 ? userPrefix : defaultPrefix
if (prefix.length > 0 && needsShellExecution(prefix)) {
const escapedCmd = cmd.map(arg => escapeShellArg(arg)).join(" ")
@@ -181,7 +183,9 @@ Singleton {
cmd = ["prime-run"].concat(cmd)
}
const prefix = SettingsData.launchPrefix?.trim() || ""
const userPrefix = SettingsData.launchPrefix?.trim() || ""
const defaultPrefix = Quickshell.env("DMS_DEFAULT_LAUNCH_PREFIX") || ""
const prefix = userPrefix.length > 0 ? userPrefix : defaultPrefix
if (prefix.length > 0 && needsShellExecution(prefix)) {
const escapedCmd = cmd.map(arg => escapeShellArg(arg)).join(" ")