Make sure to query dbus as the right user

This was funny: shell-command-to-string runs on the buffer current
directory; if we were visiting a file with tramp (e.g. as root), then
qdbus would be invoked as root, resulting in kactivitymanager being
spawned as root, resulting in kglobalaccel being spawned as root ⇒
catastrophe!
master
Jacopo De Simoi 3 years ago
parent 28c69a3b24
commit a3b196b094
  1. 5
      global.org

@ -2433,11 +2433,10 @@
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun kde-current-activity () (defun kde-current-activity ()
"Returns the current KDE activity" "Returns the current KDE activity"
(substring (shell-command-to-string "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.CurrentActivity") 0 -1) (substring (let ((default-directory "~")) (shell-command-to-string "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.CurrentActivity")) 0 -1))
)
(defun kde-current-activity-name () (defun kde-current-activity-name ()
"Returns the name of the current KDE activity" "Returns the name of the current KDE activity"
(substring (shell-command-to-string (concat "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName " (kde-current-activity))) 0 -1)) (substring (let ((default-directory "~")) (shell-command-to-string (concat "qdbus org.kde.ActivityManager /ActivityManager/Activities org.kde.ActivityManager.Activities.ActivityName " (kde-current-activity)))) 0 -1))
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp

Loading…
Cancel
Save