How to start an application on a different workspace?












9















I need to start a GUI application [Lotus Symphony] on a workspace different from the currently used one. [ex.: there are 4 workspaces on a GNOME desktop.]



Q: How do I do this?



p.s.: It's needed because Lotus Symphony's first start after a reboot is very, very slow, but after it's been used once, it starts very quickly. I think it caches itself. That's why I want to start it at every boot on a different workspace, so it will be fast later if I need to use it.










share|improve this question

























  • I suppose it could be helpful to know what OS and what version of GNOME you are using.

    – enzotib
    Dec 17 '11 at 15:03











  • ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

    – LanceBaynes
    Dec 17 '11 at 18:20
















9















I need to start a GUI application [Lotus Symphony] on a workspace different from the currently used one. [ex.: there are 4 workspaces on a GNOME desktop.]



Q: How do I do this?



p.s.: It's needed because Lotus Symphony's first start after a reboot is very, very slow, but after it's been used once, it starts very quickly. I think it caches itself. That's why I want to start it at every boot on a different workspace, so it will be fast later if I need to use it.










share|improve this question

























  • I suppose it could be helpful to know what OS and what version of GNOME you are using.

    – enzotib
    Dec 17 '11 at 15:03











  • ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

    – LanceBaynes
    Dec 17 '11 at 18:20














9












9








9


1






I need to start a GUI application [Lotus Symphony] on a workspace different from the currently used one. [ex.: there are 4 workspaces on a GNOME desktop.]



Q: How do I do this?



p.s.: It's needed because Lotus Symphony's first start after a reboot is very, very slow, but after it's been used once, it starts very quickly. I think it caches itself. That's why I want to start it at every boot on a different workspace, so it will be fast later if I need to use it.










share|improve this question
















I need to start a GUI application [Lotus Symphony] on a workspace different from the currently used one. [ex.: there are 4 workspaces on a GNOME desktop.]



Q: How do I do this?



p.s.: It's needed because Lotus Symphony's first start after a reboot is very, very slow, but after it's been used once, it starts very quickly. I think it caches itself. That's why I want to start it at every boot on a different workspace, so it will be fast later if I need to use it.







workspaces






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 17 '11 at 15:06









Mat

39.6k8121127




39.6k8121127










asked Dec 17 '11 at 14:59









LanceBaynesLanceBaynes

10.6k76199325




10.6k76199325













  • I suppose it could be helpful to know what OS and what version of GNOME you are using.

    – enzotib
    Dec 17 '11 at 15:03











  • ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

    – LanceBaynes
    Dec 17 '11 at 18:20



















  • I suppose it could be helpful to know what OS and what version of GNOME you are using.

    – enzotib
    Dec 17 '11 at 15:03











  • ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

    – LanceBaynes
    Dec 17 '11 at 18:20

















I suppose it could be helpful to know what OS and what version of GNOME you are using.

– enzotib
Dec 17 '11 at 15:03





I suppose it could be helpful to know what OS and what version of GNOME you are using.

– enzotib
Dec 17 '11 at 15:03













ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

– LanceBaynes
Dec 17 '11 at 18:20





ubuntu 10.04 - gnome-desktop-data 1:2.30.2-0ubuntu1

– LanceBaynes
Dec 17 '11 at 18:20










4 Answers
4






active

oldest

votes


















7














Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.



Basically you should do the following:



#!/bin/bash
wmctrl -n 8

firefox &
thunderbird &
/usr/bin/netbeans --locale en &
amsn &
gnome-terminal &
sleep 15

wmctrl -r firefox -t 0
wmctrl -r netbeans -t 1
wmctrl -r terminal -t 2
wmctrl -r amsn -t 6
wmctrl -r thunderbird -t 7

#focus on terminal
wmctrl -a terminal


(i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).



UPDATE:



See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3.
In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.






