I'm trying to be a good boy and stop using
gksudo, especially since it just got orphaned in the 18.04 daily builds (note, this question is not specific to 18.04).
In the bad old days of using
gksudo, I'd typically navigate to a folder containing the file I wish to edit (I use pcmanfm) then select Tools/Open Current Folder In Terminal from the menu. Then I'd type
gksudo leafpad [file-I-wish-to-edit] in the newly opened terminal.
Using information in the very useful answer How to configure pkexec? I set my .bash_aliases and I am able to now type
pkexec leafpad [file-I-wish-to-edit] in the newly opened terminal and I don't get any errors. Sadly, though I get a blank file instead of what I wanted. I have determined that this is because leafpad is looking in
/root instead of the folder I wished to be in.
How can I maintain my halo, continue to use
pkexec instead of
gksudo, yet retain the functionality I'm used to?