Import XDG env variables into DWL service

This commit is contained in:
Mahesh Asolkar 2021-05-29 16:43:05 -07:00
parent 0e7225343f
commit 381321a9d9
2 changed files with 14 additions and 4 deletions

View File

@ -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

View File

@ -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}