IgnorantGuru / spacefm

SpaceFM File Manager
http://ignorantguru.github.com/spacefm/
GNU General Public License v3.0
487 stars 73 forks source link

Polkit support #713

Open nazar-pc opened 6 years ago

nazar-pc commented 6 years ago

I've switched from Nemo and having terminal opened in addition to root window is annoying (especially since I'm using tiling window manager and it occupies precious screen space). Would be nice to support Polkit and optional /usr/bin/pkexec for opening root windows.

IgnorantGuru commented 6 years ago

Not sure what you mean by "root windows", but anything run as root in SpaceFM is done via the terminal or graphical su commands set in Preferences|Advanced. If you set the graphical su command to su or sudo, it will automatically use a terminal. Set it to something like gksu if you don't want a terminal to open.

SpaceFM has no direct relationship to polkit and has no dependency on it, though udisks etc. may use it.

For further help, please describe exactly what you're doing step by step, what is occurring, and what you expected. This report is vague.

I'll look into adding pkexec as a graphical su option - not familiar with it off-hand.

nazar-pc commented 6 years ago

Not sure what you mean by "root windows"

File->Root Window

Set it to something like gksu if you don't want a terminal to open.

I don't have gksu installed as it is outdated piece of software that none of other apps use. Also there is no /usr/bin/pkexec option in settings and if I manually edit config file - my changes are reverted on start.

What I want:

No need to depend on it something, just an optional support.

Vladimir-csp commented 6 years ago

Yep, this would be a good move. Policy file would go in /usr/share/polkit-1/actions/org.spacefm.policy, Nemo's policy file is a good template.

gksu was dropped from Debian recently.

IgnorantGuru commented 6 years ago

Until it's added, you can set a custom graphical su command by setting graphical_su= in /etc/spacefm/spacefm.conf. You'll probably need to create a script and set graphical_su= to point to your own script, and have the script run pkexec with the proper arguments, but it can be done jfyi. Just be sure your script is root-owned in a root-owned dir like /usr/local/bin/. Then that option should appear in Preferences.

SpaceFM will run your script similarly to how it runs other su programs. For testing, you can run spacefm in a terminal to see how it's running it, or have your script print out the arguments ($1 $2 etc), and then use some of those arguments to run pkexec. This method allows you to use any su mechanism you like, any arguments, etc.

I wasn't aware gksu was removed from Debian, will look into that. Not good for those avoiding systemd and polkit, but gksu was never very well done either. But SpaceFM will use whatever you specify.

Vladimir-csp commented 6 years ago

Not diving in details, pkexec basically acts the same way as gksu, but requires a policy file that tells it that a certain program is allowed to be executed in certain conditions, like an active graphical session.

faurehu commented 5 years ago

I'd be happy with just a hotkey for File > Root Window