How to set window size and location of an application on screen via command line?

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











up vote
25
down vote

favorite
6












I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:



firefox myfile.html size 800x600 location bottom-left


Is there such a command?










share|improve this question























  • I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
    – Emanuel Berg
    Jul 15 '12 at 23:08










  • Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
    – sdaau
    Feb 19 '14 at 15:15














up vote
25
down vote

favorite
6












I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:



firefox myfile.html size 800x600 location bottom-left


Is there such a command?










share|improve this question























  • I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
    – Emanuel Berg
    Jul 15 '12 at 23:08










  • Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
    – sdaau
    Feb 19 '14 at 15:15












up vote
25
down vote

favorite
6









up vote
25
down vote

favorite
6






6





I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:



firefox myfile.html size 800x600 location bottom-left


Is there such a command?










share|improve this question















I want Firefox window to be opened in a specific size, and location on screen using a shell command, for example:



firefox myfile.html size 800x600 location bottom-left


Is there such a command?







shell firefox window






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 29 '17 at 13:38









Braiam

22.7k1972133




22.7k1972133










asked Jul 15 '12 at 12:43









alwbtc

241145




241145











  • I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
    – Emanuel Berg
    Jul 15 '12 at 23:08










  • Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
    – sdaau
    Feb 19 '14 at 15:15
















  • I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
    – Emanuel Berg
    Jul 15 '12 at 23:08










  • Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
    – sdaau
    Feb 19 '14 at 15:15















I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
– Emanuel Berg
Jul 15 '12 at 23:08




I managed to do this (with the help of this forum), although if you find any other solution, please tell me as it will probably be more robust: unix.stackexchange.com/questions/40209/…
– Emanuel Berg
Jul 15 '12 at 23:08












Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
– sdaau
Feb 19 '14 at 15:15




Also related: Setting the window dimensions of a running application - Unix & Linux Stack Exchange
– sdaau
Feb 19 '14 at 15:15










6 Answers
6






active

oldest

votes

















up vote
14
down vote













As far as I know, this is not possible as Firefox does not accept commands to control the window. That's also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that's going to be a little bit difficult:



#!/bin/sh

firefox -new-instance -new-window "http://www.reddit.org" &

# Process ID of the process we just launched
PID=$!

# Window ID of the process...pray that there's
# only one window! Otherwise this might break.
# We also need to wait for the process to spawn
# a window.
while [ "$WID" == "" ]; do
WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
done
# Set the size and location of the window
# See man wmctrl for more info
wmctrl -i -r $WID -e 0,50,50,250,250


There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.






share|improve this answer






















  • Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
    – ka3ak
    May 30 at 7:13


















up vote
11
down vote













Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.




You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash, using xdotool, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.




  1. Find the window ID:



    xdotool search --onlyvisible --name firefox



  2. Set the window size



    xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT



  3. Move the window



    xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y


For example, if the window id for firefox is 123 you would do this:



xdotool windowsize 123 800 600
xdotool windowmove 123 0 1080


The bottom-left positioning will have to be figured out based on your screen resolution.






share|improve this answer






















  • There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
    – ThePhi
    Apr 25 at 12:33

















up vote
3
down vote













In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It's a stupid hack but, hey, it works.






share|improve this answer




















  • Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
    – hugomg
    Nov 18 '14 at 18:06

















up vote
2
down vote













I don't think this is possible by shell commands only, cause it has nothing to do with your windowmanager.

I heard of wmctrl and devilspie which can effect this. But I doubt there is a way to achieve that as simple as you wrote in your example.