share|improve this answer

































    2














    Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatevever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables--I quoted variables I deemed necessary to be quoted.



    #!/bin/sh



    ## Author: B.A. Computer Services www.bornagaincomputer.com
    ## Purpose: Frontend to launch anything on a specific desktop/workspace.
    ## lh is short for LaunchHere

    USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command
    LaunchHere launches COMMAND on specific workspace.
    -r option returns to current workspace"
    [ -z "$1" ] && echo $USAGE && exit 0
    ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;
    WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
    WSN=$(expr $WRKSPC - 1) ## wmctrl starts with 0 as first wrkspc
    shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

    WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
    CURRENT=$(wmctrl -d | grep '*' | cut -c1)


    # Switch to desired workspace
    $WM -s $WSN
    $CMD &
    PID=$!
    echo Executed $CMD on workspace $WRKSPC, PID=$PID
    sleep 3

    # Return to CURRENT workspace ?
    # [ $ISRETURN ] && echo TRUE || echo FALSE
    [ $ISRETURN ] && $WM -s $CURRENT





    share|improve this answer


























    • This is so great. Works like a charm. Thanks a lot!

      – Mic
      Nov 6 '18 at 9:26



















    0














    Beta - but it works for me on linux mint.



    #!/bin/sh
    ## Author: B.A. Computer Services www.bornagaincomputer.com
    ## Purpose: Frontend to launch anything on a specific desktop/workspace.
    ## lh is short for LaunchHere

    USAGE="USAGE: $(basename $0) workspace(0,1,2,..) command"
    WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
    shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

    WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1

    echo Executing $CMD on workspace $WRKSPC
    $WM -s $WRKSPC
    eval $CMD &
    sleep 1
    $WM -r :ACTIVE: -t $WRKSPC





    share|improve this answer
























    • The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

      – Kusalananda
      Mar 2 '18 at 17:18



















    0














    Script of b.a.c.s. does start my thunderbird, but still on workspace 0. Tried to increase sleep to 5, but still on workspace 0.



    Second script does nothing on my mint 19.1






    share|improve this answer








    New contributor




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




















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2funix.stackexchange.com%2fquestions%2f27050%2fhow-to-start-an-application-on-a-different-workspace%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      7














      Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.



      Basically you should do the following:



      #!/bin/bash
      wmctrl -n 8

      firefox &
      thunderbird &
      /usr/bin/netbeans --locale en &
      amsn &
      gnome-terminal &
      sleep 15

      wmctrl -r firefox -t 0
      wmctrl -r netbeans -t 1
      wmctrl -r terminal -t 2
      wmctrl -r amsn -t 6
      wmctrl -r thunderbird -t 7

      #focus on terminal
      wmctrl -a terminal


      (i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).



      UPDATE:



      See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3.
      In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.






      share|improve this answer






























        7














        Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.



        Basically you should do the following:



        #!/bin/bash
        wmctrl -n 8

        firefox &
        thunderbird &
        /usr/bin/netbeans --locale en &
        amsn &
        gnome-terminal &
        sleep 15

        wmctrl -r firefox -t 0
        wmctrl -r netbeans -t 1
        wmctrl -r terminal -t 2
        wmctrl -r amsn -t 6
        wmctrl -r thunderbird -t 7

        #focus on terminal
        wmctrl -a terminal


        (i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).



        UPDATE:



        See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3.
        In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.






        share|improve this answer




























          7












          7








          7







          Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.



          Basically you should do the following:



          #!/bin/bash
          wmctrl -n 8

          firefox &
          thunderbird &
          /usr/bin/netbeans --locale en &
          amsn &
          gnome-terminal &
          sleep 15

          wmctrl -r firefox -t 0
          wmctrl -r netbeans -t 1
          wmctrl -r terminal -t 2
          wmctrl -r amsn -t 6
          wmctrl -r thunderbird -t 7

          #focus on terminal
          wmctrl -a terminal


          (i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).



          UPDATE:



          See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3.
          In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.






          share|improve this answer















          Check out Devil's Pie (although i am not sure it would work with Gnome3), and you can find more useful information on stackoverflow bash.



          Basically you should do the following:



          #!/bin/bash
          wmctrl -n 8

          firefox &
          thunderbird &
          /usr/bin/netbeans --locale en &
          amsn &
          gnome-terminal &
          sleep 15

          wmctrl -r firefox -t 0
          wmctrl -r netbeans -t 1
          wmctrl -r terminal -t 2
          wmctrl -r amsn -t 6
          wmctrl -r thunderbird -t 7

          #focus on terminal
          wmctrl -a terminal


          (i have just copy & pase the above code from the StackOverFlow link above, since i think it is self explanatory).



          UPDATE:



          See here for an easier solution at the best site for Gnome 3 extensions, you should install the Auto Move Windows extension for Gnome 3.
          In case it isn't working for you (as you can see at the link there are some distros that the automation of the installation isn't working right, get a more detailed exploitations here on how to get it work.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited May 23 '17 at 12:40









          Community

          1




          1










          answered Dec 17 '11 at 21:15









          Hanan N.Hanan N.

          3,70632128




          3,70632128

























              2














              Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatevever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables--I quoted variables I deemed necessary to be quoted.



              #!/bin/sh



              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command
              LaunchHere launches COMMAND on specific workspace.
              -r option returns to current workspace"
              [ -z "$1" ] && echo $USAGE && exit 0
              ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              WSN=$(expr $WRKSPC - 1) ## wmctrl starts with 0 as first wrkspc
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
              CURRENT=$(wmctrl -d | grep '*' | cut -c1)


              # Switch to desired workspace
              $WM -s $WSN
              $CMD &
              PID=$!
              echo Executed $CMD on workspace $WRKSPC, PID=$PID
              sleep 3

              # Return to CURRENT workspace ?
              # [ $ISRETURN ] && echo TRUE || echo FALSE
              [ $ISRETURN ] && $WM -s $CURRENT





              share|improve this answer


























              • This is so great. Works like a charm. Thanks a lot!

                – Mic
                Nov 6 '18 at 9:26
















              2














              Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatevever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables--I quoted variables I deemed necessary to be quoted.



              #!/bin/sh



              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command
              LaunchHere launches COMMAND on specific workspace.
              -r option returns to current workspace"
              [ -z "$1" ] && echo $USAGE && exit 0
              ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              WSN=$(expr $WRKSPC - 1) ## wmctrl starts with 0 as first wrkspc
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
              CURRENT=$(wmctrl -d | grep '*' | cut -c1)


              # Switch to desired workspace
              $WM -s $WSN
              $CMD &
              PID=$!
              echo Executed $CMD on workspace $WRKSPC, PID=$PID
              sleep 3

              # Return to CURRENT workspace ?
              # [ $ISRETURN ] && echo TRUE || echo FALSE
              [ $ISRETURN ] && $WM -s $CURRENT





              share|improve this answer


























              • This is so great. Works like a charm. Thanks a lot!

                – Mic
                Nov 6 '18 at 9:26














              2












              2








              2







              Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatevever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables--I quoted variables I deemed necessary to be quoted.



              #!/bin/sh



              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command
              LaunchHere launches COMMAND on specific workspace.
              -r option returns to current workspace"
              [ -z "$1" ] && echo $USAGE && exit 0
              ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              WSN=$(expr $WRKSPC - 1) ## wmctrl starts with 0 as first wrkspc
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
              CURRENT=$(wmctrl -d | grep '*' | cut -c1)


              # Switch to desired workspace
              $WM -s $WSN
              $CMD &
              PID=$!
              echo Executed $CMD on workspace $WRKSPC, PID=$PID
              sleep 3

              # Return to CURRENT workspace ?
              # [ $ISRETURN ] && echo TRUE || echo FALSE
              [ $ISRETURN ] && $WM -s $CURRENT





              share|improve this answer















              Original post was regarding using a script to make an application appear on a particular workspace, such that another script might be used in Start Up script to allow a user to continue working while a very slow starting application loaded on another workspace. My script works great as front-end for the rather cumbersome wmctrl syntax, to launch any one application on any given workspace, from any command prompt. Thus a further script that simply lists something like, lh 1 thunderbird; lh 2 firefox; lh 3 calculator...., or whatevever, is now easy. There are however some difficulties with timing, thus the sleep in my script. The below is updated version, which I will not be maintaining or post again. Use AS IS, no guarantee of fitfulness for any particular use. Modify as you please. I suggest saving as /usr/local/bin/lh, simply because lh is not any other known program name, at least not on Mint 18. As for variables--I quoted variables I deemed necessary to be quoted.



              #!/bin/sh



              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) [-r] workspace(1,2,..) command
              LaunchHere launches COMMAND on specific workspace.
              -r option returns to current workspace"
              [ -z "$1" ] && echo $USAGE && exit 0
              ISRETURN=$(false); [ "$1" = "-r" ] && ISRETURN=true && shift;
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              WSN=$(expr $WRKSPC - 1) ## wmctrl starts with 0 as first wrkspc
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1
              CURRENT=$(wmctrl -d | grep '*' | cut -c1)


              # Switch to desired workspace
              $WM -s $WSN
              $CMD &
              PID=$!
              echo Executed $CMD on workspace $WRKSPC, PID=$PID
              sleep 3

              # Return to CURRENT workspace ?
              # [ $ISRETURN ] && echo TRUE || echo FALSE
              [ $ISRETURN ] && $WM -s $CURRENT






              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Apr 17 '18 at 18:19

























              answered Apr 13 '18 at 15:38









              b-a-c-sb-a-c-s

              213




              213













              • This is so great. Works like a charm. Thanks a lot!

                – Mic
                Nov 6 '18 at 9:26



















              • This is so great. Works like a charm. Thanks a lot!

                – Mic
                Nov 6 '18 at 9:26

















              This is so great. Works like a charm. Thanks a lot!

              – Mic
              Nov 6 '18 at 9:26





              This is so great. Works like a charm. Thanks a lot!

              – Mic
              Nov 6 '18 at 9:26











              0














              Beta - but it works for me on linux mint.



              #!/bin/sh
              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) workspace(0,1,2,..) command"
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1

              echo Executing $CMD on workspace $WRKSPC
              $WM -s $WRKSPC
              eval $CMD &
              sleep 1
              $WM -r :ACTIVE: -t $WRKSPC





              share|improve this answer
























              • The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

                – Kusalananda
                Mar 2 '18 at 17:18
















              0














              Beta - but it works for me on linux mint.



              #!/bin/sh
              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) workspace(0,1,2,..) command"
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1

              echo Executing $CMD on workspace $WRKSPC
              $WM -s $WRKSPC
              eval $CMD &
              sleep 1
              $WM -r :ACTIVE: -t $WRKSPC





              share|improve this answer
























              • The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

                – Kusalananda
                Mar 2 '18 at 17:18














              0












              0








              0







              Beta - but it works for me on linux mint.



              #!/bin/sh
              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) workspace(0,1,2,..) command"
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1

              echo Executing $CMD on workspace $WRKSPC
              $WM -s $WRKSPC
              eval $CMD &
              sleep 1
              $WM -r :ACTIVE: -t $WRKSPC





              share|improve this answer













              Beta - but it works for me on linux mint.



              #!/bin/sh
              ## Author: B.A. Computer Services www.bornagaincomputer.com
              ## Purpose: Frontend to launch anything on a specific desktop/workspace.
              ## lh is short for LaunchHere

              USAGE="USAGE: $(basename $0) workspace(0,1,2,..) command"
              WRKSPC=$1;[ -z "$WRKSPC" ] && echo $USAGE && exit 0
              shift; CMD="$*"; [ -z "$CMD" ] && echo $USAGE && exit 0

              WM=$(which wmctrl);[ -z "$WM" ] && echo MISSING wmctrl && exit 1

              echo Executing $CMD on workspace $WRKSPC
              $WM -s $WRKSPC
              eval $CMD &
              sleep 1
              $WM -r :ACTIVE: -t $WRKSPC






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Mar 2 '18 at 16:35









              user278634user278634

              1




              1













              • The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

                – Kusalananda
                Mar 2 '18 at 17:18



















              • The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

                – Kusalananda
                Mar 2 '18 at 17:18

















              The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

              – Kusalananda
              Mar 2 '18 at 17:18





              The eval should possibly happen on "$@", or the command, if any of its argument contains spaces or filename globbing characters, will not work. In general, this script needs to quote variable expansions.

              – Kusalananda
              Mar 2 '18 at 17:18











              0














              Script of b.a.c.s. does start my thunderbird, but still on workspace 0. Tried to increase sleep to 5, but still on workspace 0.



              Second script does nothing on my mint 19.1






              share|improve this answer








              New contributor




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

























                0














                Script of b.a.c.s. does start my thunderbird, but still on workspace 0. Tried to increase sleep to 5, but still on workspace 0.



                Second script does nothing on my mint 19.1






                share|improve this answer








                New contributor




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























                  0












                  0








                  0







                  Script of b.a.c.s. does start my thunderbird, but still on workspace 0. Tried to increase sleep to 5, but still on workspace 0.



                  Second script does nothing on my mint 19.1






                  share|improve this answer








                  New contributor




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










                  Script of b.a.c.s. does start my thunderbird, but still on workspace 0. Tried to increase sleep to 5, but still on workspace 0.



                  Second script does nothing on my mint 19.1







                  share|improve this answer








                  New contributor




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









                  share|improve this answer



                  share|improve this answer






                  New contributor




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









                  answered 1 hour ago









                  RemonKRemonK

                  1




                  1




                  New contributor




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





                  New contributor





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






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






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Unix & Linux Stack Exchange!


                      • 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%2funix.stackexchange.com%2fquestions%2f27050%2fhow-to-start-an-application-on-a-different-workspace%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

                      宮崎県

                      濃尾地震

                      シテ島