Xfce Forum

Sub domains

You are not logged in.

#1 2020-02-10 11:56:13

Registered: 2013-11-25
Posts: 8

How to add "Open Terminal here" and "execute with sudo" to Thunar?

How can I add "Open Terminal here" to the context menu of folders in Thunar FileEpxlorer?

How can I add "execute with sudo" to the context menu of (executable) files in execute FileExplorer?
That means if I right click in the right pane of Thunar onto e.g. a *.sh file then this shell script should be executed with sudo rights
just as if I entered the corresponding command in terminal.

Is there another, alternative File Explorer which has these context menus already built-in/preinstalled (after installation)?


Last edited by pstein (2020-02-10 11:57:38)


#2 2020-02-10 12:25:03

From: Canada
Registered: 2011-06-02
Posts: 6,863

Re: How to add "Open Terminal here" and "execute with sudo" to Thunar?

"Open Terminal Here" should be part of Thunar already. Which distro and which version of Thunar are you running?
There are some example thunar custom actions listed here. (Note: if using a newer distros, you should replace "gksu" with "pkexec", but you'll need the proper polkit config file in place first)

As for the Run as Root entry directly on a .sh file, create a custom action that looks like this:
Name = Run as Root
Description = Run as root
Command = gksu "xfce4-terminal -x %f"
Appearance Conditions = "Other files' checked and File Pattern = *.sh

Note: you can use pkexec instead:

pkexec xfce4-terminal -x %f

...of gksu but you need to have a proper policykit config file in place:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC
 "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"



 <action id="org.xfce.xfce4-terminal">
 <description>Run xfce4-terminal as root</description>
 <message>Authentication is required to run xfce4-terminal as root.</message>
 <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/xfce4-terminal</annotate>
 <annotate key="org.freedesktop.policykit.exec.allow_gui">true</annotate>



Board footer

Powered by FluxBB