XFCE4 tips, tricks on Arch Linux

My default Desktop Environment on Arch Linux is XFCE4. It’s lightweight, fast and easy to use. I faced with many problem during working process, so I wrote them here to share how to fix it with you, hope they are useful and help you solve your issue.

XFCE4 tips tricks on Arch Linux

Thunar doesn’t save preferences when running with root privilege

At this time, gksudo is deprecated, so we’re using pkexec instead. Like others, I run Thunar with root privilege frequently for many purposes. I create a custom action to quickly run root Thunar with right-click context menu. One day, I found it’s not saved any personal settings, it’s always appeared with default settings everytime I ran it. To find the cause of that problem, I tried to run it via Terminal:

$ pkexec thunar
thunar: Failed to initialize Xfconf: Error spawning command line ?dbus-launch --autolaunch=612b69cd90a747df892ae687331db46d --binary-syntax --close-stderr?: Child process exited with code 1

(thunar:9498): thunar-WARNING **: 10:27:53.857: Name 'org.xfce.FileManager' lost on the message dbus.

(thunar:9498): thunar-WARNING **: 10:27:53.857: Name 'org.freedesktop.FileManager1' lost on the message dbus.
ThunarThumbnailer: failed to create proxy: Error spawning command line “dbus-launch --autolaunch=612b69cd90a747df892ae687331db46d --binary-syntax --close-stderr”: Child process exited with code 1

With the debug messages above, I find the cause of this problem that was described in pkexec manual:

pkexec will not by default allow you to run X11 applications as another user since the $DISPLAY and $XAUTHORITY environment variables are not set. These two variables will be retained if the org.freedesktop.policykit.exec.allow_gui annotation on an action is set to a nonempty value; this is discouraged, though, and should only be used for legacy programs.

After spend a lot of time to look around, I found the solution below:

  • Add a xml file that define how to run gui apps with root privilege at the location: /usr/share/polkit-1/actions/org.freedesktop.policykit.pkexec.policy
  • This file above give you policykit authentication for thunar, to make another app is runable with pkexec, just define it into that file.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<action id="org.freedesktop.policykit.pkexec.run-thunar">
        <description>Run Thunar</description>
        <message>Authentication is required to run Thunar as Root</message>
        <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/thunar</annotate>
        <annotate key="org.freedesktop.policykit.exec.allow_gui">TRUE</annotate>

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.