Add new function xdg-session-type to xdg.el

* lisp/xdg.el (xdg-session-type): New function.
This commit is contained in:
Stefan Kangas 2022-09-21 14:00:23 +02:00
parent 7a36828dc3
commit b0a85111e5
2 changed files with 19 additions and 0 deletions

View file

@ -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

View 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)))))))
;; 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