emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master b0a85111e5: Add new function xdg-session-type to xdg.el


From: Stefan Kangas
Subject: master b0a85111e5: Add new function xdg-session-type to xdg.el
Date: Wed, 21 Sep 2022 08:00:32 -0400 (EDT)

branch: master
commit b0a85111e5e9c9aa8802a359b19034e5e88cd22d
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Add new function xdg-session-type to xdg.el
    
    * lisp/xdg.el (xdg-session-type): New function.
---
 etc/NEWS    |  6 ++++++
 lisp/xdg.el | 13 +++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/etc/NEWS b/etc/NEWS
index 97174ba7a2..398cc2598e 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 5d60aa2f28..82f1f07df5 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]