Do

Use Gnome-Do to open a file with gksu/sudo

Asked by pragmattica

If I want to edit /etc/X11/xorg.conf, for example, I can use "locate files" to find it, and then "open" to open it in gedit. However, if I make changes, I cannot save them, because gedit wasn't opened with "gksu". Is there any way to do this?

Question information

Language:
English Edit question
Status:
Solved
For:
Do Edit question
Assignee:
No assignee Edit question
Solved by:
pragmattica
Solved:
Last query:
Last reply:
Revision history for this message
Kjetil Rydland (kjetilrydl) said :
#1

You can open it with the Run in Terminal-command. Input should be something like "sudo gedit /etc/X11/xorg.conf", press tab, and select the "Run in Terminal"-command.

Revision history for this message
pragmattica (bnsmith) said :
#2

I do agree that this is a way to accomplish the task. However, I would like to look into this further in an attempt to open up the possibility of a faster, better solution.

The problem with the solution described above is that it doesn't play to Gnome-Do's strengths. You still have to type in that whole "sudo gedit /etc/X11/xorg.conf" string. You wouldn't even be able to use tab-completion to help enter the path. If the path were even longer than this, it would be even worse. You'd be much better off to just open a terminal and type the command in there, in which case, Gnome-Do isn't really helping all that much. It's just a quicker way to open a terminal instead of clicking on Applications -> Accessories -> Terminal.

I'd rather have an "Open as Root" action. This way, I could open Gnome-Do, enter "xorg.conf", hit Tab, find the "locate" option, get the correct file that I'm looking for, hit Tab, find the "Open as Root" action, hit Enter, and I'm done. Less typing would be required this way. Is this completely off-base? Is there something simple that I'm missing here? Thanks for reading this rather long question.

Revision history for this message
pragmattica (bnsmith) said :
#3

I think that I've found something that solves my problem well enough that I have decided to describe it here. The answer is simple, really. Just create a new "Text Editor (root)" menu option in your Applications menu (this option would use a command like "gksu gedit %U"). Then you can use the newly re-enabled "Open With" option in Gnome-Do to open a located file with that menu option. Naturally, you can't just use *any* program you want as root, only the ones that you have specifically created menu entries for. Still, this works well enough for me.

Revision history for this message
Peter VandeHaar (pjvandehaar) said :
#4

Should this work by "<file> | open with | root | <program>"?
Also, "Run as root" should be added alongside "Run" (eg. "<program> | run as root"

Revision history for this message
Alex Launi (alexlauni) said :
#5

On Wed, Jun 24, 2009 at 7:56 AM, Peter VandeHaar <
<email address hidden>> wrote:

> Should this work by "<file> | open with | root | <program>"?
>

We're not adding a 4th pane for this.

> Also, "Run as root" should be added alongside "Run" (eg. "<program> | run
> as root"
>

But you could easily submit a patch for a "Run as administrator" action.

--
--Alex Launi