gardesk/gar / c5843dc

Browse files

Add systemd session setup to gar-session.sh

Enable proper systemd user service integration:
- Import DISPLAY and XAUTHORITY to systemd user session
- Update D-Bus activation environment
- Start gar-session.target (binds to graphical-session.target)

This allows user services like garbg.service to start reliably
at login with access to the X11 display. The gar-session.target
is needed because graphical-session.target has RefuseManualStart=yes.

Pattern follows sway-systemd, i3-session, and ArchWiki systemd/User.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
c5843dc11f9d994c33177f89c2dfd740bd9be290
Parents
c402981
Tree
9bb6d93

1 changed file

StatusFile+-
M gar-session.sh 20 0
gar-session.shmodified
@@ -12,6 +12,26 @@ GAR_DIR="$(cd "$(dirname "$0")" && pwd)"
1212
 # Ensure gar config directory exists
1313
 mkdir -p ~/.config/gar
1414
 
15
+# ═══════════════════════════════════════════════════════════════════
16
+# SYSTEMD SESSION SETUP - Required for user services like garbg
17
+# Pattern from sway-systemd, i3-session, and ArchWiki systemd/User
18
+# ═══════════════════════════════════════════════════════════════════
19
+
20
+# Import DISPLAY and XAUTHORITY to systemd user session
21
+# This allows user services to connect to X11
22
+systemctl --user import-environment DISPLAY XAUTHORITY
23
+
24
+# Also update D-Bus activation environment (for D-Bus services)
25
+if command -v dbus-update-activation-environment &> /dev/null; then
26
+    dbus-update-activation-environment DISPLAY XAUTHORITY
27
+fi
28
+
29
+# Start gar-session.target - this binds to graphical-session.target
30
+# (graphical-session.target has RefuseManualStart=yes, so we use our own target)
31
+systemctl --user start gar-session.target
32
+
33
+# ═══════════════════════════════════════════════════════════════════
34
+
1535
 # Launch compositor before WM (for proper screen repainting)
1636
 # gar generates picom.conf on startup and signals picom to reload
1737
 if command -v picom &> /dev/null; then