From: Stefan Kangas Date: Wed, 21 Sep 2022 12:00:23 +0000 (+0200) Subject: Add new function xdg-session-type to xdg.el X-Git-Tag: emacs-29.0.90~1856^2~327 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b0a85111e5e9c9aa8802a359b19034e5e88cd22d;p=emacs.git Add new function xdg-session-type to xdg.el * lisp/xdg.el (xdg-session-type): New function. --- 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