Command-line to switch between profiles in gnome-terminal












18















I created a new profile for gnome-terminal and I can switch between "Implicit" profile and the new created profile as you can see in the below image:



Switch between profiles in gnome-terminal



Now I wonder how can I switch between profiles using a command-line/script or maybe using a shortcut for this.




Note: Solutions like:



gnome-terminal --tab-with-profile=Implicit && exit 


are excluded because I prefer not to close and open another terminal or get another terminal window in this process of changing the profile.











share|improve this question




















  • 1





    With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

    – Stormvirux
    Aug 7 '13 at 20:10













  • @Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

    – Radu Rădeanu
    Aug 7 '13 at 20:18













  • duplicate question: askubuntu.com/questions/247041/…

    – Jakob
    Oct 7 '15 at 12:45
















18















I created a new profile for gnome-terminal and I can switch between "Implicit" profile and the new created profile as you can see in the below image:



Switch between profiles in gnome-terminal



Now I wonder how can I switch between profiles using a command-line/script or maybe using a shortcut for this.




Note: Solutions like:



gnome-terminal --tab-with-profile=Implicit && exit 


are excluded because I prefer not to close and open another terminal or get another terminal window in this process of changing the profile.











share|improve this question




















  • 1





    With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

    – Stormvirux
    Aug 7 '13 at 20:10













  • @Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

    – Radu Rădeanu
    Aug 7 '13 at 20:18













  • duplicate question: askubuntu.com/questions/247041/…

    – Jakob
    Oct 7 '15 at 12:45














18












18








18


2






I created a new profile for gnome-terminal and I can switch between "Implicit" profile and the new created profile as you can see in the below image:



Switch between profiles in gnome-terminal



Now I wonder how can I switch between profiles using a command-line/script or maybe using a shortcut for this.




Note: Solutions like:



gnome-terminal --tab-with-profile=Implicit && exit 


are excluded because I prefer not to close and open another terminal or get another terminal window in this process of changing the profile.











share|improve this question
















I created a new profile for gnome-terminal and I can switch between "Implicit" profile and the new created profile as you can see in the below image:



Switch between profiles in gnome-terminal



Now I wonder how can I switch between profiles using a command-line/script or maybe using a shortcut for this.




Note: Solutions like:



gnome-terminal --tab-with-profile=Implicit && exit 


are excluded because I prefer not to close and open another terminal or get another terminal window in this process of changing the profile.








command-line shortcut-keys gnome-terminal






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '13 at 17:51







Radu Rădeanu

















asked Jul 27 '13 at 10:53









Radu RădeanuRadu Rădeanu

119k35252328




119k35252328








  • 1





    With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

    – Stormvirux
    Aug 7 '13 at 20:10













  • @Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

    – Radu Rădeanu
    Aug 7 '13 at 20:18













  • duplicate question: askubuntu.com/questions/247041/…

    – Jakob
    Oct 7 '15 at 12:45














  • 1





    With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

    – Stormvirux
    Aug 7 '13 at 20:10













  • @Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

    – Radu Rădeanu
    Aug 7 '13 at 20:18













  • duplicate question: askubuntu.com/questions/247041/…

    – Jakob
    Oct 7 '15 at 12:45








1




1





With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

– Stormvirux
Aug 7 '13 at 20:10







With gconftool-2 you can set the profile whose changes are immediate . Have you checked this out-->stackoverflow.com/questions/660442/…

– Stormvirux
Aug 7 '13 at 20:10















@Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

– Radu Rădeanu
Aug 7 '13 at 20:18







@Stormvirux No... So can you explain how to use gconftool or gconftool-2 to switch the profile? I don't see a good answer/explanation there.

– Radu Rădeanu
Aug 7 '13 at 20:18















duplicate question: askubuntu.com/questions/247041/…

– Jakob
Oct 7 '15 at 12:45





duplicate question: askubuntu.com/questions/247041/…

– Jakob
Oct 7 '15 at 12:45










9 Answers
9






active

oldest

votes


















7














To switch to the "implicit" profile:



xdotool key Alt+t p Return


To switch to the second profile:



xdotool key Alt+t p Down Return


xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.



Of course, for these commands can be added custom keyboard shortcuts.






share|improve this answer


























  • That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

    – Braiam
    Nov 14 '13 at 18:44








  • 1





    @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

    – Radu Rădeanu
    Nov 14 '13 at 18:58













  • You seriously should consider suggesting that in the bugtracker...

    – Braiam
    Nov 14 '13 at 19:00











  • @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

    – Radu Rădeanu
    Nov 14 '13 at 20:49











  • It no longer works unfortunaltely

    – RobAu
    Jan 27 '17 at 9:04



















4














There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):




You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.




(You can propose this as suggestion in the bug tracker)






share|improve this answer


























  • Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

    – Radu Rădeanu
    Aug 7 '13 at 20:33













  • @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

    – Braiam
    Aug 7 '13 at 20:49






  • 1





    @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

    – moon.musick
    Aug 19 '13 at 20:10











  • @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

    – moon.musick
    Aug 19 '13 at 20:14











  • @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

    – Braiam
    Sep 9 '13 at 16:27



















3














I was looking to do the same and finally got a script working, I put it up on my GitHub.



