Xfce Forum

Sub domains
 

You are not logged in.

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

pstein
Member
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)?

Peter

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

Offline

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

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,489

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:
/usr/share/polkit-1/actions/org.xfce.xfce4-terminal.policy

<?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">
<policyconfig>

  

 <vendor>xfce4-terminal</vendor>
 <vendor_url>https://xfce.org/</vendor_url>
 <icon_name>utilities-terminal</icon_name>


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

</policyconfig>

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.007 seconds, 7 queries executed - Memory usage: 523.27 KiB (Peak: 529.52 KiB) ]