Why does gedit keep randomly opening new instances when opening files from nautilus? The 2019...

Take groceries in checked luggage

Finding the path in a graph from A to B then back to A with a minimum of shared edges

How are presidential pardons supposed to be used?

Can a novice safely splice in wire to lengthen 5V charging cable?

Can a 1st-level character have an ability score above 18?

Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?

Is it ok to offer lower paid work as a trial period before negotiating for a full-time job?

How does this infinite series simplify to an integral?

The following signatures were invalid: EXPKEYSIG 1397BC53640DB551

What's the point in a preamp?

Windows 10: How to Lock (not sleep) laptop on lid close?

How does ice melt when immersed in water

Is above average number of years spent on PhD considered a red flag in future academia or industry positions?

RT6224D-based step down circuit yields 0V - why?

Can smartphones with the same camera sensor have different image quality?

Are spiders unable to hurt humans, especially very small spiders?

Why can't wing-mounted spoilers be used to steepen approaches?

Is every episode of "Where are my Pants?" identical?

Did the new image of black hole confirm the general theory of relativity?

Who or what is the being for whom Being is a question for Heidegger?

What can I do if neighbor is blocking my solar panels intentionally?

He got a vote 80% that of Emmanuel Macron’s

How to delete random line from file using Unix command?

Does the AirPods case need to be around while listening via an iOS Device?



Why does gedit keep randomly opening new instances when opening files from nautilus?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)How to prevent updating of a specific package?How to solve dpkg-source source problem when building a package?Gedit 3.6.1, how to increase the number of recent files from its default of 5?How to open a *.pdf in an already existing instance of Okular (independent of in which workspace that instance resides)?How to avoid opening duplicate files in new windows in gedit?avconv assert error mpah.frame_size when trying to convert WAV to MP3 under 14.04gedit - open files in new tabsIs there a way to open a text file in an already open instance of gedit?How do I stop gedit from opening anything?configure gedit to always open in new windowGedit 3.6.1, how to increase the number of recent files from its default of 5?How to get another text-file be opened in new tab in mousepad?When I open gedit from terminal, I am unable to use terminal for anything else until I close gedit. Why?Nautilus - When I select to open with gEdit, settings aren't savedWhy is gedit not populating the Open Recent files menu option on 16.04Xubuntu/xfce Some .txt files won't open text editorConfigure Gedit to always open documents in new tab





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







32















Oh how I love Ubuntu and all its features, but this "bug" has been making me angry for so long and I've finally decided to ask for help here.



I've assigned all .php files to be opened with gedit whenever I double-click them in nautilus. Now, the behavior is strange.




  1. I have no gedit running

  2. I double click a file to be opened

  3. A gedit window opens and the file loads

  4. I double click another file to be opened


Now, there are 2 possible outcomes:



5A) The file opens in the same gedit window in a new tab



5B) The file opens in a new gedit window, resulting in 2 gedits running.



Whether A or B happens seems to be totally random and keeps on going infinitely. That means I double click on 100 files and I might end up with 60 gedits, some of which will have 1 tab, some will have 2 tabs, some will have 3 tabs...



This is extremely annoying and a fix for this would be very appreciated. Anyone ever tried to fix this problem?



This has happened in Ubuntu 10.04, 10.10 and 11.10. All Ubuntu versions I've ever tested.