Like I explain in the README.md, it doesn't actually switch, but loads a profiles configuration into the Default profile. To do this, the configuration of each profile is saved to file on the first run of the script.
The script makes it seem like you're switching between profiles, which is good enough for me. Hope it helps anyone...






share|improve this answer

































    2














    Depending on your purpose, you may find this script to be useful:
    https://github.com/xyrix/gnome-terminal-profile-switcher



    It does a sort of monkey patch and generates a new profile for each terminal, then sets some environment variables to expose a program for switching the theme of the profile for your current terminal.



    Hopefully the example safe_ssh script will make things clear :-). I've been using it for just over a year now and it's helped me not destroy the company's live database ^_^






    share|improve this answer































      1














      If you have a list of servers that you access often, I believe the easiest solution would be to simply invoke a second window just for that box's session.



      First, make a separate gnome-terminal profile for each remote location that you use often. Then, in each profile, specify that the terminal should execute the SSH login command for that box, instead of a plain shell.



      ssh alice@athena


      Finally, write a short script to kick off a new remote window given a profile ID.



      #!/bin/bash
      if [[ $# -ne 1 ]] ; then
      echo "Give me a server/profile name!"
      exit 1
      fi
      gnome-terminal --window-with-profile=$1
      exit 0


      Using this strategy you can "infinitely" vary the look of each box's terminal window, and kick them off from a single "control" terminal. For example, if we call this script "rlv", then we can spawn a remote window by simply invoking the script with a profile name.



      >> rlv athena


      If you ever fat-finger a host name, or neglect to set up a profile for that host, then you'll just get another default-profile window on the local box. There's a way to code the script to avoid this, by putting the login into the script itself, rather than in the gnome-terminal :



      #!/bin/bash
      if [[ $# -ne 1 ]] ; then
      echo "Give me a server/profile name!"
      exit 1
      fi
      gnome-terminal --window-with-profile=$1 -e "ssh $1"
      exit 0


      ...but then you lose the flexibility of defining your login username for that box. That additional feature of the script I leave as an exercise to the reader.






      share|improve this answer































        1














        I've just noticed that my original solution has been already rejected in the question. While there seems no simple way to change the profile, you can change background / foreground color by using setterm command.



        So, this setterm -term linux -background black -foreground green would give you black background with green text. The only problem is that ls has colorized output, so you might wanna turn ls coloring off. Otherwise it resets to previous color scheme



        Original post: There is a sort-of way around. From man gnome-terminal :




        --window-with-profile=PROFILENAME



                     Open a new window containing a  tab  with  the
        given profile. More than one of these options
        can be provided.



        Here's example from my machine. I have three profiles: B&G(black on green), ForPrinting(black font, white background), and Default. So what I do is in current window type gnome-terminal --window-with-profile=ForPrinting . Then I can either kill old window from command line or switch and close it graphically.



        B&G profile doesn't work. Probably because & is not a valid character, so keep that in mind when naming profiles.






        share|improve this answer

































          1














          A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...



          The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.



          e.g. xdotool key shift+F10 r 3 to get to the third profile



          I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.



          I tend to change profiles a lot so I wrap this into a function:



          function chp(){
          xdotool --clearmodifiers key Shift+F10 r $1
          }


          so I can just call chp N to switch to the Nth profile.



          Some more tips and idiosyncrasies of my setup:




          • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile


          • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution:
            alias somehost="chp 2; ssh user@somehost; chp 1"


          • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.


          • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu







          share|improve this answer


























          • ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

            – brotherJ4mes
            Feb 5 at 18:00



















          0














          The very ugly solution I've ended up using is



          unset x y
          eval $(xwininfo -id $(xdotool getactivewindow) |
          sed -n -e 's/^ +Absolute upper-left X: +([0-9]+).*/x=1/p'
          -e 's/^ +Absolute upper-left Y: +([0-9]+).*/y=1/p')
          xdotool mousemove $(($x + 50)) $(($y + 50))
          xdotool click 3; xdotool key --repeat 3 Up; xdotool key Right; xdotool key --delay 50 Down; xdotool key --delay 50 Return


          (This selects the second profile, but you could change that to say the htir profile by changing the second "key Down" command to xdotool key --delay 50 --repeat 2 Down.



          What's this doing:




          1. find the the top left coordinates of the current window (eg. the gnome terminal in use).

          2. move the mouse to be over that terminal

          3. right click and navigate the context menu to select the second profile.


          You'll need xdotool installed sudo apt install xdotool.



          Kind of extraordinary that the terminal itself doesn't doesn't allow configuration via the terminal!






          share|improve this answer































            0














            It would be great of gnome-terminal offered a "next profile" command and shortcut; unfortunately, it does not.



            A workaround for those with Alt+T disabled (Edit > Preferences > Enable mnemonics - unchecked) is: F10 left left down right and select the profile. Ouch.






            share|improve this answer
























            • Worth noting that this requires the menu bar to be visible.

              – Gauthier
              Jan 31 '18 at 15:12











            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%2f325235%2fcommand-line-to-switch-between-profiles-in-gnome-terminal%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            9 Answers
            9






            active

            oldest

            votes








            9 Answers
            9






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            7














            To switch to the "implicit" profile:



            xdotool key Alt+t p Return


            To switch to the second profile:



            xdotool key Alt+t p Down Return


            xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.



            Of course, for these commands can be added custom keyboard shortcuts.






            share|improve this answer


























            • That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

              – Braiam
              Nov 14 '13 at 18:44








            • 1





              @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

              – Radu Rădeanu
              Nov 14 '13 at 18:58













            • You seriously should consider suggesting that in the bugtracker...

              – Braiam
              Nov 14 '13 at 19:00











            • @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

              – Radu Rădeanu
              Nov 14 '13 at 20:49











            • It no longer works unfortunaltely

              – RobAu
              Jan 27 '17 at 9:04
















            7














            To switch to the "implicit" profile:



            xdotool key Alt+t p Return


            To switch to the second profile:



            xdotool key Alt+t p Down Return


            xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.



            Of course, for these commands can be added custom keyboard shortcuts.






            share|improve this answer


























            • That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

              – Braiam
              Nov 14 '13 at 18:44








            • 1





              @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

              – Radu Rădeanu
              Nov 14 '13 at 18:58













            • You seriously should consider suggesting that in the bugtracker...

              – Braiam
              Nov 14 '13 at 19:00











            • @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

              – Radu Rădeanu
              Nov 14 '13 at 20:49











            • It no longer works unfortunaltely

              – RobAu
              Jan 27 '17 at 9:04














            7












            7








            7







            To switch to the "implicit" profile:



            xdotool key Alt+t p Return


            To switch to the second profile:



            xdotool key Alt+t p Down Return


            xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.



            Of course, for these commands can be added custom keyboard shortcuts.






            share|improve this answer















            To switch to the "implicit" profile:



            xdotool key Alt+t p Return


            To switch to the second profile:



            xdotool key Alt+t p Down Return


            xdotool Install xdotool is not installed by default in Ubuntu, so it must to be installed first.



            Of course, for these commands can be added custom keyboard shortcuts.







            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 '13 at 18:33









            Radu RădeanuRadu Rădeanu

            119k35252328




            119k35252328













            • That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

              – Braiam
              Nov 14 '13 at 18:44








            • 1





              @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

              – Radu Rădeanu
              Nov 14 '13 at 18:58













            • You seriously should consider suggesting that in the bugtracker...

              – Braiam
              Nov 14 '13 at 19:00











            • @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

              – Radu Rădeanu
              Nov 14 '13 at 20:49











            • It no longer works unfortunaltely

              – RobAu
              Jan 27 '17 at 9:04



















            • That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

              – Braiam
              Nov 14 '13 at 18:44








            • 1





              @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

              – Radu Rădeanu
              Nov 14 '13 at 18:58













            • You seriously should consider suggesting that in the bugtracker...

              – Braiam
              Nov 14 '13 at 19:00











            • @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

              – Radu Rădeanu
              Nov 14 '13 at 20:49











            • It no longer works unfortunaltely

              – RobAu
              Jan 27 '17 at 9:04

















            That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

            – Braiam
            Nov 14 '13 at 18:44







            That's not a shortcut. You are only simulating the keypresses, is only mnemonics of the application.

            – Braiam
            Nov 14 '13 at 18:44






            1




            1





            @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

            – Radu Rădeanu
            Nov 14 '13 at 18:58







            @Braiam Yes, it's not a shortcut, I can see. It's a command-line (see man xdotool for more info) as I asked, which is working exactly as I wish and I am happy with this answer until something better will appear. ;)

            – Radu Rădeanu
            Nov 14 '13 at 18:58















            You seriously should consider suggesting that in the bugtracker...

            – Braiam
            Nov 14 '13 at 19:00





            You seriously should consider suggesting that in the bugtracker...

            – Braiam
            Nov 14 '13 at 19:00













            @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

            – Radu Rădeanu
            Nov 14 '13 at 20:49





            @Braiam As I told you, I'm ok with this solution, it's working like a charm. Regarding your suggestion, there is one in this sense from 2002 (modified in 2010: "It would be extra nice if I can use exactly two keystrokes to open the profile of my choice." - see this comment). So, why do you think that I should add a new one? Do you like duplicates?

            – Radu Rădeanu
            Nov 14 '13 at 20:49













            It no longer works unfortunaltely

            – RobAu
            Jan 27 '17 at 9:04





            It no longer works unfortunaltely

            – RobAu
            Jan 27 '17 at 9:04













            4














            There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):




            You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.




            (You can propose this as suggestion in the bug tracker)






            share|improve this answer


























            • Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

              – Radu Rădeanu
              Aug 7 '13 at 20:33













            • @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

              – Braiam
              Aug 7 '13 at 20:49






            • 1





              @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

              – moon.musick
              Aug 19 '13 at 20:10











            • @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

              – moon.musick
              Aug 19 '13 at 20:14











            • @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

              – Braiam
              Sep 9 '13 at 16:27
















            4














            There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):




            You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.




            (You can propose this as suggestion in the bug tracker)






            share|improve this answer


























            • Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

              – Radu Rădeanu
              Aug 7 '13 at 20:33













            • @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

              – Braiam
              Aug 7 '13 at 20:49






            • 1





              @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

              – moon.musick
              Aug 19 '13 at 20:10











            • @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

              – moon.musick
              Aug 19 '13 at 20:14











            • @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

              – Braiam
              Sep 9 '13 at 16:27














            4












            4








            4







            There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):




            You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.




            (You can propose this as suggestion in the bug tracker)






            share|improve this answer















            There is no shortcut that allows you to change the profile within the terminal (without navigating the menus as you said in comments), without the use of the GUI. Quoting the manual (stable, development 3.9):




            You can change the profile in your current Terminal tab or window by selecting a profile from Terminal ▸ Change Profile.




            (You can propose this as suggestion in the bug tracker)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 14 '13 at 19:01

























            answered Aug 3 '13 at 21:51









            BraiamBraiam

            52.4k20138223




            52.4k20138223













            • Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

              – Radu Rădeanu
              Aug 7 '13 at 20:33













            • @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

              – Braiam
              Aug 7 '13 at 20:49






            • 1





              @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

              – moon.musick
              Aug 19 '13 at 20:10











            • @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

              – moon.musick
              Aug 19 '13 at 20:14











            • @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

              – Braiam
              Sep 9 '13 at 16:27



















            • Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

              – Radu Rădeanu
              Aug 7 '13 at 20:33













            • @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

              – Braiam
              Aug 7 '13 at 20:49






            • 1





              @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

              – moon.musick
              Aug 19 '13 at 20:10











            • @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

              – moon.musick
              Aug 19 '13 at 20:14











            • @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

              – Braiam
              Sep 9 '13 at 16:27

















            Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

            – Radu Rădeanu
            Aug 7 '13 at 20:33







            Actually, there is a shortcut: Alt+T followed by P, Up Arrow or Down Arrow and Enter. But this is a little bit long...

            – Radu Rădeanu
            Aug 7 '13 at 20:33















            @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

            – Braiam
            Aug 7 '13 at 20:49





            @RaduRădeanu Alt + T doesn't work in my terminal 3.8.3 :/

            – Braiam
            Aug 7 '13 at 20:49




            1




            1





            @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

            – moon.musick
            Aug 19 '13 at 20:10





            @RaduRădeanu I guess alt+t is in fact using the GUI, it's just not using mouse.

            – moon.musick
            Aug 19 '13 at 20:10













            @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

            – moon.musick
            Aug 19 '13 at 20:14





            @Braiam If you are using non-English version of the gnome-terminal, press alt and see what letter is being highlighted for your language version of 'Terminal' (it's 5th item in my Polish version, just left of 'Help'), then use that letter with alt.

            – moon.musick
            Aug 19 '13 at 20:14













            @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

            – Braiam
            Sep 9 '13 at 16:27





            @moon.musick I'm using the Debian version of gnome-terminal 3.8.3, and seem that it doesn't have the Alt modifier to access the menus.

            – Braiam
            Sep 9 '13 at 16:27











            3














            I was looking to do the same and finally got a script working, I put it up on my GitHub.



            Like I explain in the README.md, it doesn't actually switch, but loads a profiles configuration into the Default profile. To do this, the configuration of each profile is saved to file on the first run of the script.
            The script makes it seem like you're switching between profiles, which is good enough for me. Hope it helps anyone...






            share|improve this answer






























              3














              I was looking to do the same and finally got a script working, I put it up on my GitHub.



              Like I explain in the README.md, it doesn't actually switch, but loads a profiles configuration into the Default profile. To do this, the configuration of each profile is saved to file on the first run of the script.
              The script makes it seem like you're switching between profiles, which is good enough for me. Hope it helps anyone...






              share|improve this answer




























                3












                3








                3







                I was looking to do the same and finally got a script working, I put it up on my GitHub.



                Like I explain in the README.md, it doesn't actually switch, but loads a profiles configuration into the Default profile. To do this, the configuration of each profile is saved to file on the first run of the script.
                The script makes it seem like you're switching between profiles, which is good enough for me. Hope it helps anyone...






                share|improve this answer















                I was looking to do the same and finally got a script working, I put it up on my GitHub.



                Like I explain in the README.md, it doesn't actually switch, but loads a profiles configuration into the Default profile. To do this, the configuration of each profile is saved to file on the first run of the script.
                The script makes it seem like you're switching between profiles, which is good enough for me. Hope it helps anyone...







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 3 '16 at 14:52

























                answered Nov 22 '15 at 11:40









                SigiSangSigiSang

                314




                314























                    2














                    Depending on your purpose, you may find this script to be useful:
                    https://github.com/xyrix/gnome-terminal-profile-switcher



                    It does a sort of monkey patch and generates a new profile for each terminal, then sets some environment variables to expose a program for switching the theme of the profile for your current terminal.



                    Hopefully the example safe_ssh script will make things clear :-). I've been using it for just over a year now and it's helped me not destroy the company's live database ^_^






                    share|improve this answer




























                      2














                      Depending on your purpose, you may find this script to be useful:
                      https://github.com/xyrix/gnome-terminal-profile-switcher



                      It does a sort of monkey patch and generates a new profile for each terminal, then sets some environment variables to expose a program for switching the theme of the profile for your current terminal.



                      Hopefully the example safe_ssh script will make things clear :-). I've been using it for just over a year now and it's helped me not destroy the company's live database ^_^






                      share|improve this answer


























                        2












                        2








                        2







                        Depending on your purpose, you may find this script to be useful:
                        https://github.com/xyrix/gnome-terminal-profile-switcher



                        It does a sort of monkey patch and generates a new profile for each terminal, then sets some environment variables to expose a program for switching the theme of the profile for your current terminal.



                        Hopefully the example safe_ssh script will make things clear :-). I've been using it for just over a year now and it's helped me not destroy the company's live database ^_^






                        share|improve this answer













                        Depending on your purpose, you may find this script to be useful:
                        https://github.com/xyrix/gnome-terminal-profile-switcher



                        It does a sort of monkey patch and generates a new profile for each terminal, then sets some environment variables to expose a program for switching the theme of the profile for your current terminal.



                        Hopefully the example safe_ssh script will make things clear :-). I've been using it for just over a year now and it's helped me not destroy the company's live database ^_^







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jan 10 '14 at 19:23









                        xyrixxyrix

                        311




                        311























                            1














                            If you have a list of servers that you access often, I believe the easiest solution would be to simply invoke a second window just for that box's session.



                            First, make a separate gnome-terminal profile for each remote location that you use often. Then, in each profile, specify that the terminal should execute the SSH login command for that box, instead of a plain shell.



                            ssh alice@athena


                            Finally, write a short script to kick off a new remote window given a profile ID.



                            #!/bin/bash
                            if [[ $# -ne 1 ]] ; then
                            echo "Give me a server/profile name!"
                            exit 1
                            fi
                            gnome-terminal --window-with-profile=$1
                            exit 0


                            Using this strategy you can "infinitely" vary the look of each box's terminal window, and kick them off from a single "control" terminal. For example, if we call this script "rlv", then we can spawn a remote window by simply invoking the script with a profile name.



                            >> rlv athena


                            If you ever fat-finger a host name, or neglect to set up a profile for that host, then you'll just get another default-profile window on the local box. There's a way to code the script to avoid this, by putting the login into the script itself, rather than in the gnome-terminal :



                            #!/bin/bash
                            if [[ $# -ne 1 ]] ; then
                            echo "Give me a server/profile name!"
                            exit 1
                            fi
                            gnome-terminal --window-with-profile=$1 -e "ssh $1"
                            exit 0


                            ...but then you lose the flexibility of defining your login username for that box. That additional feature of the script I leave as an exercise to the reader.






                            share|improve this answer




























                              1














                              If you have a list of servers that you access often, I believe the easiest solution would be to simply invoke a second window just for that box's session.



                              First, make a separate gnome-terminal profile for each remote location that you use often. Then, in each profile, specify that the terminal should execute the SSH login command for that box, instead of a plain shell.



                              ssh alice@athena


                              Finally, write a short script to kick off a new remote window given a profile ID.



                              #!/bin/bash
                              if [[ $# -ne 1 ]] ; then
                              echo "Give me a server/profile name!"
                              exit 1
                              fi
                              gnome-terminal --window-with-profile=$1
                              exit 0


                              Using this strategy you can "infinitely" vary the look of each box's terminal window, and kick them off from a single "control" terminal. For example, if we call this script "rlv", then we can spawn a remote window by simply invoking the script with a profile name.



                              >> rlv athena


                              If you ever fat-finger a host name, or neglect to set up a profile for that host, then you'll just get another default-profile window on the local box. There's a way to code the script to avoid this, by putting the login into the script itself, rather than in the gnome-terminal :



                              #!/bin/bash
                              if [[ $# -ne 1 ]] ; then
                              echo "Give me a server/profile name!"
                              exit 1
                              fi
                              gnome-terminal --window-with-profile=$1 -e "ssh $1"
                              exit 0


                              ...but then you lose the flexibility of defining your login username for that box. That additional feature of the script I leave as an exercise to the reader.






                              share|improve this answer


























                                1












                                1








                                1







                                If you have a list of servers that you access often, I believe the easiest solution would be to simply invoke a second window just for that box's session.



                                First, make a separate gnome-terminal profile for each remote location that you use often. Then, in each profile, specify that the terminal should execute the SSH login command for that box, instead of a plain shell.



                                ssh alice@athena


                                Finally, write a short script to kick off a new remote window given a profile ID.



                                #!/bin/bash
                                if [[ $# -ne 1 ]] ; then
                                echo "Give me a server/profile name!"
                                exit 1
                                fi
                                gnome-terminal --window-with-profile=$1
                                exit 0


                                Using this strategy you can "infinitely" vary the look of each box's terminal window, and kick them off from a single "control" terminal. For example, if we call this script "rlv", then we can spawn a remote window by simply invoking the script with a profile name.



                                >> rlv athena


                                If you ever fat-finger a host name, or neglect to set up a profile for that host, then you'll just get another default-profile window on the local box. There's a way to code the script to avoid this, by putting the login into the script itself, rather than in the gnome-terminal :



                                #!/bin/bash
                                if [[ $# -ne 1 ]] ; then
                                echo "Give me a server/profile name!"
                                exit 1
                                fi
                                gnome-terminal --window-with-profile=$1 -e "ssh $1"
                                exit 0


                                ...but then you lose the flexibility of defining your login username for that box. That additional feature of the script I leave as an exercise to the reader.






                                share|improve this answer













                                If you have a list of servers that you access often, I believe the easiest solution would be to simply invoke a second window just for that box's session.



                                First, make a separate gnome-terminal profile for each remote location that you use often. Then, in each profile, specify that the terminal should execute the SSH login command for that box, instead of a plain shell.



                                ssh alice@athena


                                Finally, write a short script to kick off a new remote window given a profile ID.



                                #!/bin/bash
                                if [[ $# -ne 1 ]] ; then
                                echo "Give me a server/profile name!"
                                exit 1
                                fi
                                gnome-terminal --window-with-profile=$1
                                exit 0


                                Using this strategy you can "infinitely" vary the look of each box's terminal window, and kick them off from a single "control" terminal. For example, if we call this script "rlv", then we can spawn a remote window by simply invoking the script with a profile name.



                                >> rlv athena


                                If you ever fat-finger a host name, or neglect to set up a profile for that host, then you'll just get another default-profile window on the local box. There's a way to code the script to avoid this, by putting the login into the script itself, rather than in the gnome-terminal :



                                #!/bin/bash
                                if [[ $# -ne 1 ]] ; then
                                echo "Give me a server/profile name!"
                                exit 1
                                fi
                                gnome-terminal --window-with-profile=$1 -e "ssh $1"
                                exit 0


                                ...but then you lose the flexibility of defining your login username for that box. That additional feature of the script I leave as an exercise to the reader.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered May 20 '14 at 19:32









                                zerobandwidthzerobandwidth

                                7281714




                                7281714























                                    1














                                    I've just noticed that my original solution has been already rejected in the question. While there seems no simple way to change the profile, you can change background / foreground color by using setterm command.



                                    So, this setterm -term linux -background black -foreground green would give you black background with green text. The only problem is that ls has colorized output, so you might wanna turn ls coloring off. Otherwise it resets to previous color scheme



                                    Original post: There is a sort-of way around. From man gnome-terminal :




                                    --window-with-profile=PROFILENAME



                                                 Open a new window containing a  tab  with  the
                                    given profile. More than one of these options
                                    can be provided.



                                    Here's example from my machine. I have three profiles: B&G(black on green), ForPrinting(black font, white background), and Default. So what I do is in current window type gnome-terminal --window-with-profile=ForPrinting . Then I can either kill old window from command line or switch and close it graphically.



                                    B&G profile doesn't work. Probably because & is not a valid character, so keep that in mind when naming profiles.






                                    share|improve this answer






























                                      1














                                      I've just noticed that my original solution has been already rejected in the question. While there seems no simple way to change the profile, you can change background / foreground color by using setterm command.



                                      So, this setterm -term linux -background black -foreground green would give you black background with green text. The only problem is that ls has colorized output, so you might wanna turn ls coloring off. Otherwise it resets to previous color scheme



                                      Original post: There is a sort-of way around. From man gnome-terminal :




                                      --window-with-profile=PROFILENAME



                                                   Open a new window containing a  tab  with  the
                                      given profile. More than one of these options
                                      can be provided.



                                      Here's example from my machine. I have three profiles: B&G(black on green), ForPrinting(black font, white background), and Default. So what I do is in current window type gnome-terminal --window-with-profile=ForPrinting . Then I can either kill old window from command line or switch and close it graphically.



                                      B&G profile doesn't work. Probably because & is not a valid character, so keep that in mind when naming profiles.






                                      share|improve this answer




























                                        1












                                        1








                                        1







                                        I've just noticed that my original solution has been already rejected in the question. While there seems no simple way to change the profile, you can change background / foreground color by using setterm command.



                                        So, this setterm -term linux -background black -foreground green would give you black background with green text. The only problem is that ls has colorized output, so you might wanna turn ls coloring off. Otherwise it resets to previous color scheme



                                        Original post: There is a sort-of way around. From man gnome-terminal :




                                        --window-with-profile=PROFILENAME



                                                     Open a new window containing a  tab  with  the
                                        given profile. More than one of these options
                                        can be provided.



                                        Here's example from my machine. I have three profiles: B&G(black on green), ForPrinting(black font, white background), and Default. So what I do is in current window type gnome-terminal --window-with-profile=ForPrinting . Then I can either kill old window from command line or switch and close it graphically.



                                        B&G profile doesn't work. Probably because & is not a valid character, so keep that in mind when naming profiles.






                                        share|improve this answer















                                        I've just noticed that my original solution has been already rejected in the question. While there seems no simple way to change the profile, you can change background / foreground color by using setterm command.



                                        So, this setterm -term linux -background black -foreground green would give you black background with green text. The only problem is that ls has colorized output, so you might wanna turn ls coloring off. Otherwise it resets to previous color scheme



                                        Original post: There is a sort-of way around. From man gnome-terminal :




                                        --window-with-profile=PROFILENAME



                                                     Open a new window containing a  tab  with  the
                                        given profile. More than one of these options
                                        can be provided.



                                        Here's example from my machine. I have three profiles: B&G(black on green), ForPrinting(black font, white background), and Default. So what I do is in current window type gnome-terminal --window-with-profile=ForPrinting . Then I can either kill old window from command line or switch and close it graphically.



                                        B&G profile doesn't work. Probably because & is not a valid character, so keep that in mind when naming profiles.







                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Sep 28 '14 at 8:19

























                                        answered Sep 28 '14 at 7:57









                                        Sergiy KolodyazhnyySergiy Kolodyazhnyy

                                        74.6k9155325




                                        74.6k9155325























                                            1














                                            A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...



                                            The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.



                                            e.g. xdotool key shift+F10 r 3 to get to the third profile



                                            I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.



                                            I tend to change profiles a lot so I wrap this into a function:



                                            function chp(){
                                            xdotool --clearmodifiers key Shift+F10 r $1
                                            }


                                            so I can just call chp N to switch to the Nth profile.



                                            Some more tips and idiosyncrasies of my setup:




                                            • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile


                                            • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution:
                                              alias somehost="chp 2; ssh user@somehost; chp 1"


                                            • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.


                                            • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu







                                            share|improve this answer


























                                            • ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                              – brotherJ4mes
                                              Feb 5 at 18:00
















                                            1














                                            A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...



                                            The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.



                                            e.g. xdotool key shift+F10 r 3 to get to the third profile



                                            I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.



                                            I tend to change profiles a lot so I wrap this into a function:



                                            function chp(){
                                            xdotool --clearmodifiers key Shift+F10 r $1
                                            }


                                            so I can just call chp N to switch to the Nth profile.



                                            Some more tips and idiosyncrasies of my setup:




                                            • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile


                                            • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution:
                                              alias somehost="chp 2; ssh user@somehost; chp 1"


                                            • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.


                                            • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu







                                            share|improve this answer


























                                            • ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                              – brotherJ4mes
                                              Feb 5 at 18:00














                                            1












                                            1








                                            1







                                            A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...



                                            The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.



                                            e.g. xdotool key shift+F10 r 3 to get to the third profile



                                            I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.



                                            I tend to change profiles a lot so I wrap this into a function:



                                            function chp(){
                                            xdotool --clearmodifiers key Shift+F10 r $1
                                            }


                                            so I can just call chp N to switch to the Nth profile.



                                            Some more tips and idiosyncrasies of my setup:




                                            • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile


                                            • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution:
                                              alias somehost="chp 2; ssh user@somehost; chp 1"


                                            • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.


                                            • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu







                                            share|improve this answer















                                            A lot of great answers already but I wanted to add one more variation using xdotool that does not require the menu bar to be visible...



                                            The key combo shift+F10 will open a pop-up menu (the equivalent of right-clicking on terminal) and from there the profile can be changed.



                                            e.g. xdotool key shift+F10 r 3 to get to the third profile



                                            I've also found that this method does not require setting a delay for xdotool (which I found necessary for the menu bar method) so it's therefore a little faster.



                                            I tend to change profiles a lot so I wrap this into a function:



                                            function chp(){
                                            xdotool --clearmodifiers key Shift+F10 r $1
                                            }


                                            so I can just call chp N to switch to the Nth profile.



                                            Some more tips and idiosyncrasies of my setup:




                                            • By adding a chp command to my .bashrc I can force new tabs to always switch to the default profile


                                            • I color code my ssh sessions based on host but I don't like my ssh alias to open new tabs or windows AND I want the profile to change back to the default when I exit ssh. My solution:
                                              alias somehost="chp 2; ssh user@somehost; chp 1"


                                            • I give xdotool the flag --clearmodifiers so that if I happen to be holding a modifier key (when opening a tab/window, exiting ssh, etc.), it won't interfere with xdotool.


                                            • I prepend my profile names with numbers so that if I add a new one, it doesn't shift all the others due to the alphabetizing of the profile menu








                                            share|improve this answer














                                            share|improve this answer



                                            share|improve this answer








                                            edited Feb 4 at 15:15

























                                            answered Feb 1 at 16:18









                                            brotherJ4mesbrotherJ4mes

                                            112




                                            112













                                            • ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                              – brotherJ4mes
                                              Feb 5 at 18:00



















                                            • ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                              – brotherJ4mes
                                              Feb 5 at 18:00

















                                            ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                            – brotherJ4mes
                                            Feb 5 at 18:00





                                            ...just a note that this method requires the menu accelerator key to be enabled in terminal settings > general

                                            – brotherJ4mes
                                            Feb 5 at 18:00











                                            0














                                            The very ugly solution I've ended up using is



                                            unset x y
                                            eval $(xwininfo -id $(xdotool getactivewindow) |
                                            sed -n -e 's/^ +Absolute upper-left X: +([0-9]+).*/x=1/p'
                                            -e 's/^ +Absolute upper-left Y: +([0-9]+).*/y=1/p')
                                            xdotool mousemove $(($x + 50)) $(($y + 50))
                                            xdotool click 3; xdotool key --repeat 3 Up; xdotool key Right; xdotool key --delay 50 Down; xdotool key --delay 50 Return


                                            (This selects the second profile, but you could change that to say the htir profile by changing the second "key Down" command to xdotool key --delay 50 --repeat 2 Down.



                                            What's this doing:




                                            1. find the the top left coordinates of the current window (eg. the gnome terminal in use).

                                            2. move the mouse to be over that terminal

                                            3. right click and navigate the context menu to select the second profile.


                                            You'll need xdotool installed sudo apt install xdotool.



                                            Kind of extraordinary that the terminal itself doesn't doesn't allow configuration via the terminal!






                                            share|improve this answer




























                                              0














                                              The very ugly solution I've ended up using is



                                              unset x y
                                              eval $(xwininfo -id $(xdotool getactivewindow) |
                                              sed -n -e 's/^ +Absolute upper-left X: +([0-9]+).*/x=1/p'
                                              -e 's/^ +Absolute upper-left Y: +([0-9]+).*/y=1/p')
                                              xdotool mousemove $(($x + 50)) $(($y + 50))
                                              xdotool click 3; xdotool key --repeat 3 Up; xdotool key Right; xdotool key --delay 50 Down; xdotool key --delay 50 Return


                                              (This selects the second profile, but you could change that to say the htir profile by changing the second "key Down" command to xdotool key --delay 50 --repeat 2 Down.



                                              What's this doing:




                                              1. find the the top left coordinates of the current window (eg. the gnome terminal in use).

                                              2. move the mouse to be over that terminal

                                              3. right click and navigate the context menu to select the second profile.


                                              You'll need xdotool installed sudo apt install xdotool.



                                              Kind of extraordinary that the terminal itself doesn't doesn't allow configuration via the terminal!






                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                The very ugly solution I've ended up using is



                                                unset x y
                                                eval $(xwininfo -id $(xdotool getactivewindow) |
                                                sed -n -e 's/^ +Absolute upper-left X: +([0-9]+).*/x=1/p'
                                                -e 's/^ +Absolute upper-left Y: +([0-9]+).*/y=1/p')
                                                xdotool mousemove $(($x + 50)) $(($y + 50))
                                                xdotool click 3; xdotool key --repeat 3 Up; xdotool key Right; xdotool key --delay 50 Down; xdotool key --delay 50 Return


                                                (This selects the second profile, but you could change that to say the htir profile by changing the second "key Down" command to xdotool key --delay 50 --repeat 2 Down.



                                                What's this doing:




                                                1. find the the top left coordinates of the current window (eg. the gnome terminal in use).

                                                2. move the mouse to be over that terminal

                                                3. right click and navigate the context menu to select the second profile.


                                                You'll need xdotool installed sudo apt install xdotool.



                                                Kind of extraordinary that the terminal itself doesn't doesn't allow configuration via the terminal!






                                                share|improve this answer













                                                The very ugly solution I've ended up using is



                                                unset x y
                                                eval $(xwininfo -id $(xdotool getactivewindow) |
                                                sed -n -e 's/^ +Absolute upper-left X: +([0-9]+).*/x=1/p'
                                                -e 's/^ +Absolute upper-left Y: +([0-9]+).*/y=1/p')
                                                xdotool mousemove $(($x + 50)) $(($y + 50))
                                                xdotool click 3; xdotool key --repeat 3 Up; xdotool key Right; xdotool key --delay 50 Down; xdotool key --delay 50 Return


                                                (This selects the second profile, but you could change that to say the htir profile by changing the second "key Down" command to xdotool key --delay 50 --repeat 2 Down.



                                                What's this doing:




                                                1. find the the top left coordinates of the current window (eg. the gnome terminal in use).

                                                2. move the mouse to be over that terminal

                                                3. right click and navigate the context menu to select the second profile.


                                                You'll need xdotool installed sudo apt install xdotool.



                                                Kind of extraordinary that the terminal itself doesn't doesn't allow configuration via the terminal!







                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Mar 22 '17 at 14:45









                                                SColvinSColvin

                                                1186




                                                1186























                                                    0














                                                    It would be great of gnome-terminal offered a "next profile" command and shortcut; unfortunately, it does not.



                                                    A workaround for those with Alt+T disabled (Edit > Preferences > Enable mnemonics - unchecked) is: F10 left left down right and select the profile. Ouch.






                                                    share|improve this answer
























                                                    • Worth noting that this requires the menu bar to be visible.

                                                      – Gauthier
                                                      Jan 31 '18 at 15:12
















                                                    0














                                                    It would be great of gnome-terminal offered a "next profile" command and shortcut; unfortunately, it does not.



                                                    A workaround for those with Alt+T disabled (Edit > Preferences > Enable mnemonics - unchecked) is: F10 left left down right and select the profile. Ouch.






                                                    share|improve this answer
























                                                    • Worth noting that this requires the menu bar to be visible.

                                                      – Gauthier
                                                      Jan 31 '18 at 15:12














                                                    0












                                                    0








                                                    0







                                                    It would be great of gnome-terminal offered a "next profile" command and shortcut; unfortunately, it does not.



                                                    A workaround for those with Alt+T disabled (Edit > Preferences > Enable mnemonics - unchecked) is: F10 left left down right and select the profile. Ouch.






                                                    share|improve this answer













                                                    It would be great of gnome-terminal offered a "next profile" command and shortcut; unfortunately, it does not.



                                                    A workaround for those with Alt+T disabled (Edit > Preferences > Enable mnemonics - unchecked) is: F10 left left down right and select the profile. Ouch.







                                                    share|improve this answer












                                                    share|improve this answer



                                                    share|improve this answer










                                                    answered Jan 24 '18 at 20:12









                                                    MarioMario

                                                    121113




                                                    121113













                                                    • Worth noting that this requires the menu bar to be visible.

                                                      – Gauthier
                                                      Jan 31 '18 at 15:12



















                                                    • Worth noting that this requires the menu bar to be visible.

                                                      – Gauthier
                                                      Jan 31 '18 at 15:12

















                                                    Worth noting that this requires the menu bar to be visible.

                                                    – Gauthier
                                                    Jan 31 '18 at 15:12





                                                    Worth noting that this requires the menu bar to be visible.

                                                    – Gauthier
                                                    Jan 31 '18 at 15:12


















                                                    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%2f325235%2fcommand-line-to-switch-between-profiles-in-gnome-terminal%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

                                                    How to change which sound is reproduced for terminal bell?

                                                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents