HowTo: gksu gedit /path also opens second empty tab
Posted: Mon Aug 13, 2012 8:46 am
gksu gedit /path also opens second empty tab
If you run the following command:
It will open up a root instance of gedit to fstab but also creates a second tab titled "Untitled Document 1". I find this incredibly annoying and have resorted to using leafpad to avoid it. There are some bug reports detailing this:
https://bugs.launchpad.net/ubuntu/+sour ... bug/838404
https://bugzilla.gnome.org/show_bug.cgi?id=658100
https://bugs.launchpad.net/ubuntu/+sour ... bug/796076
It isn't going to be fixed because the official Gnome position ( which veteran Gnome users may find surprising ) is:
[1] Create a file:
Note: That's a "ggedit" not a "gedit"
[2] Add this content:
[3] Save the file and make it executable:
Now as a test run the following command:
If should open up without the second tab.
Note: There is probably a way to do this by editing /usr/share/applications/gedit.desktop ( don't try to browse to this in Nautilus - you need a real file manager like XFE to see *.desktop files ). I didn't do it there because I figured that any update to the system would override it and besides I'd rather not mess with system files if I can avoid it.
If you run the following command:
Code: Select all
gksu gedit /etc/fstab
https://bugs.launchpad.net/ubuntu/+sour ... bug/838404
https://bugzilla.gnome.org/show_bug.cgi?id=658100
https://bugs.launchpad.net/ubuntu/+sour ... bug/796076
It isn't going to be fixed because the official Gnome position ( which veteran Gnome users may find surprising ) is:
I may have found a solution in a blog posting I can't find at the moment. For those that are interested:Christian Persch [developer] 2011-09-03 08:35:38 UTC
You shouldn't start GNOME programmes with elevated privileges, it's not
supported.
[1] Create a file:
Code: Select all
gksu gedit /usr/local/bin/ggedit
[2] Add this content:
Code: Select all
#!/bin/bash
gedit "$1" < /dev/null
Code: Select all
sudo chmod +x /usr/local/bin/ggedit
Code: Select all
gksu ggedit /etc/fstab
Note: There is probably a way to do this by editing /usr/share/applications/gedit.desktop ( don't try to browse to this in Nautilus - you need a real file manager like XFE to see *.desktop files ). I didn't do it there because I figured that any update to the system would override it and besides I'd rather not mess with system files if I can avoid it.