summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2022-09-21 14:00:23 +0200
committerStefan Kangas <stefankangas@gmail.com>2022-09-21 14:00:23 +0200
commitb0a85111e5e9c9aa8802a359b19034e5e88cd22d (patch)
tree4e3dab6e399a12a54d384051ba7aad814f93c695
parent7a36828dc37e3dd79367e35664f5ae5349b278f0 (diff)
downloademacs-b0a85111e5e9c9aa8802a359b19034e5e88cd22d.tar.gz
Add new function xdg-session-type to xdg.el
* lisp/xdg.el (xdg-session-type): New function.
-rw-r--r--etc/NEWS6
-rw-r--r--lisp/xdg.el13
2 files changed, 19 insertions, 0 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 97174ba7a2d..398cc2598e2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3575,6 +3575,12 @@ identify the current desktop environment.
(This variable was introduced in XDG Desktop Entry Specification
version 1.2.)
+---
+*** New function 'xdg-session-type'.
+It returns the 'XDG_SESSION_TYPE' environment variable. (This is not
+part of any official standard; see the man page pam_systemd(8) for
+more information.)
+
+++
** New macro 'with-delayed-message'.
This macro is like 'progn', but will output the specified message if
diff --git a/lisp/xdg.el b/lisp/xdg.el
index 5d60aa2f283..82f1f07df54 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -30,6 +30,7 @@
;; - Thumbnail Managing Standard
;; - xdg-user-dirs configuration
;; - Desktop Entry Specification
+;; - Unofficial extension $XDG_SESSION_TYPE from systemd
;;; Code:
@@ -397,6 +398,18 @@ Results are cached in `xdg-mime-table'."
(put 'xdg-mime-table 'mtime (current-time)))
(puthash subtype (delq nil files) (cdr (assoc type xdg-mime-table)))))))
+
+;; Unofficial extension from systemd.
+
+(defun xdg-session-type ()
+ "Return the value of $XDG_SESSION_TYPE.
+Should be one of \"unspecified\", \"tty\", \"x11\", \"wayland\",
+or \"mir\".
+
+This is not part of any official Freedesktop.org standard, but is
+documented in the man page `pam_systemd'."
+ (getenv "XDG_SESSION_TYPE"))
+
(provide 'xdg)
;;; xdg.el ends here