Xfce Forum

Sub domains
 

You are not logged in.

#1 2022-06-23 08:08:27

asinoro
Member
Registered: 2022-06-13
Posts: 21

[SOLVED] Edit as Root Thunar not working at custom actions

I use Mint 20.3, as normal user the Edit as Root don't work, it works with LMDE 5 XFCE with the command "pkexec mousepad %f". If I remember well, it didn't work also on Mint 20.
I have tried pkexec mousepad %f, pkexec xed %f, pkexec leafpad %f, no one of them work, any idea?

Last edited by asinoro (2022-06-24 13:01:03)

Offline

#2 2022-06-23 09:53:54

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 8,939

Re: [SOLVED] Edit as Root Thunar not working at custom actions

What happens if you run those commands in a terminal window (replace %f with the name of an actual file)?

Do you have an authentication agent installed and running? I believe the package is called policykit-1-gnome and "Policykit Authentication Agent" is checked of in Settings Manager > Session and Startup > Application Autostart.

Offline

#3 2022-06-23 10:25:43

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

ToZ wrote:

What happens if you run those commands in a terminal window (replace %f with the name of an actual file)?

Do you have an authentication agent installed and running? I believe the package is called policykit-1-gnome and "Policykit Authentication Agent" is checked of in Settings Manager > Session and Startup > Application Autostart.

This is ok.

Only mousepad works well and opens the fstab, but it is not listed as alternative gnome-text-editor, which means it is not configure as default text editor. If I tried to select to open the documents with mousepad from thunar  it works but not with custom actions.
To make mousepad the default editor, where xed is the default editor, or it is something else? MX21 at custom actions has  /usr/bin/mx-edit-as-root.sh %f;, which make this custom action complicate.

~$ pkexec gedit
Error executing command as another user: Request dismissed
 ~ $ pkexec gedit /etc/fstab
Unable to init server: Could not connect: Connection refused

(gedit:168603): Gtk-WARNING **: 12:55:51.472: cannot open display: 
 ~ $ pkexec mousepad /etc/fstab
 ~ $ pkexec xed  /etc/fstab
Unable to init server: Could not connect: Connection refused

(xed:169287): Gtk-WARNING **: 12:57:46.456: cannot open display: 
 ~ $ pkexec leafpad /etc/fstab
leafpad: Cannot open display: 
 ~ $ pkexec mousepad /etc/fstab


 ~ $ update-alternatives --config gnome-text-editor

There are 2 choices for the alternative gnome-text-editor (providing /usr/bin/gnome-text-editor).

  Selection    Path              Priority   Status
------------------------------------------------------------
* 0            /usr/bin/gedit     50        auto mode
  1            /usr/bin/gedit     50        manual mode
  2            /usr/bin/leafpad   40        manual mode

Press <enter> to keep the current choice[*], or type selection number: 

Last edited by asinoro (2022-06-23 10:28:49)

Offline

#4 2022-06-24 05:16:20

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

Even if I give higher priority to mousepad still do not work at custom actions.

update-alternatives --config gnome-text-editor
There are 3 choices for the alternative gnome-text-editor (providing /usr/bin/gnome-text-editor).

  Selection    Path               Priority   Status


------------------------------------------------------------
* 0            /usr/bin/mousepad   60        auto mode
  1            /usr/bin/gedit      50        manual mode
  2            /usr/bin/leafpad    40        manual mode
  3            /usr/bin/mousepad   60        manual mode

Press <enter> to keep the current choice[*], or type selection number:

Offline

#5 2022-06-24 11:20:56

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 8,939

Re: [SOLVED] Edit as Root Thunar not working at custom actions

What does your "Edit as root" custom action look like? If "pkexec mousepad" works, then can you just change the custom action to do that?

Also, what does the following return after you set mousepad with the highest priority using update-alternatives:

xdg-mime query default text/plain

Last edited by ToZ (2022-06-24 11:38:13)

Offline

#6 2022-06-24 11:58:52

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

ToZ wrote:

What does your "Edit as root" custom action look like? If "pkexec mousepad" works, then can you just change the custom action to do that?

Also, what does the following return after you set mousepad with the highest priority using update-alternatives:

xdg-mime query default text/plain

It gives

xdg-mime query default text/plain
xed.desktop

Both commands do not work at custom actions, but they work at terminal.
pkexec mousepad %f

And the one who used to work on Mint 19.3.
xed admin://%f

