Make Gedit Text Editor Always Opens in New Tab in Ubuntu 18.04

Last updated: September 1, 2018

gnome shell

The default Gedit text editor in Ubuntu 18.04 always opens file in a new window, even though there’s already an existing instance. And there’s no easy option to change the behavior.

Thanks to fossfreedom, you can re-built Gedit pakages so to always open files in new tabs in the same gedit window.

1. Open terminal either via Ctrl+Alt+T shortcut key or by searching for ‘terminal’ from software launcher.

2. When terminal opens, paste the command below and hit run to install the building tools:

sudo apt-get install devscripts build-essential fakeroot

3. Launch Software & Updates, and click enable download Source code from Ubuntu repositories.

4. In user downloads, create a build folder and navigate to the directory.

cd ~/Downloads/ && mkdir build && cd build

5. Download the gedit source code via command:

sudo apt-get update; apt-get source gedit

Type your password (no asterisks feedback) when it prompts

6. Next edit the source file gedit-app.c:

cd gedit-* && gedit gedit/gedit-app.c

When the file opens, add new line return TRUE; as the picture shows (line 320 for Ubuntu 18.04):

7. Give a unique package name by editing the debian/changelog file.

gedit debian/changelog

8. Finally rebuild the gedit via commands:

sudo apt-get build-dep gedit

debuild -i -us -uc -b

The commands will take a few minutes building the gedit text editor packages.

9. At last, install the new packages via command and enjoy!

cd ~/Downloads/build/ && sudo dpkg -i gedit*.deb

In addition, you may lock the changes so it won’t be overwritten after installing system updates.

And it can be done easily via Synaptic package manager (available in Ubuntu Software). Simply search for ‘gedit’ and choose lock version for gedit and gedit-common packages one by one.

Twitter

I'm a freelance blogger who started using Ubuntu in 2007 and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please comment to let me know if the tutorial is outdated! And, notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me via ubuntuhandbook1@gmail.com Buy me a coffee: https://ko-fi.com/ubuntuhandbook1 |

3 responses to Make Gedit Text Editor Always Opens in New Tab in Ubuntu 18.04

  1. This works great! Thank you! Also very useful as an example on how to do source tweaks in general.

  2. No, please don’t do that.
    gsettings set org.gnome.gedit.preferences.ui show-tabs-mode 'always'

    ref. https://askubuntu.com/questions/960589/configure-gedit-to-always-open-documents-in-new-tab

  3. Unfortunatelly, neither gsettings or changing desktop files worked for me on 18.04 64bit, so I had to recompile.