summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/seat.c2
-rw-r--r--tests/scripts/mir-script-hooks.conf14
-rw-r--r--tests/scripts/script-hook-display-setup-fail.conf2
-rw-r--r--tests/scripts/script-hook-greeter-setup-fail.conf2
-rw-r--r--tests/scripts/script-hook-session-setup-fail.conf2
-rw-r--r--tests/scripts/script-hooks.conf14
-rw-r--r--tests/scripts/unity-mir-script-hooks.conf12
-rw-r--r--tests/scripts/unity-script-hooks.conf14
-rw-r--r--tests/src/test-script-hook.c2
9 files changed, 34 insertions, 30 deletions
diff --git a/src/seat.c b/src/seat.c
index 2725c08b..e30af296 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -372,6 +372,8 @@ run_script (Seat *seat, DisplayServer *display_server, const gchar *script_name,
else
process_set_env (script, "PATH", "/usr/local/bin:/usr/bin:/bin");
+ process_set_env (script, "XDG_SEAT", seat_get_name (seat));
+
if (user)
{
process_set_env (script, "USER", user_get_name (user));
diff --git a/tests/scripts/mir-script-hooks.conf b/tests/scripts/mir-script-hooks.conf
index 51349ac3..204cb2da 100644
--- a/tests/scripts/mir-script-hooks.conf
+++ b/tests/scripts/mir-script-hooks.conf
@@ -19,8 +19,8 @@ user-session=mir
#?*UNITY-SYSTEM-COMPOSITOR READY
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK SESSION-SETUP USER=have-password1
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK SESSION-SETUP XDG_SEAT=seat0 USER=have-password1
# Session starts
#?SESSION-MIR-session-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=mir XDG_SESSION_DESKTOP=mir USER=have-password1
@@ -33,21 +33,21 @@ user-session=mir
#?*SESSION-MIR-session-0 LOGOUT
# Script hooks runs
-#?SCRIPT-HOOK SESSION-CLEANUP USER=have-password1
+#?SCRIPT-HOOK SESSION-CLEANUP XDG_SEAT=seat0 USER=have-password1
# System compositor stops
#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# System compositor starts
#?UNITY-SYSTEM-COMPOSITOR START FILE=/run/mir_socket VT=7 ENABLE-HARDWARE-CURSOR=TRUE XDG_VTNR=7
#?*UNITY-SYSTEM-COMPOSITOR READY
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK GREETER-SETUP USER=.*
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK GREETER-SETUP XDG_SEAT=seat0 USER=.*
# Greeter starts
#?GREETER-MIR-greeter-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
@@ -65,7 +65,7 @@ user-session=mir
#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# Finish cleanup
#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/script-hook-display-setup-fail.conf b/tests/scripts/script-hook-display-setup-fail.conf
index 8807adb8..d6ddc2bb 100644
--- a/tests/scripts/script-hook-display-setup-fail.conf
+++ b/tests/scripts/script-hook-display-setup-fail.conf
@@ -17,7 +17,7 @@ display-setup-script=test-script-hook DISPLAY-SETUP 1
#?XSERVER-0 ACCEPT-CONNECT
# Setup script fails
-#?SCRIPT-HOOK DISPLAY-SETUP
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
#?XSERVER-0 TERMINATE SIGNAL=15
diff --git a/tests/scripts/script-hook-greeter-setup-fail.conf b/tests/scripts/script-hook-greeter-setup-fail.conf
index ee483a49..8a9e1665 100644
--- a/tests/scripts/script-hook-greeter-setup-fail.conf
+++ b/tests/scripts/script-hook-greeter-setup-fail.conf
@@ -17,7 +17,7 @@ greeter-setup-script=test-script-hook GREETER-SETUP 1
#?XSERVER-0 ACCEPT-CONNECT
# Setup script fails
-#?SCRIPT-HOOK GREETER-SETUP USER=.*
+#?SCRIPT-HOOK GREETER-SETUP XDG_SEAT=seat0 USER=.*
#?XSERVER-0 TERMINATE SIGNAL=15
diff --git a/tests/scripts/script-hook-session-setup-fail.conf b/tests/scripts/script-hook-session-setup-fail.conf
index 5669d425..64008c26 100644
--- a/tests/scripts/script-hook-session-setup-fail.conf
+++ b/tests/scripts/script-hook-session-setup-fail.conf
@@ -19,7 +19,7 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
# Setup script fails
-#?SCRIPT-HOOK SESSION-SETUP USER=have-password1
+#?SCRIPT-HOOK SESSION-SETUP XDG_SEAT=seat0 USER=have-password1
# Greeter starts
#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
diff --git a/tests/scripts/script-hooks.conf b/tests/scripts/script-hooks.conf
index a159428c..097437c8 100644
--- a/tests/scripts/script-hooks.conf
+++ b/tests/scripts/script-hooks.conf
@@ -23,8 +23,8 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK SESSION-SETUP USER=have-password1
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK SESSION-SETUP XDG_SEAT=seat0 USER=have-password1
# Session starts
#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
@@ -36,13 +36,13 @@ user-session=default
#?*SESSION-X-0 LOGOUT
# Script hook runs
-#?SCRIPT-HOOK SESSION-CLEANUP USER=have-password1
+#?SCRIPT-HOOK SESSION-CLEANUP XDG_SEAT=seat0 USER=have-password1
# X server stops
#?XSERVER-0 TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# X server starts
#?XSERVER-0 START VT=7 SEAT=seat0
@@ -53,8 +53,8 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK GREETER-SETUP USER=.*
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK GREETER-SETUP XDG_SEAT=seat0 USER=.*
# Greeter starts
#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
@@ -70,7 +70,7 @@ user-session=default
#?XSERVER-0 TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# Finish cleanup
#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/unity-mir-script-hooks.conf b/tests/scripts/unity-mir-script-hooks.conf
index 2d4c0b63..2e18eb5b 100644
--- a/tests/scripts/unity-mir-script-hooks.conf
+++ b/tests/scripts/unity-mir-script-hooks.conf
@@ -20,8 +20,8 @@ user-session=mir
#?*UNITY-SYSTEM-COMPOSITOR READY
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK SESSION-SETUP USER=have-password1
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK SESSION-SETUP XDG_SEAT=seat0 USER=have-password1
# Session starts
#?SESSION-MIR-session-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=mir XDG_SESSION_DESKTOP=mir USER=have-password1
@@ -34,9 +34,9 @@ user-session=mir
#?*SESSION-MIR-session-0 LOGOUT
# Script hooks runs
-#?SCRIPT-HOOK SESSION-CLEANUP USER=have-password1
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK GREETER-SETUP USER=.*
+#?SCRIPT-HOOK SESSION-CLEANUP XDG_SEAT=seat0 USER=have-password1
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK GREETER-SETUP XDG_SEAT=seat0 USER=.*
# Greeter starts
#?GREETER-MIR-greeter-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
@@ -53,7 +53,7 @@ user-session=mir
#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# Finish cleanup
#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/unity-script-hooks.conf b/tests/scripts/unity-script-hooks.conf
index 65ec8718..aa7db1e5 100644
--- a/tests/scripts/unity-script-hooks.conf
+++ b/tests/scripts/unity-script-hooks.conf
@@ -27,8 +27,8 @@ user-session=default
#?XMIR-0 INDICATE-READY
#?XMIR-0 ACCEPT-CONNECT
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK SESSION-SETUP USER=have-password1
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK SESSION-SETUP XDG_SEAT=seat0 USER=have-password1
# Session starts
#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
@@ -43,13 +43,13 @@ user-session=default
#?*SESSION-X-0 LOGOUT
# Script hook runs
-#?SCRIPT-HOOK SESSION-CLEANUP USER=have-password1
+#?SCRIPT-HOOK SESSION-CLEANUP XDG_SEAT=seat0 USER=have-password1
# X server stops
#?XMIR-0 TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# X server starts
#?XMIR-1 START SEAT=seat0 MIR-ID=x-1
@@ -60,8 +60,8 @@ user-session=default
#?XMIR-1 ACCEPT-CONNECT
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-SETUP
-#?SCRIPT-HOOK GREETER-SETUP USER=.*
+#?SCRIPT-HOOK DISPLAY-SETUP XDG_SEAT=seat0
+#?SCRIPT-HOOK GREETER-SETUP XDG_SEAT=seat0 USER=.*
# Greeter starts
#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter
@@ -80,7 +80,7 @@ user-session=default
#?XMIR-1 TERMINATE SIGNAL=15
# Script hooks run
-#?SCRIPT-HOOK DISPLAY-STOPPED
+#?SCRIPT-HOOK DISPLAY-STOPPED XDG_SEAT=seat0
# Finish cleanup
#?UNITY-SYSTEM-COMPOSITOR TERMINATE SIGNAL=15
diff --git a/tests/src/test-script-hook.c b/tests/src/test-script-hook.c
index e0d72084..5aeb73f7 100644
--- a/tests/src/test-script-hook.c
+++ b/tests/src/test-script-hook.c
@@ -28,6 +28,8 @@ main (int argc, char **argv)
status_text = g_string_new ("SCRIPT-HOOK");
g_string_append_printf (status_text, " %s", argv[1]);
+ if (g_getenv ("XDG_SEAT"))
+ g_string_append_printf (status_text, " XDG_SEAT=%s", g_getenv ("XDG_SEAT"));
if (g_getenv ("USER"))
g_string_append_printf (status_text, " USER=%s", g_getenv ("USER"));
status_notify ("%s", status_text->str);