Last edited by asinoro (2022-06-24 12:00:33)

Offline

#7 2022-06-24 12:03:22

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 8,939

Re: [SOLVED] Edit as Root Thunar not working at custom actions

Can you post back the contents of ~/.config/Thunar/uca.xml?

Offline

#8 2022-06-24 12:06:37

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
	<icon>Terminal</icon>
	<name>Open in Terminal</name>
	<unique-id>1513462562051519-1</unique-id>
	<command>exo-open --working-directory %f --launch TerminalEmulator</command>
	<description>Open terminal in the selected folder</description>
	<patterns>*</patterns>
	<directories/>
</action>
<action>
	<icon>stock_open</icon>
	<name>Open as Root</name>
	<unique-id>1513462562051855-2</unique-id>
	<command> pkexec thunar %F</command>
	<description>Open the folder with administration privileges</description>
	<patterns>*</patterns>
	<directories/>
</action>
<action>
	<icon>accessories-text-editor</icon>
	<name>Edit as Root</name>
	<unique-id>1653578422770443-3</unique-id>
	<command>pkexec mousepad %f</command>
	<description>Root edit file</description>
	<patterns>*</patterns>
</action>
<action>
	<icon>emblem-symbolic-link</icon>
	<name>Create a Link</name>
	<unique-id>1513462562052267-3</unique-id>
	<command>ln -s %f  &apos;Link to %n&apos;</command>
	<description>Create a symbolic link for each selected item</description>
	<patterns>*</patterns>
	<directories/>
	<other-files/>
</action>
<action>
	<icon>gnome-run</icon>
	<name>Check SHA256</name>
	<unique-id>1513462562052313-4</unique-id>
	<command>mint-sha256sum %f</command>
	<description>Computes SHA256 checksum for the selected file.</description>
	<patterns>*.iso;*.ISO</patterns>
	<audio-files/>
	<image-files/>
	<other-files/>
	<text-files/>
	<video-files/>
</action>
<action>
	<icon>media-optical</icon>
	<name>Mount/Unmount ISO</name>
	<unique-id>1513462562052355-5</unique-id>
	<command>mountiso %f %n</command>
	<description>Mount or Unmount ISO file.</description>
	<patterns>*.iso;*.ISO</patterns>
	<directories/>
	<other-files/>
</action>
<action>
	<icon>gtk-find</icon>
	<name>Search</name>
	<unique-id>1513462562052758-6</unique-id>
	<command>catfish %f</command>
	<description>Search for Files</description>
	<patterns>*</patterns>
	<directories/>
	<audio-files/>
	<image-files/>
	<other-files/>
	<text-files/>
	<video-files/>
</action>
<action>
	<icon>fonts</icon>
	<name>Install .ttf Font</name>
	<unique-id>1513462562052826-7</unique-id>
	<command>fontinstaller %f %n</command>
	<description>Installs .ttf Fonts for the user or system</description>
	<patterns>*.ttf;*.TTF</patterns>
	<other-files/>
</action>
</actions>

Offline

#9 2022-06-24 12:26:58

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 8,939

Re: [SOLVED] Edit as Root Thunar not working at custom actions

Ok looks good. Try another "Edit as root" action and afterwards, post back the last 10-20 lines of ~/.xsession-errors.

Also, when you say it "doesn't work" does anything happen on the screen? An error message?

Offline

#10 2022-06-24 12:41:30

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

when I do right-click there is not any option to select the file to edit. On the contrary, there is the option to open root folder.
Do I have to logout and login every time I change the options at custom settings?

Offline

#11 2022-06-24 12:55:28

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 8,939

Re: [SOLVED] Edit as Root Thunar not working at custom actions

asinoro wrote:

when I do right-click there is not any option to select the file to edit. On the contrary, there is the option to open root folder.

Make sure that on the "Appearance" tab of the custom action that you've checked off "Text" and "Other".

Do I have to logout and login every time I change the options at custom settings?

No.

Offline

#12 2022-06-24 12:59:13

asinoro
Member
Registered: 2022-06-13
Posts: 21

Re: [SOLVED] Edit as Root Thunar not working at custom actions

The solution was very simple, sorry for the trouble I gave you, the solution was to activate the files Edit Action > Appearance conditions - check text files also other files.
https://forums.linuxmint.com/viewtopic. … 0#p2191800

Offline

Board footer

Powered by FluxBB