Latest Tweets

Dolphin singleClick option not working in XFCE4

Preamble

On an OpenSuse Leap GNU/Linux box, Dolphin’s singleClick option to open files and folders does not work if executing the file manager within an XFCE4 session. Instead, the user is forced to double-click every item to open it. Configuring the global KDE input settings does not help. Editing the ~./config/kdeglobals file and adding the SingleClick=true option does not fix the issue either.

Behind the scenes

To fix this issue, first we need to find where the program reads the singleClick option from and when it enables it. We start trying this issue on another GNU/Linux box running Debian Stretch, and we confirm it suffers from the same problem. So we get its sources and its build dependencies too (this way we are going to be able to build our own customised version of Dolphin, if need be):

apt-get source dolphin
apt-get build-dep dolphin

After that, we look for the string “singleClick” using the grep command inside the src directory:

grep -R “singleClick” *|grep false
src/kitemviews/kitemlistcontroller.cpp: m_singleClickActivationEnforced(false),

According to the previous result, there’s an explicit call to the m_singleClickActivationEnforced() method in src/kitemviews/kitemlistcontroller.cpp. This file has its header file counterpart as well, so we start by having a look at the headers and we find this:

   /**
     * If set to true, the signals itemActivated() and itemsActivated() are emitted
     * after a single-click of the left mouse button. If set to false (the default),
     * the setting from style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) is used.
     */
    void setSingleClickActivationEnforced(bool singleClick);
    bool singleClickActivationEnforced() const;

It seems pretty obvious then. So according to the comment above, Dolphin is disabling the SingleClick option by default (it’s hard-coded in the call m_singleClickActivationEnforced(false) as we’ve seen earlier). We can change the source code and re-build dolphin to make sure it works, although this solution is far from being optimal because at the next package upgrade, this modification will be lost and the double click issue will re-appear. But we can try it anyway just for fun!

Building our own Dolphin binary with SingleClick enabled by default

We edit the src/kitemviews/kitemlistcontroller.cpp and replace the call to the method m_singleClickActivationEnforced(false) with m_singleClickActivationEnforced(true). Then, we build the binary:

fakeroot debian/rules binary

Once the building process is over, we install all the built packages:

mkdir ../debs ; mv ../*.deb ../debs; su -c “dpkg -i -R ../debs”

If we run the command “dolphin” now, we will have the SingleClick option enabled. So far so good, but … as we have previoisly stated, at the next package upgrade this customisation will be lost.

QT5 Styles without KDE integration

According to the source comment we have previously found, style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) is used in order to enable or disable the SingleClick option within Dolphin. If we google this we find that this is a QT5 Style setting (see http://doc.qt.io/qt-5/qstyle.html) , and it can be easily manipulated with the Qt5ct tool. We do not have this tool as a package for Debian stable, but we do have it for OpenSUSE Leap. So on the computer where this issue was first reported we use Yast2 to install the qt5ct package. Then, we add the following line to the .bashrc file of the affected user:

export QT_QPA_PLATFORMTHEME=qt5ct

Finally, we run the qt5ct tool and we tick the “Activate item on single-click” option on the “Interface” tab, as shown below:

After making this change, we run Dolphin again and this time we have the SingleClick option enabled all right!