How to start a new app in a new workspace on Xubuntu 16.04

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
2
down vote

favorite












Is there any way to open a new workspace whenever I open a new app?



For example, I have a terminal on workspace 1 and I want to open spotify but on workspace 2, and also when I open spotify I want to automatically move to workspace 2.



Is this possible?










share|improve this question



























    up vote
    2
    down vote

    favorite












    Is there any way to open a new workspace whenever I open a new app?



    For example, I have a terminal on workspace 1 and I want to open spotify but on workspace 2, and also when I open spotify I want to automatically move to workspace 2.



    Is this possible?










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      Is there any way to open a new workspace whenever I open a new app?



      For example, I have a terminal on workspace 1 and I want to open spotify but on workspace 2, and also when I open spotify I want to automatically move to workspace 2.



      Is this possible?










      share|improve this question















      Is there any way to open a new workspace whenever I open a new app?



      For example, I have a terminal on workspace 1 and I want to open spotify but on workspace 2, and also when I open spotify I want to automatically move to workspace 2.



      Is this possible?







      xubuntu workspaces workspace-switcher






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 14 at 20:59









      Zanna

      48.1k13120228




      48.1k13120228










      asked Mar 14 at 19:47









      Mihai Temian

      132




      132




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          I haven't implemented this particular application, but it looks like xdotool will do what you want.



          Try launching your application with a wrapper script something like:



          desktops=$(xdotool get_num_desktops)
          desktops="$desktops"+1
          xdotool set_num_desktops "$desktops"
          xdotool set_desktop "$desktops"
          run-my-application


          I left out some details which are needed to make this more robust as they will vary a bit depending on what you are doing and would obscure the main idea:



          Each xdotool command returns a status which you should check. If a step fails, you don't want to proceed blindly.



          You may want to set a maximum number of desktops which your script can create.



          xdotool can see if a window already exists and what desktop it is currently on. It can also move a window to another desktop. It can also activate a window, bringing it to the foreground and into focus.



          You may need to add sleep commands after certain operations to give the desktop and especially applications time to do their thing before you run the next step.



          Since your script may be run from the desktop (and not just from a terminal), you may also want to log some messages to a file telling you what the script did to make debugging it easier.



          The part where it gets a bit tricky is when an application has more than one window open. Then, you have to deal with a stack of instances and somehow find the right one or work on all of them. For instance, my Thunderbird asks for a master password when it starts, so it has two windows open.



          xdotool also offers command chaining where you can run multiple actions from one xdotool command. The results of the current action get pushed onto a stack read by the next action in the command. I have found this difficult to visualize and debug, but it's quite powerful if you can get it to work.



          While xdotool is the best fit for this particular issue, you may also want to take a look at AutoKey which can help you automate all sorts of desktop/GUI actions by issuing keypresses and mouse events that look just like you were doing them manually so they will work on most application and desktop features.






          share|improve this answer




















            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',
            convertImagesToLinks: true,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            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%2f1014977%2fhow-to-start-a-new-app-in-a-new-workspace-on-xubuntu-16-04%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            I haven't implemented this particular application, but it looks like xdotool will do what you want.



            Try launching your application with a wrapper script something like:



            desktops=$(xdotool get_num_desktops)
            desktops="$desktops"+1
            xdotool set_num_desktops "$desktops"
            xdotool set_desktop "$desktops"
            run-my-application


            I left out some details which are needed to make this more robust as they will vary a bit depending on what you are doing and would obscure the main idea:



            Each xdotool command returns a status which you should check. If a step fails, you don't want to proceed blindly.



            You may want to set a maximum number of desktops which your script can create.



            xdotool can see if a window already exists and what desktop it is currently on. It can also move a window to another desktop. It can also activate a window, bringing it to the foreground and into focus.



            You may need to add sleep commands after certain operations to give the desktop and especially applications time to do their thing before you run the next step.



            Since your script may be run from the desktop (and not just from a terminal), you may also want to log some messages to a file telling you what the script did to make debugging it easier.



            The part where it gets a bit tricky is when an application has more than one window open. Then, you have to deal with a stack of instances and somehow find the right one or work on all of them. For instance, my Thunderbird asks for a master password when it starts, so it has two windows open.



            xdotool also offers command chaining where you can run multiple actions from one xdotool command. The results of the current action get pushed onto a stack read by the next action in the command. I have found this difficult to visualize and debug, but it's quite powerful if you can get it to work.



            While xdotool is the best fit for this particular issue, you may also want to take a look at AutoKey which can help you automate all sorts of desktop/GUI actions by issuing keypresses and mouse events that look just like you were doing them manually so they will work on most application and desktop features.






            share|improve this answer
























              up vote
              0
              down vote



              accepted










              I haven't implemented this particular application, but it looks like xdotool will do what you want.



              Try launching your application with a wrapper script something like:



              desktops=$(xdotool get_num_desktops)
              desktops="$desktops"+1
              xdotool set_num_desktops "$desktops"
              xdotool set_desktop "$desktops"
              run-my-application


              I left out some details which are needed to make this more robust as they will vary a bit depending on what you are doing and would obscure the main idea:



              Each xdotool command returns a status which you should check. If a step fails, you don't want to proceed blindly.



              You may want to set a maximum number of desktops which your script can create.



              xdotool can see if a window already exists and what desktop it is currently on. It can also move a window to another desktop. It can also activate a window, bringing it to the foreground and into focus.



              You may need to add sleep commands after certain operations to give the desktop and especially applications time to do their thing before you run the next step.



              Since your script may be run from the desktop (and not just from a terminal), you may also want to log some messages to a file telling you what the script did to make debugging it easier.



              The part where it gets a bit tricky is when an application has more than one window open. Then, you have to deal with a stack of instances and somehow find the right one or work on all of them. For instance, my Thunderbird asks for a master password when it starts, so it has two windows open.



              xdotool also offers command chaining where you can run multiple actions from one xdotool command. The results of the current action get pushed onto a stack read by the next action in the command. I have found this difficult to visualize and debug, but it's quite powerful if you can get it to work.



              While xdotool is the best fit for this particular issue, you may also want to take a look at AutoKey which can help you automate all sorts of desktop/GUI actions by issuing keypresses and mouse events that look just like you were doing them manually so they will work on most application and desktop features.






              share|improve this answer






















                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                I haven't implemented this particular application, but it looks like xdotool will do what you want.



                Try launching your application with a wrapper script something like:



                desktops=$(xdotool get_num_desktops)
                desktops="$desktops"+1
                xdotool set_num_desktops "$desktops"
                xdotool set_desktop "$desktops"
                run-my-application


                I left out some details which are needed to make this more robust as they will vary a bit depending on what you are doing and would obscure the main idea:



                Each xdotool command returns a status which you should check. If a step fails, you don't want to proceed blindly.



                You may want to set a maximum number of desktops which your script can create.



                xdotool can see if a window already exists and what desktop it is currently on. It can also move a window to another desktop. It can also activate a window, bringing it to the foreground and into focus.



                You may need to add sleep commands after certain operations to give the desktop and especially applications time to do their thing before you run the next step.



                Since your script may be run from the desktop (and not just from a terminal), you may also want to log some messages to a file telling you what the script did to make debugging it easier.



                The part where it gets a bit tricky is when an application has more than one window open. Then, you have to deal with a stack of instances and somehow find the right one or work on all of them. For instance, my Thunderbird asks for a master password when it starts, so it has two windows open.



                xdotool also offers command chaining where you can run multiple actions from one xdotool command. The results of the current action get pushed onto a stack read by the next action in the command. I have found this difficult to visualize and debug, but it's quite powerful if you can get it to work.



                While xdotool is the best fit for this particular issue, you may also want to take a look at AutoKey which can help you automate all sorts of desktop/GUI actions by issuing keypresses and mouse events that look just like you were doing them manually so they will work on most application and desktop features.






                share|improve this answer












                I haven't implemented this particular application, but it looks like xdotool will do what you want.



                Try launching your application with a wrapper script something like:



                desktops=$(xdotool get_num_desktops)
                desktops="$desktops"+1
                xdotool set_num_desktops "$desktops"
                xdotool set_desktop "$desktops"
                run-my-application


                I left out some details which are needed to make this more robust as they will vary a bit depending on what you are doing and would obscure the main idea:



                Each xdotool command returns a status which you should check. If a step fails, you don't want to proceed blindly.



                You may want to set a maximum number of desktops which your script can create.



                xdotool can see if a window already exists and what desktop it is currently on. It can also move a window to another desktop. It can also activate a window, bringing it to the foreground and into focus.



                You may need to add sleep commands after certain operations to give the desktop and especially applications time to do their thing before you run the next step.



                Since your script may be run from the desktop (and not just from a terminal), you may also want to log some messages to a file telling you what the script did to make debugging it easier.



                The part where it gets a bit tricky is when an application has more than one window open. Then, you have to deal with a stack of instances and somehow find the right one or work on all of them. For instance, my Thunderbird asks for a master password when it starts, so it has two windows open.



                xdotool also offers command chaining where you can run multiple actions from one xdotool command. The results of the current action get pushed onto a stack read by the next action in the command. I have found this difficult to visualize and debug, but it's quite powerful if you can get it to work.



                While xdotool is the best fit for this particular issue, you may also want to take a look at AutoKey which can help you automate all sorts of desktop/GUI actions by issuing keypresses and mouse events that look just like you were doing them manually so they will work on most application and desktop features.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 22 at 7:13









                Joe

                1,171721




                1,171721



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1014977%2fhow-to-start-a-new-app-in-a-new-workspace-on-xubuntu-16-04%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    pylint3 and pip3 broken

                    Missing snmpget and snmpwalk

                    How to enroll fingerprints to Ubuntu 17.10 with VFS491