HowTo: gksu gedit /path also opens second empty tab

Write tutorials here
There are more tutorials here
Forum rules
Do not start a support topic here please. Before you post please read this

HowTo: gksu gedit /path also opens second empty tab

Postby altair4 on Mon Aug 13, 2012 8:46 am

gksu gedit /path also opens second empty tab

If you run the following command:
Code: Select all
gksu gedit /etc/fstab

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: ... bug/838404 ... bug/796076

It isn't going to be fixed because the official Gnome position ( which veteran Gnome users may find surprising ) is:
Christian Persch [developer] 2011-09-03 08:35:38 UTC
You shouldn't start GNOME programmes with elevated privileges, it's not

I may have found a solution in a blog posting I can't find at the moment. For those that are interested:

[1] Create a file:
Code: Select all
gksu gedit /usr/local/bin/ggedit

Note: That's a "ggedit" not a "gedit"

[2] Add this content:
Code: Select all
gedit "$1" < /dev/null

[3] Save the file and make it executable:
Code: Select all
sudo chmod +x /usr/local/bin/ggedit

Now as a test run the following command:
Code: Select all
gksu ggedit /etc/fstab

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.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.
Level 16
Level 16
Posts: 6219
Joined: Tue Feb 03, 2009 10:27 am

Linux Mint is funded by ads and donations.

Return to Tutorials

Who is online

Users browsing this forum: Google Feedfetcher, Yahoo [Bot] and 8 guests