2

As these two questions show:

there is a need to control gedit tabs behavior when opening a file.

For example, always force to open in new window or always force to open in new tab, even if it is in an other workspace.

Is there a way to access this parameter somewhere?

NB: by "tabs" I mean the element of graphical interface allowing to edit multiple files in the same window as shown in the picture below

enter image description here

  • I'm using Gnome on multiple Ubuntu / non-Ubuntu OS. – Hugo Trentesaux Oct 16 '21 at 11:07
  • That does not answer the question. Let's say I only use Ubuntu 20.04. The question is still about this gedit parameter. – Hugo Trentesaux Oct 16 '21 at 11:14
  • Gedit DOES open multiple documents, into different tabs, in the same window. Doesn't yours? – heynnema Oct 18 '21 at 19:25
  • It depends on the context. If there is a gedit window in the same workspace, it does open a tab in the window, otherwise, it opens a new window. The question is about setting the preference: always open in tab / never open in tab. – Hugo Trentesaux Oct 19 '21 at 11:02
  • I just tried this exact sequence on my 21.04 system. I opened two .txt docs into Gedit, and both opened in new tabs in the same window. Then I moved the entire Gedit window to a different workspace, then opened a third .txt document, and it opened into a new third tab in the Gedit window in the other workspace. Do you have some special theme, gnome-extension, or non-stock Ubuntu mod installed? – heynnema Oct 19 '21 at 13:14
  • So you mean gedit opened the file in an existing window located in an other workspace? I never saw this behavior. And my Ubuntu is pretty much untouched. – Hugo Trentesaux Oct 19 '21 at 19:14
  • Log into a different user account, create one if you don't have one, and retry Gedit there and see if you have the same results. Report back. Start comments to me with @heynnema or I may miss them. – heynnema Oct 19 '21 at 19:19
  • @HugoTrentesaux please see my answer that attempts to achieve the desired end functionality. – Sri Apr 12 '22 at 05:01

1 Answers1

0

I have a similar requirement for certain works I do and need to open two text files in two different windows - one on laptop screen and the other on the extended screen. I couldn't find any setting to force using or not using tab for new file, perhaps it will be available in future. But for the time being I created a nautilus script to achieve the desired functionality.

Created a file named "Gedit-New-Window" in the nautilus scripts folder, added the required command and assigned executable permission to it. Here's how in terminal:

cd ~/.local/share/nautilus/scripts
nano Gedit-New-Window
#!/bin/sh
gedit --new-window $@
^O
^X
chmod +x Gedit-New-Window

For new Ubuntu/Linux users unfamiliar with nano: ^O (Ctrl + o) and ^X (Ctrl + x) above are nano keyboard commands to write out the file and exit.

Now, whenever a file needs to be opened in a Gedit new window, I right-click on the file in nautilus, click on "Scripts" in the context-menu, then click on "Gedit-New-Window" that shows as one of the options.

Sri
  • 1,662
  • 2
  • 20
  • 39