From 381321a9d9a7ef0f53a968d348eb753682962f1b Mon Sep 17 00:00:00 2001 From: Mahesh Asolkar Date: Sat, 29 May 2021 16:43:05 -0700 Subject: [PATCH] Import XDG env variables into DWL service --- dwl.service | 10 +++++++--- start.dwl | 8 +++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/dwl.service b/dwl.service index ba8317e..433689f 100644 --- a/dwl.service +++ b/dwl.service @@ -7,7 +7,6 @@ # # Start this service with something like this: # -# # # #!/usr/bin/env bash # # # Start DWL @@ -16,10 +15,15 @@ # # Escape slashes in the path # SNAME=$(systemd-escape ${RUNTIME_DIR}.service) # -# # Start service blocking. Remove runtime directory upon completion +# # Start service blocking. Remove runtime directory upon completion. +# # Be sure to import XDG session variables for graphical-session to work +# systemctl --user import-environment XDG_SEAT && \ +# systemctl --user import-environment XDG_SESSION_TYPE && \ +# systemctl --user import-environment XDG_SESSION_CLASS && \ +# systemctl --user import-environment XDG_VTNR && \ +# systemctl --user import-environment XDG_SESSION_ID && \ # systemctl --wait --user start dwl@${SNAME} && \ # rm -rf ${RUNTIME_DIR} -# [Unit] Description=DWL session service BindsTo=graphical-session.target diff --git a/start.dwl b/start.dwl index 9ae14f2..8880b3c 100755 --- a/start.dwl +++ b/start.dwl @@ -6,6 +6,12 @@ RUNTIME_DIR=$(mktemp --directory --suffix=.${USER}) # Escape slashes in the path SNAME=$(systemd-escape ${RUNTIME_DIR}.service) -# Start service blocking. Remove runtime directory upon completion +# Start service blocking. Remove runtime directory upon completion. +# Be sure to import XDG session variables for graphical-session to work +systemctl --user import-environment XDG_SEAT && \ +systemctl --user import-environment XDG_SESSION_TYPE && \ +systemctl --user import-environment XDG_SESSION_CLASS && \ +systemctl --user import-environment XDG_VTNR && \ +systemctl --user import-environment XDG_SESSION_ID && \ systemctl --wait --user start dwl@${SNAME} && \ rm -rf ${RUNTIME_DIR}