Dolphin custom action open as root

How To: Add “Open As Root” Entry Manually To KDE’s Dolphin File Manager?

Updated 29 Sep, 2016

Add custom action that allows you to open a Dolphin file manager iteration with root privileges from within a graphic interface.

Linux and in particular KDE are so customizable that you’ll have hard time to find a feature that you like which isn’t already present or easily add-able as an extension.

However, on the rare occasions where the given supply isn’t quite to your satisfaction, there’s always the good old method of paving your own road, so to speak.

In the following, I shall demonstrate how to create a custom action (as per Xfce) that will let you launch a root-privileged Dolphin from within a non-privileged one.

Note that although I’m using it to create a “Open As Root” entry in the right-click context menu, the same method can apply to any other custom action you may desire.

Requirements

  • Dolphin file manager (obviously).
  • kdesu – if it’s not installed by default, install it.

Create The Entry

In KDE 5 there are basically two places where Plasma, your desktop environment, will “look” for custom actions by default:

  1. ~/.local/share/kservices5/ServiceMenus/
  2. /usr/share/kservices5/ServiceMenus/

The difference is that the first one will only apply to a specific user whereas the latter will apply to all users.

Note: if any of the above paths does not exist on your system –

  1. Make sure that your distribution doesn’t use a customized path.
  2. Create the path.

Now, navigate into the location you wish to create the custom action in. (Remember, use location #1 for only your user and #2 if you want the custom action to be available for evryone that uses the system!)

Create a text file and name it an easily to remember name with the suffix “.desktop”, like this: root_dolphin.dekstop.

Copy paste the following text inside it:

Open Dolphin as root service text

Open Dolphin as root service text

[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=openRootDolphinHere;
X-KDE-AuthorizeAction=shell_access

[Desktop Action openRootDolphinHere]
Name=Open Root Dolphin Here
TryExec=kdesu
Exec=kdesu dolphin %U
Icon=folder-red

Save and close the file.

Restart Dolphin, right click and check whether your newly created entry is inside Actions.

If not, click Control on the top bar > Configure Dolphin… > Services > check Open Root Dolphin Here then click OK.

Open Dolphin as root check in services

Open Dolphin as root check in services

Right click, and there you have it inside Actions item.

COMMENTS (beta)

?
Add your comment here...