share|improve this question































    32















    Oh how I love Ubuntu and all its features, but this "bug" has been making me angry for so long and I've finally decided to ask for help here.



    I've assigned all .php files to be opened with gedit whenever I double-click them in nautilus. Now, the behavior is strange.




    1. I have no gedit running

    2. I double click a file to be opened

    3. A gedit window opens and the file loads

    4. I double click another file to be opened


    Now, there are 2 possible outcomes:



    5A) The file opens in the same gedit window in a new tab



    5B) The file opens in a new gedit window, resulting in 2 gedits running.



    Whether A or B happens seems to be totally random and keeps on going infinitely. That means I double click on 100 files and I might end up with 60 gedits, some of which will have 1 tab, some will have 2 tabs, some will have 3 tabs...



    This is extremely annoying and a fix for this would be very appreciated. Anyone ever tried to fix this problem?



    This has happened in Ubuntu 10.04, 10.10 and 11.10. All Ubuntu versions I've ever tested.










    share|improve this question



























      32












      32








      32


      12






      Oh how I love Ubuntu and all its features, but this "bug" has been making me angry for so long and I've finally decided to ask for help here.



      I've assigned all .php files to be opened with gedit whenever I double-click them in nautilus. Now, the behavior is strange.




      1. I have no gedit running

      2. I double click a file to be opened

      3. A gedit window opens and the file loads

      4. I double click another file to be opened


      Now, there are 2 possible outcomes:



      5A) The file opens in the same gedit window in a new tab



      5B) The file opens in a new gedit window, resulting in 2 gedits running.



      Whether A or B happens seems to be totally random and keeps on going infinitely. That means I double click on 100 files and I might end up with 60 gedits, some of which will have 1 tab, some will have 2 tabs, some will have 3 tabs...



      This is extremely annoying and a fix for this would be very appreciated. Anyone ever tried to fix this problem?



      This has happened in Ubuntu 10.04, 10.10 and 11.10. All Ubuntu versions I've ever tested.










      share|improve this question
















      Oh how I love Ubuntu and all its features, but this "bug" has been making me angry for so long and I've finally decided to ask for help here.



      I've assigned all .php files to be opened with gedit whenever I double-click them in nautilus. Now, the behavior is strange.




      1. I have no gedit running

      2. I double click a file to be opened

      3. A gedit window opens and the file loads

      4. I double click another file to be opened


      Now, there are 2 possible outcomes:



      5A) The file opens in the same gedit window in a new tab



      5B) The file opens in a new gedit window, resulting in 2 gedits running.



      Whether A or B happens seems to be totally random and keeps on going infinitely. That means I double click on 100 files and I might end up with 60 gedits, some of which will have 1 tab, some will have 2 tabs, some will have 3 tabs...



      This is extremely annoying and a fix for this would be very appreciated. Anyone ever tried to fix this problem?



      This has happened in Ubuntu 10.04, 10.10 and 11.10. All Ubuntu versions I've ever tested.







      gedit






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 13 '12 at 14:36









      jrg

      39.6k50152236




      39.6k50152236










      asked Nov 5 '11 at 4:08









      Richard RodriguezRichard Rodriguez

      3,220102435




      3,220102435






















          5 Answers
          5






          active

          oldest

          votes


















          39





          +200









          Why...



          gedit has quite an interesting algorithm to determine whether it opens a new instance or if it opens in a tab in an existing instance.



          Located in the source file gedit-app.c in the function static boolean is_in_viewport, the algorithm tests if the current gedit instance is




          1. in the same screen number and display name

          2. in the same workspace

          3. greater than 25% of the edges of the view port


          If all are true then gedit opens in the same instance in a new tab otherwise it opens in a new window.



          In summary - the only realistic way of changing the behaviour is to change the algorithm...



          How...



          The following is a quick way to get a consistent way of opening gedit... it will always open a new instance.



          install the basic development tools



          sudo apt-get install devscripts build-essential fakeroot 


          get the source



          cd ~/Downloads
          mkdir build
          cd build
          apt-get source gedit
          cd gedit-3.2*


          make the change



          Open gedit-app.c



          gedit gedit/gedit-app.c


          enter image description here



          add return FALSE; as shown and save.



          What this does is to always exit the routine saying "i'm not running in a viewport and therefore always open a new instance"



          If you use return TRUE; this will always open in an existing instance of gedit in a new tab...



          give it a unique package name



          OK, we need to give the package a unique name to prevent repository updates from overwriting your changed package



          gedit debian/changelog


          now append +yourname to the top line version and save the file i.e.



          Note - to be absolutely sure - after installing the modified package below, lock the version as per the linked question below.



          enter image description here



          build the package



          sudo apt-get build-dep gedit
          debuild -i -us -uc -b


          Go for a coffee...



          cd ..
          sudo dpkg -i gedit*.deb




          Linked Question:




          1. How to prevent updating of a specific package?






          share|improve this answer





















          • 1





            This, my sir, is SICK! Thanks a lot, hope this will work ...

            – Richard Rodriguez
            Nov 14 '11 at 22:55











          • ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

            – fossfreedom
            Nov 14 '11 at 23:00











          • I'm officially confirming this solution WORKING!

            – Richard Rodriguez
            Nov 15 '11 at 0:08






          • 3





            holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

            – Bruno Pereira
            Nov 15 '11 at 11:34








          • 2





            Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

            – pbhj
            Jun 11 '18 at 13:32





















          13














          I wanted to have all files opened in only one gedit window. I didn't find this information somewhere else, but with the following changes I managed to have all text files open in only one window as new tabs, no mather how I open them (via launcher, via nautilus, via Gnome DO).




          1. Get the display number:
            type echo $DISPLAY in the command line. e.g. you get :0 as your display number.


          2. Open /usr/share/applications/gedit.desktop as superuser with a text editor.



          3. Change the line saying:



            Exec=gedit %U


            to



            Exec=gedit --display=:0 %U


            where :0 is your display number.








          share|improve this answer





















          • 2





            Much better than recompiling gedit and doing weird package hacks. Thanks!

            – rcrogers
            May 14 '14 at 23:07






          • 1





            Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

            – alfC
            Apr 21 '16 at 2:40











          • works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

            – efie
            Sep 12 '18 at 19:31



















          2














          This doesnt happen randomly



          By default Gedit isnt made to open many instances but one one each display. If u open in display where isnt yet Gedit will open files in Gedit witch exists now in that display from witch is opened file.



          So u can make 1st instance of gedit to be on All workspaces so it follows ur active display.
          Or work on each workspace with each project and each with its own opened Gedit`s.
          In keyboard shortcuts u can make new shortcut for toggling window beeing on all workspaces.



          OR its possible to make it allways open in new instance using shortcut command in Open With.. gedit --new-window



          So u can try in php properties open with reset and put new opening with just Gedit



          using gedit --help-all ull see other option of opening with gedit.



          And u can also try removing gedit with all configuration files and installing it clean using sudo apt-get purge gedit && sudo apt-get clean && sudo apt-get update && sudo apt-get install gedit



          UPDATE:
          I was able to reproduce- when moving window a little off screen then opening some file opens in new window. It somehow thinks that its in another Display.






          share|improve this answer


























          • Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

            – spinkus
            Jun 11 '18 at 10:35





















          1














          This started happening to me. I couldn't find any relevant conf file, and even tried purge+clean. Finally found what it was. The Gedit window was opening such that it looked like it was maximized but it wasn't. I pressed the maximize button on the window and this fixed the issue! Note that the window did not change size, only the corners went from round to square. It seems like this must be a bug in the algorithm @fossfreedom described above.



          Note: When you close the window, the maximize/minimize state must be stored in some user config somewhere. This state survives purge+clean, and it's not in per-user Gedit confs either.






          share|improve this answer

































            0














            Just make sure that gedit window is maximized. This helped me





            share








            New contributor




            Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "89"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f75671%2fwhy-does-gedit-keep-randomly-opening-new-instances-when-opening-files-from-nauti%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              5 Answers
              5






              active

              oldest

              votes








              5 Answers
              5






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              39





              +200









              Why...



              gedit has quite an interesting algorithm to determine whether it opens a new instance or if it opens in a tab in an existing instance.



              Located in the source file gedit-app.c in the function static boolean is_in_viewport, the algorithm tests if the current gedit instance is




              1. in the same screen number and display name

              2. in the same workspace

              3. greater than 25% of the edges of the view port


              If all are true then gedit opens in the same instance in a new tab otherwise it opens in a new window.



              In summary - the only realistic way of changing the behaviour is to change the algorithm...



              How...



              The following is a quick way to get a consistent way of opening gedit... it will always open a new instance.



              install the basic development tools



              sudo apt-get install devscripts build-essential fakeroot 


              get the source



              cd ~/Downloads
              mkdir build
              cd build
              apt-get source gedit
              cd gedit-3.2*


              make the change



              Open gedit-app.c



              gedit gedit/gedit-app.c


              enter image description here



              add return FALSE; as shown and save.



              What this does is to always exit the routine saying "i'm not running in a viewport and therefore always open a new instance"



              If you use return TRUE; this will always open in an existing instance of gedit in a new tab...



              give it a unique package name



              OK, we need to give the package a unique name to prevent repository updates from overwriting your changed package



              gedit debian/changelog


              now append +yourname to the top line version and save the file i.e.



              Note - to be absolutely sure - after installing the modified package below, lock the version as per the linked question below.



              enter image description here



              build the package



              sudo apt-get build-dep gedit
              debuild -i -us -uc -b


              Go for a coffee...



              cd ..
              sudo dpkg -i gedit*.deb




              Linked Question:




              1. How to prevent updating of a specific package?






              share|improve this answer





















              • 1





                This, my sir, is SICK! Thanks a lot, hope this will work ...

                – Richard Rodriguez
                Nov 14 '11 at 22:55











              • ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

                – fossfreedom
                Nov 14 '11 at 23:00











              • I'm officially confirming this solution WORKING!

                – Richard Rodriguez
                Nov 15 '11 at 0:08






              • 3





                holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

                – Bruno Pereira
                Nov 15 '11 at 11:34








              • 2





                Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

                – pbhj
                Jun 11 '18 at 13:32


















              39





              +200









              Why...



              gedit has quite an interesting algorithm to determine whether it opens a new instance or if it opens in a tab in an existing instance.



              Located in the source file gedit-app.c in the function static boolean is_in_viewport, the algorithm tests if the current gedit instance is




              1. in the same screen number and display name

              2. in the same workspace

              3. greater than 25% of the edges of the view port


              If all are true then gedit opens in the same instance in a new tab otherwise it opens in a new window.



              In summary - the only realistic way of changing the behaviour is to change the algorithm...



              How...



              The following is a quick way to get a consistent way of opening gedit... it will always open a new instance.



              install the basic development tools



              sudo apt-get install devscripts build-essential fakeroot 


              get the source



              cd ~/Downloads
              mkdir build
              cd build
              apt-get source gedit
              cd gedit-3.2*


              make the change



              Open gedit-app.c



              gedit gedit/gedit-app.c


              enter image description here



              add return FALSE; as shown and save.



              What this does is to always exit the routine saying "i'm not running in a viewport and therefore always open a new instance"



              If you use return TRUE; this will always open in an existing instance of gedit in a new tab...



              give it a unique package name



              OK, we need to give the package a unique name to prevent repository updates from overwriting your changed package



              gedit debian/changelog


              now append +yourname to the top line version and save the file i.e.



              Note - to be absolutely sure - after installing the modified package below, lock the version as per the linked question below.



              enter image description here



              build the package



              sudo apt-get build-dep gedit
              debuild -i -us -uc -b


              Go for a coffee...



              cd ..
              sudo dpkg -i gedit*.deb




              Linked Question:




              1. How to prevent updating of a specific package?






              share|improve this answer





















              • 1





                This, my sir, is SICK! Thanks a lot, hope this will work ...

                – Richard Rodriguez
                Nov 14 '11 at 22:55











              • ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

                – fossfreedom
                Nov 14 '11 at 23:00











              • I'm officially confirming this solution WORKING!

                – Richard Rodriguez
                Nov 15 '11 at 0:08






              • 3





                holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

                – Bruno Pereira
                Nov 15 '11 at 11:34








              • 2





                Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

                – pbhj
                Jun 11 '18 at 13:32
















              39





              +200







              39





              +200



              39




              +200





              Why...



              gedit has quite an interesting algorithm to determine whether it opens a new instance or if it opens in a tab in an existing instance.



              Located in the source file gedit-app.c in the function static boolean is_in_viewport, the algorithm tests if the current gedit instance is




              1. in the same screen number and display name

              2. in the same workspace

              3. greater than 25% of the edges of the view port


              If all are true then gedit opens in the same instance in a new tab otherwise it opens in a new window.



              In summary - the only realistic way of changing the behaviour is to change the algorithm...



              How...



              The following is a quick way to get a consistent way of opening gedit... it will always open a new instance.



              install the basic development tools



              sudo apt-get install devscripts build-essential fakeroot 


              get the source



              cd ~/Downloads
              mkdir build
              cd build
              apt-get source gedit
              cd gedit-3.2*


              make the change



              Open gedit-app.c



              gedit gedit/gedit-app.c


              enter image description here



              add return FALSE; as shown and save.



              What this does is to always exit the routine saying "i'm not running in a viewport and therefore always open a new instance"



              If you use return TRUE; this will always open in an existing instance of gedit in a new tab...



              give it a unique package name



              OK, we need to give the package a unique name to prevent repository updates from overwriting your changed package



              gedit debian/changelog


              now append +yourname to the top line version and save the file i.e.



              Note - to be absolutely sure - after installing the modified package below, lock the version as per the linked question below.



              enter image description here



              build the package



              sudo apt-get build-dep gedit
              debuild -i -us -uc -b


              Go for a coffee...



              cd ..
              sudo dpkg -i gedit*.deb




              Linked Question:




              1. How to prevent updating of a specific package?






              share|improve this answer















              Why...



              gedit has quite an interesting algorithm to determine whether it opens a new instance or if it opens in a tab in an existing instance.



              Located in the source file gedit-app.c in the function static boolean is_in_viewport, the algorithm tests if the current gedit instance is




              1. in the same screen number and display name

              2. in the same workspace

              3. greater than 25% of the edges of the view port


              If all are true then gedit opens in the same instance in a new tab otherwise it opens in a new window.



              In summary - the only realistic way of changing the behaviour is to change the algorithm...



              How...



              The following is a quick way to get a consistent way of opening gedit... it will always open a new instance.



              install the basic development tools



              sudo apt-get install devscripts build-essential fakeroot 


              get the source



              cd ~/Downloads
              mkdir build
              cd build
              apt-get source gedit
              cd gedit-3.2*


              make the change



              Open gedit-app.c



              gedit gedit/gedit-app.c


              enter image description here



              add return FALSE; as shown and save.



              What this does is to always exit the routine saying "i'm not running in a viewport and therefore always open a new instance"



              If you use return TRUE; this will always open in an existing instance of gedit in a new tab...



              give it a unique package name



              OK, we need to give the package a unique name to prevent repository updates from overwriting your changed package



              gedit debian/changelog


              now append +yourname to the top line version and save the file i.e.



              Note - to be absolutely sure - after installing the modified package below, lock the version as per the linked question below.



              enter image description here



              build the package



              sudo apt-get build-dep gedit
              debuild -i -us -uc -b


              Go for a coffee...



              cd ..
              sudo dpkg -i gedit*.deb




              Linked Question:




              1. How to prevent updating of a specific package?







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Apr 13 '17 at 12:24









              Community

              1




              1










              answered Nov 14 '11 at 20:55









              fossfreedomfossfreedom

              150k38331374




              150k38331374








              • 1





                This, my sir, is SICK! Thanks a lot, hope this will work ...

                – Richard Rodriguez
                Nov 14 '11 at 22:55











              • ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

                – fossfreedom
                Nov 14 '11 at 23:00











              • I'm officially confirming this solution WORKING!

                – Richard Rodriguez
                Nov 15 '11 at 0:08






              • 3





                holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

                – Bruno Pereira
                Nov 15 '11 at 11:34








              • 2





                Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

                – pbhj
                Jun 11 '18 at 13:32
















              • 1





                This, my sir, is SICK! Thanks a lot, hope this will work ...

                – Richard Rodriguez
                Nov 14 '11 at 22:55











              • ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

                – fossfreedom
                Nov 14 '11 at 23:00











              • I'm officially confirming this solution WORKING!

                – Richard Rodriguez
                Nov 15 '11 at 0:08






              • 3





                holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

                – Bruno Pereira
                Nov 15 '11 at 11:34








              • 2





                Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

                – pbhj
                Jun 11 '18 at 13:32










              1




              1





              This, my sir, is SICK! Thanks a lot, hope this will work ...

              – Richard Rodriguez
              Nov 14 '11 at 22:55





              This, my sir, is SICK! Thanks a lot, hope this will work ...

              – Richard Rodriguez
              Nov 14 '11 at 22:55













              ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

              – fossfreedom
              Nov 14 '11 at 23:00





              ... certainly did during my testing ... N.B. - I used the other answers observation that if you drag gedit to overlap the edges, a new instance is opened, but if you have gedit within the desktop, the new instance is opened in a tab. With the above compilation - it always opens in a new instance or tab depending upon with compiled with "return FALSE" or "return TRUE".

              – fossfreedom
              Nov 14 '11 at 23:00













              I'm officially confirming this solution WORKING!

              – Richard Rodriguez
              Nov 15 '11 at 0:08





              I'm officially confirming this solution WORKING!

              – Richard Rodriguez
              Nov 15 '11 at 0:08




              3




              3





              holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

              – Bruno Pereira
              Nov 15 '11 at 11:34







              holy sh*t @fossfreedom, I bow to you sir, you have done this time, the quality and solution of this answer is imba. If I could I would spend the all day pressing that vote up button! Gj.

              – Bruno Pereira
              Nov 15 '11 at 11:34






              2




              2





              Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

              – pbhj
              Jun 11 '18 at 13:32







              Seems like it might have been better to make a pull request to have a config variable and do a simple (pseudo code) "if $config-variable then return FALSE". The proposed way locks you out of updates indefinitely.

              – pbhj
              Jun 11 '18 at 13:32















              13














              I wanted to have all files opened in only one gedit window. I didn't find this information somewhere else, but with the following changes I managed to have all text files open in only one window as new tabs, no mather how I open them (via launcher, via nautilus, via Gnome DO).




              1. Get the display number:
                type echo $DISPLAY in the command line. e.g. you get :0 as your display number.


              2. Open /usr/share/applications/gedit.desktop as superuser with a text editor.



              3. Change the line saying:



                Exec=gedit %U


                to



                Exec=gedit --display=:0 %U


                where :0 is your display number.








              share|improve this answer





















              • 2





                Much better than recompiling gedit and doing weird package hacks. Thanks!

                – rcrogers
                May 14 '14 at 23:07






              • 1





                Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

                – alfC
                Apr 21 '16 at 2:40











              • works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

                – efie
                Sep 12 '18 at 19:31
















              13














              I wanted to have all files opened in only one gedit window. I didn't find this information somewhere else, but with the following changes I managed to have all text files open in only one window as new tabs, no mather how I open them (via launcher, via nautilus, via Gnome DO).




              1. Get the display number:
                type echo $DISPLAY in the command line. e.g. you get :0 as your display number.


              2. Open /usr/share/applications/gedit.desktop as superuser with a text editor.



              3. Change the line saying:



                Exec=gedit %U


                to



                Exec=gedit --display=:0 %U


                where :0 is your display number.








              share|improve this answer





















              • 2





                Much better than recompiling gedit and doing weird package hacks. Thanks!

                – rcrogers
                May 14 '14 at 23:07






              • 1





                Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

                – alfC
                Apr 21 '16 at 2:40











              • works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

                – efie
                Sep 12 '18 at 19:31














              13












              13








              13







              I wanted to have all files opened in only one gedit window. I didn't find this information somewhere else, but with the following changes I managed to have all text files open in only one window as new tabs, no mather how I open them (via launcher, via nautilus, via Gnome DO).




              1. Get the display number:
                type echo $DISPLAY in the command line. e.g. you get :0 as your display number.


              2. Open /usr/share/applications/gedit.desktop as superuser with a text editor.



              3. Change the line saying:



                Exec=gedit %U


                to



                Exec=gedit --display=:0 %U


                where :0 is your display number.








              share|improve this answer















              I wanted to have all files opened in only one gedit window. I didn't find this information somewhere else, but with the following changes I managed to have all text files open in only one window as new tabs, no mather how I open them (via launcher, via nautilus, via Gnome DO).




              1. Get the display number:
                type echo $DISPLAY in the command line. e.g. you get :0 as your display number.


              2. Open /usr/share/applications/gedit.desktop as superuser with a text editor.



              3. Change the line saying:



                Exec=gedit %U


                to



                Exec=gedit --display=:0 %U


                where :0 is your display number.









              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Oct 9 '13 at 10:41









              Eric Carvalho

              42.5k17117148




              42.5k17117148










              answered Oct 9 '13 at 10:16









              Tim BanchiTim Banchi

              196126




              196126








              • 2





                Much better than recompiling gedit and doing weird package hacks. Thanks!

                – rcrogers
                May 14 '14 at 23:07






              • 1





                Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

                – alfC
                Apr 21 '16 at 2:40











              • works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

                – efie
                Sep 12 '18 at 19:31














              • 2





                Much better than recompiling gedit and doing weird package hacks. Thanks!

                – rcrogers
                May 14 '14 at 23:07






              • 1





                Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

                – alfC
                Apr 21 '16 at 2:40











              • works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

                – efie
                Sep 12 '18 at 19:31








              2




              2





              Much better than recompiling gedit and doing weird package hacks. Thanks!

              – rcrogers
              May 14 '14 at 23:07





              Much better than recompiling gedit and doing weird package hacks. Thanks!

              – rcrogers
              May 14 '14 at 23:07




              1




              1





              Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

              – alfC
              Apr 21 '16 at 2:40





              Running with this option from the command line doesn't prevent gedit from opening new instances (windows). At least in the current version 3.18.

              – alfC
              Apr 21 '16 at 2:40













              works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

              – efie
              Sep 12 '18 at 19:31





              works for me in version 3.28.1 both from the command line and from the gui. needs a restart though

              – efie
              Sep 12 '18 at 19:31











              2














              This doesnt happen randomly



              By default Gedit isnt made to open many instances but one one each display. If u open in display where isnt yet Gedit will open files in Gedit witch exists now in that display from witch is opened file.



              So u can make 1st instance of gedit to be on All workspaces so it follows ur active display.
              Or work on each workspace with each project and each with its own opened Gedit`s.
              In keyboard shortcuts u can make new shortcut for toggling window beeing on all workspaces.



              OR its possible to make it allways open in new instance using shortcut command in Open With.. gedit --new-window



              So u can try in php properties open with reset and put new opening with just Gedit



              using gedit --help-all ull see other option of opening with gedit.



              And u can also try removing gedit with all configuration files and installing it clean using sudo apt-get purge gedit && sudo apt-get clean && sudo apt-get update && sudo apt-get install gedit



              UPDATE:
              I was able to reproduce- when moving window a little off screen then opening some file opens in new window. It somehow thinks that its in another Display.






              share|improve this answer


























              • Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

                – spinkus
                Jun 11 '18 at 10:35


















              2














              This doesnt happen randomly



              By default Gedit isnt made to open many instances but one one each display. If u open in display where isnt yet Gedit will open files in Gedit witch exists now in that display from witch is opened file.



              So u can make 1st instance of gedit to be on All workspaces so it follows ur active display.
              Or work on each workspace with each project and each with its own opened Gedit`s.
              In keyboard shortcuts u can make new shortcut for toggling window beeing on all workspaces.



              OR its possible to make it allways open in new instance using shortcut command in Open With.. gedit --new-window



              So u can try in php properties open with reset and put new opening with just Gedit



              using gedit --help-all ull see other option of opening with gedit.



              And u can also try removing gedit with all configuration files and installing it clean using sudo apt-get purge gedit && sudo apt-get clean && sudo apt-get update && sudo apt-get install gedit



              UPDATE:
              I was able to reproduce- when moving window a little off screen then opening some file opens in new window. It somehow thinks that its in another Display.






              share|improve this answer


























              • Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

                – spinkus
                Jun 11 '18 at 10:35
















              2












              2








              2







              This doesnt happen randomly



              By default Gedit isnt made to open many instances but one one each display. If u open in display where isnt yet Gedit will open files in Gedit witch exists now in that display from witch is opened file.



              So u can make 1st instance of gedit to be on All workspaces so it follows ur active display.
              Or work on each workspace with each project and each with its own opened Gedit`s.
              In keyboard shortcuts u can make new shortcut for toggling window beeing on all workspaces.



              OR its possible to make it allways open in new instance using shortcut command in Open With.. gedit --new-window



              So u can try in php properties open with reset and put new opening with just Gedit



              using gedit --help-all ull see other option of opening with gedit.



              And u can also try removing gedit with all configuration files and installing it clean using sudo apt-get purge gedit && sudo apt-get clean && sudo apt-get update && sudo apt-get install gedit



              UPDATE:
              I was able to reproduce- when moving window a little off screen then opening some file opens in new window. It somehow thinks that its in another Display.






              share|improve this answer















              This doesnt happen randomly



              By default Gedit isnt made to open many instances but one one each display. If u open in display where isnt yet Gedit will open files in Gedit witch exists now in that display from witch is opened file.



              So u can make 1st instance of gedit to be on All workspaces so it follows ur active display.
              Or work on each workspace with each project and each with its own opened Gedit`s.
              In keyboard shortcuts u can make new shortcut for toggling window beeing on all workspaces.



              OR its possible to make it allways open in new instance using shortcut command in Open With.. gedit --new-window



              So u can try in php properties open with reset and put new opening with just Gedit



              using gedit --help-all ull see other option of opening with gedit.



              And u can also try removing gedit with all configuration files and installing it clean using sudo apt-get purge gedit && sudo apt-get clean && sudo apt-get update && sudo apt-get install gedit



              UPDATE:
              I was able to reproduce- when moving window a little off screen then opening some file opens in new window. It somehow thinks that its in another Display.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Nov 9 '11 at 16:00

























              answered Nov 9 '11 at 14:58









              KangaroooKangarooo

              3,04942334




              3,04942334













              • Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

                – spinkus
                Jun 11 '18 at 10:35





















              • Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

                – spinkus
                Jun 11 '18 at 10:35



















              Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

              – spinkus
              Jun 11 '18 at 10:35







              Yes it does happen randomly. That is the whole point. The implementation is buggy / not robust. For instance, I'm at a loss I did, but gedit has now randomly decided to switch to this always a new window mode after working as normal earlier today ...

              – spinkus
              Jun 11 '18 at 10:35













              1














              This started happening to me. I couldn't find any relevant conf file, and even tried purge+clean. Finally found what it was. The Gedit window was opening such that it looked like it was maximized but it wasn't. I pressed the maximize button on the window and this fixed the issue! Note that the window did not change size, only the corners went from round to square. It seems like this must be a bug in the algorithm @fossfreedom described above.



              Note: When you close the window, the maximize/minimize state must be stored in some user config somewhere. This state survives purge+clean, and it's not in per-user Gedit confs either.






              share|improve this answer






























                1














                This started happening to me. I couldn't find any relevant conf file, and even tried purge+clean. Finally found what it was. The Gedit window was opening such that it looked like it was maximized but it wasn't. I pressed the maximize button on the window and this fixed the issue! Note that the window did not change size, only the corners went from round to square. It seems like this must be a bug in the algorithm @fossfreedom described above.



                Note: When you close the window, the maximize/minimize state must be stored in some user config somewhere. This state survives purge+clean, and it's not in per-user Gedit confs either.






                share|improve this answer




























                  1












                  1








                  1







                  This started happening to me. I couldn't find any relevant conf file, and even tried purge+clean. Finally found what it was. The Gedit window was opening such that it looked like it was maximized but it wasn't. I pressed the maximize button on the window and this fixed the issue! Note that the window did not change size, only the corners went from round to square. It seems like this must be a bug in the algorithm @fossfreedom described above.



                  Note: When you close the window, the maximize/minimize state must be stored in some user config somewhere. This state survives purge+clean, and it's not in per-user Gedit confs either.






                  share|improve this answer















                  This started happening to me. I couldn't find any relevant conf file, and even tried purge+clean. Finally found what it was. The Gedit window was opening such that it looked like it was maximized but it wasn't. I pressed the maximize button on the window and this fixed the issue! Note that the window did not change size, only the corners went from round to square. It seems like this must be a bug in the algorithm @fossfreedom described above.



                  Note: When you close the window, the maximize/minimize state must be stored in some user config somewhere. This state survives purge+clean, and it's not in per-user Gedit confs either.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jun 11 '18 at 13:24









                  TRiG

                  1,46411432




                  1,46411432










                  answered Jun 11 '18 at 11:08









                  spinkusspinkus

                  1366




                  1366























                      0














                      Just make sure that gedit window is maximized. This helped me





                      share








                      New contributor




                      Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                      Check out our Code of Conduct.

























                        0














                        Just make sure that gedit window is maximized. This helped me





                        share








                        New contributor




                        Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.























                          0












                          0








                          0







                          Just make sure that gedit window is maximized. This helped me





                          share








                          New contributor




                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.










                          Just make sure that gedit window is maximized. This helped me






                          share








                          New contributor




                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.








                          share


                          share






                          New contributor




                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.









                          answered 6 mins ago









                          СторожСторож

                          1




                          1




                          New contributor




                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.





                          New contributor





                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






                          Сторож is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Ask Ubuntu!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f75671%2fwhy-does-gedit-keep-randomly-opening-new-instances-when-opening-files-from-nauti%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              List of shipwrecks in 1808...

                              Is there a lightweight tool to crop images quickly?Cropping Images using Command Line Tools OnlyHow to crop...

                              Unit packagekit.service is masked Announcing the arrival of Valued Associate #679: Cesar...