diff options
author | Stefan Kangas <stefankangas@gmail.com> | 2022-09-14 10:15:26 +0200 |
---|---|---|
committer | Stefan Kangas <stefankangas@gmail.com> | 2022-09-14 10:23:45 +0200 |
commit | fd70791218936da56a622707d3e09efc33feb16d (patch) | |
tree | bf0f9b4e6e72e7f472fc98c25133f2f971c49d10 /lisp/xdg.el | |
parent | d0b2eee278929238239efcdb90760906853b86b9 (diff) | |
download | emacs-fd70791218936da56a622707d3e09efc33feb16d.tar.gz |
Add new function xdg-current-desktop to xdg.el
* lisp/xdg.el (xdg-current-desktop): New function.
* test/lisp/xdg-tests.el (xdg-current-desktop): New test.
Diffstat (limited to 'lisp/xdg.el')
-rw-r--r-- | lisp/xdg.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/xdg.el b/lisp/xdg.el index dd0d51290dc..5d60aa2f283 100644 --- a/lisp/xdg.el +++ b/lisp/xdg.el @@ -281,6 +281,18 @@ Optional argument GROUP defaults to the string \"Desktop Entry\"." (when (null (string-match-p "[^[:blank:]]" (car res))) (pop res)) (nreverse res))) +(defun xdg-current-desktop () + "Return a list of strings identifying the current desktop environment. + +According to the XDG Desktop Entry Specification version 0.5: + + If $XDG_CURRENT_DESKTOP is set then it contains a + colon-separated list of strings ... $XDG_CURRENT_DESKTOP + should have been set by the login manager, according to the + value of the DesktopNames found in the session file." + (when-let ((ret (getenv "XDG_CURRENT_DESKTOP"))) + (string-split ret ":"))) + ;; MIME apps specification ;; https://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.1.html |