share|improve this answer



























    up vote
    1
    down vote













    I do this all the time. I use DevilsPie2, however, because it's more robust. It uses the LUA scripting language, which isn't very difficult.



    Here's my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:



    if (get_window_name()=="Mozilla Thunderbird") then
    pin_window()
    set_window_geometry( 50, 10, 1220, 780 )
    end

    where 50 = X coordinate (for upper-left corner of the window)
    10 = Y coordinate ( " " )
    1220 = window width
    780 = window height


    To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2



    For Thunderbird, I created thunderbird.lua, though the filename doesn't matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop



    Here's a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README



    One note: The scripts don't have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.






    share|improve this answer



























      up vote
      0
      down vote













      This doesn't solve the problem of the position, but at least you can set dimensions :



      firefox -width 200 -height 500




      share




















        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',
        convertImagesToLinks: false,
        noModals: false,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        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%2funix.stackexchange.com%2fquestions%2f43106%2fhow-to-set-window-size-and-location-of-an-application-on-screen-via-command-line%23new-answer', 'question_page');

        );

        Post as a guest






























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        14
        down vote













        As far as I know, this is not possible as Firefox does not accept commands to control the window. That's also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that's going to be a little bit difficult:



        #!/bin/sh

        firefox -new-instance -new-window "http://www.reddit.org" &

        # Process ID of the process we just launched
        PID=$!

        # Window ID of the process...pray that there's
        # only one window! Otherwise this might break.
        # We also need to wait for the process to spawn
        # a window.
        while [ "$WID" == "" ]; do
        WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
        done
        # Set the size and location of the window
        # See man wmctrl for more info
        wmctrl -i -r $WID -e 0,50,50,250,250


        There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.






        share|improve this answer






















        • Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
          – ka3ak
          May 30 at 7:13















        up vote
        14
        down vote













        As far as I know, this is not possible as Firefox does not accept commands to control the window. That's also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that's going to be a little bit difficult:



        #!/bin/sh

        firefox -new-instance -new-window "http://www.reddit.org" &

        # Process ID of the process we just launched
        PID=$!

        # Window ID of the process...pray that there's
        # only one window! Otherwise this might break.
        # We also need to wait for the process to spawn
        # a window.
        while [ "$WID" == "" ]; do
        WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
        done
        # Set the size and location of the window
        # See man wmctrl for more info
        wmctrl -i -r $WID -e 0,50,50,250,250


        There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.






        share|improve this answer






















        • Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
          – ka3ak
          May 30 at 7:13













        up vote
        14
        down vote










        up vote
        14
        down vote









        As far as I know, this is not possible as Firefox does not accept commands to control the window. That's also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that's going to be a little bit difficult:



        #!/bin/sh

        firefox -new-instance -new-window "http://www.reddit.org" &

        # Process ID of the process we just launched
        PID=$!

        # Window ID of the process...pray that there's
        # only one window! Otherwise this might break.
        # We also need to wait for the process to spawn
        # a window.
        while [ "$WID" == "" ]; do
        WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
        done
        # Set the size and location of the window
        # See man wmctrl for more info
        wmctrl -i -r $WID -e 0,50,50,250,250


        There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.






        share|improve this answer














        As far as I know, this is not possible as Firefox does not accept commands to control the window. That's also (mostly) the responsibility of the window manager, so I doubt that there ever will be parameters to do that. However, you can control the window with wmctrl, but that's going to be a little bit difficult:



        #!/bin/sh

        firefox -new-instance -new-window "http://www.reddit.org" &

        # Process ID of the process we just launched
        PID=$!

        # Window ID of the process...pray that there's
        # only one window! Otherwise this might break.
        # We also need to wait for the process to spawn
        # a window.
        while [ "$WID" == "" ]; do
        WID=$(wmctrl -lp | grep $PID | cut "-d " -f1)
        done
        # Set the size and location of the window
        # See man wmctrl for more info
        wmctrl -i -r $WID -e 0,50,50,250,250


        There might be more clever ways to do it, and there are some interoperability issues with Firefox (e.g. that no other instance is running) but it should get you going.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 31 '16 at 9:23









        Martin Vseticka

        1094




        1094










        answered Oct 14 '12 at 10:31









        Bobby

        693513




        693513











        • Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
          – ka3ak
          May 30 at 7:13

















        • Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
          – ka3ak
          May 30 at 7:13
















        Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
        – ka3ak
        May 30 at 7:13





        Just a little note. The resizing won't work if the window is maximized. So you have to deactivate this property first with: wmctrl -i -r $WID -b remove,maximized_vert; wmctrl -i -r $WID -b remove,maximized_horz; After that I was able to resize the Firefox window.
        – ka3ak
        May 30 at 7:13













        up vote
        11
        down vote













        Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.




        You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash, using xdotool, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.




        1. Find the window ID:



          xdotool search --onlyvisible --name firefox



        2. Set the window size



          xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT



        3. Move the window



          xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y


        For example, if the window id for firefox is 123 you would do this:



        xdotool windowsize 123 800 600
        xdotool windowmove 123 0 1080


        The bottom-left positioning will have to be figured out based on your screen resolution.






        share|improve this answer






















        • There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
          – ThePhi
          Apr 25 at 12:33














        up vote
        11
        down vote













        Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.




        You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash, using xdotool, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.




        1. Find the window ID:



          xdotool search --onlyvisible --name firefox



        2. Set the window size



          xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT



        3. Move the window



          xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y


        For example, if the window id for firefox is 123 you would do this:



        xdotool windowsize 123 800 600
        xdotool windowmove 123 0 1080


        The bottom-left positioning will have to be figured out based on your screen resolution.






        share|improve this answer






















        • There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
          – ThePhi
          Apr 25 at 12:33












        up vote
        11
        down vote










        up vote
        11
        down vote









        Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.




        You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash, using xdotool, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.




        1. Find the window ID:



          xdotool search --onlyvisible --name firefox



        2. Set the window size



          xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT



        3. Move the window



          xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y


        For example, if the window id for firefox is 123 you would do this:



        xdotool windowsize 123 800 600
        xdotool windowmove 123 0 1080


        The bottom-left positioning will have to be figured out based on your screen resolution.






        share|improve this answer














        Here is a community version of the answer by Yokai that incorporates examples offered by Rudolf Olah.




        You can use the tool called xdotool to control window size and location. Not only that, any script you write in bash, using xdotool, can be setup to work with a fully maximized window and it can be scripted to set the window size and x:y coordinates by manipulating the mousemove and click commands.




        1. Find the window ID:



          xdotool search --onlyvisible --name firefox



        2. Set the window size



          xdotool windowsize $WINDOW_ID_GOES_HERE $WIDTH $HEIGHT



        3. Move the window



          xdotool windowmove $WINDOW_ID_GOES_HERE $X $Y


        For example, if the window id for firefox is 123 you would do this:



        xdotool windowsize 123 800 600
        xdotool windowmove 123 0 1080


        The bottom-left positioning will have to be figured out based on your screen resolution.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 24 '17 at 15:53


























        community wiki





        4 revs, 4 users 48%
        roaima












        • There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
          – ThePhi
          Apr 25 at 12:33
















        • There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
          – ThePhi
          Apr 25 at 12:33















        There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
        – ThePhi
        Apr 25 at 12:33




        There's a bug with xdotool, wmctrl etc.. and Ubuntu, XFCE (that I have): if the window has already launched in full screen mode, you can't move it anymore: bugs.launchpad.net/ubuntu/+source/unity/+bug/971147
        – ThePhi
        Apr 25 at 12:33










        up vote
        3
        down vote













        In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It's a stupid hack but, hey, it works.






        share|improve this answer




















        • Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
          – hugomg
          Nov 18 '14 at 18:06














        up vote
        3
        down vote













        In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It's a stupid hack but, hey, it works.






        share|improve this answer




















        • Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
          – hugomg
          Nov 18 '14 at 18:06












        up vote
        3
        down vote










        up vote
        3
        down vote









        In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It's a stupid hack but, hey, it works.






        share|improve this answer












        In the past I have created an HTML document that would set the window size with Javascript then redirect to the page I wanted. It's a stupid hack but, hey, it works.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Aug 15 '12 at 0:18









        bahamat

        23.7k14590




        23.7k14590











        • Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
          – hugomg
          Nov 18 '14 at 18:06
















        • Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
          – hugomg
          Nov 18 '14 at 18:06















        Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
        – hugomg
        Nov 18 '14 at 18:06




        Looks like this doesn't work anymore. Apparently, window.resizeTo only has an effect if the window is a popup created via window.open.
        – hugomg
        Nov 18 '14 at 18:06










        up vote
        2
        down vote













        I don't think this is possible by shell commands only, cause it has nothing to do with your windowmanager.

        I heard of wmctrl and devilspie which can effect this. But I doubt there is a way to achieve that as simple as you wrote in your example.






        share|improve this answer
























          up vote
          2
          down vote













          I don't think this is possible by shell commands only, cause it has nothing to do with your windowmanager.

          I heard of wmctrl and devilspie which can effect this. But I doubt there is a way to achieve that as simple as you wrote in your example.






          share|improve this answer






















            up vote
            2
            down vote










            up vote
            2
            down vote









            I don't think this is possible by shell commands only, cause it has nothing to do with your windowmanager.

            I heard of wmctrl and devilspie which can effect this. But I doubt there is a way to achieve that as simple as you wrote in your example.






            share|improve this answer












            I don't think this is possible by shell commands only, cause it has nothing to do with your windowmanager.

            I heard of wmctrl and devilspie which can effect this. But I doubt there is a way to achieve that as simple as you wrote in your example.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 15 '12 at 22:19









            32bitfloat

            1544




            1544




















                up vote
                1
                down vote













                I do this all the time. I use DevilsPie2, however, because it's more robust. It uses the LUA scripting language, which isn't very difficult.



                Here's my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:



                if (get_window_name()=="Mozilla Thunderbird") then
                pin_window()
                set_window_geometry( 50, 10, 1220, 780 )
                end

                where 50 = X coordinate (for upper-left corner of the window)
                10 = Y coordinate ( " " )
                1220 = window width
                780 = window height


                To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2



                For Thunderbird, I created thunderbird.lua, though the filename doesn't matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop



                Here's a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README



                One note: The scripts don't have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.






                share|improve this answer
























                  up vote
                  1
                  down vote













                  I do this all the time. I use DevilsPie2, however, because it's more robust. It uses the LUA scripting language, which isn't very difficult.



                  Here's my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:



                  if (get_window_name()=="Mozilla Thunderbird") then
                  pin_window()
                  set_window_geometry( 50, 10, 1220, 780 )
                  end

                  where 50 = X coordinate (for upper-left corner of the window)
                  10 = Y coordinate ( " " )
                  1220 = window width
                  780 = window height


                  To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2



                  For Thunderbird, I created thunderbird.lua, though the filename doesn't matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop



                  Here's a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README



                  One note: The scripts don't have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.






                  share|improve this answer






















                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I do this all the time. I use DevilsPie2, however, because it's more robust. It uses the LUA scripting language, which isn't very difficult.



                    Here's my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:



                    if (get_window_name()=="Mozilla Thunderbird") then
                    pin_window()
                    set_window_geometry( 50, 10, 1220, 780 )
                    end

                    where 50 = X coordinate (for upper-left corner of the window)
                    10 = Y coordinate ( " " )
                    1220 = window width
                    780 = window height


                    To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2



                    For Thunderbird, I created thunderbird.lua, though the filename doesn't matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop



                    Here's a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README



                    One note: The scripts don't have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.






                    share|improve this answer












                    I do this all the time. I use DevilsPie2, however, because it's more robust. It uses the LUA scripting language, which isn't very difficult.



                    Here's my lua script for Thunderbird, which I want to open on the far left monitor (laptop screen) when it opens:



                    if (get_window_name()=="Mozilla Thunderbird") then
                    pin_window()
                    set_window_geometry( 50, 10, 1220, 780 )
                    end

                    where 50 = X coordinate (for upper-left corner of the window)
                    10 = Y coordinate ( " " )
                    1220 = window width
                    780 = window height


                    To set this up, you create a directory in your home configuration (on Ubuntu-like distributions) named devilspie2, eg /home/$USERNAME/.config/devilspie2



                    For Thunderbird, I created thunderbird.lua, though the filename doesn't matter. I have a different filename for each application though you can put everything into one script file if you wish. Set devilspie2 to start automatically when you login, eg /home/$USERNAME/.config/autostart/devilspie2.desktop



                    Here's a link to a good page about various options available to your lua script: https://github.com/gusnan/devilspie2/blob/master/README



                    One note: The scripts don't have to be executable. Mine are 664 and work fine. A few of the other programs I control are openconnect, pidgin, RecordMyDesktop, timeshift, xeyes, xload, & yad. I use pin_window on them so they appear on all desktops, plus other commands depending on the application.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered May 15 at 15:51









                    Karl Pearson

                    111




                    111




















                        up vote
                        0
                        down vote













                        This doesn't solve the problem of the position, but at least you can set dimensions :



                        firefox -width 200 -height 500




                        share
























                          up vote
                          0
                          down vote













                          This doesn't solve the problem of the position, but at least you can set dimensions :



                          firefox -width 200 -height 500




                          share






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            This doesn't solve the problem of the position, but at least you can set dimensions :



                            firefox -width 200 -height 500




                            share












                            This doesn't solve the problem of the position, but at least you can set dimensions :



                            firefox -width 200 -height 500





                            share











                            share


                            share










                            answered 6 mins ago









                            sebpiq

                            1084




                            1084



























                                 

                                draft saved


                                draft discarded















































                                 


                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function ()
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f43106%2fhow-to-set-window-size-and-location-of-an-application-on-screen-via-command-line%23new-answer', 'question_page');

                                );

                                Post as a guest













































































                                Popular posts from this blog

                                How to check contact read email or not when send email to Individual?

                                Bahrain

                                Postfix configuration issue with fips on centos 7; mailgun relay