]> git.eshelyaron.com Git - emacs.git/commitdiff
Add new function xdg-session-type to xdg.el
authorStefan Kangas <stefankangas@gmail.com>
Wed, 21 Sep 2022 12:00:23 +0000 (14:00 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Wed, 21 Sep 2022 12:00:23 +0000 (14:00 +0200)
* lisp/xdg.el (xdg-session-type): New function.

etc/NEWS
lisp/xdg.el

index 97174ba7a2d8e81a4f3dbd89b80dd71fbfba661c..398cc2598e2c785dedc1d53fc28381a56ee7593c 100644 (file)
--- 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
index 5d60aa2f283717d24098b81781a67c5b338ecf0c..82f1f07df54159d4c88c920630255b56e13456ff 100644 (file)
@@ -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)))))))
 
+\f
+;; 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