1

I want to open an instance of Chromium at a specific location on the screen and at a specific size (width and height). I figured this would be pretty straightforward but in all my searching I am just not finding anything. Is this doable?

2
  • you could do it with xdotool.
    – john-jones
    Commented Apr 1 at 14:44
  • The API calls to position a window do exist, so it's not impossible, but if that was the route, some coding would be needed.
    – KDM
    Commented Apr 11 at 8:25

1 Answer 1

0

There is a Linux tool called devilspie2 that does what you want. It seems to be in the Raspberry PI OS distribution.

Install it with

sudo apt-get install devilspie2

The first time you run it, it won't seem to do anything, but it will create a configuration directory under your home directory called .config/devilspie2/ Create a file there called apps.lua. Edit this file and add lines similar to:

if string.match(get_window_name(), "Chromium")
then
   set_window_geometry(140,32,878, 950);
end

The first line mentions the window title, adjust this as necessary. The numbers in the set_window_geometry() line are the desired size and position of the Chromium window:

The x co-ordinate of the top left corner of the window

The y co-ordinate of the top left corner of the window

The width of the window

The height of the window

(All in pixels)

There is an X windows tool called xwininfo that helps find these data. Start Chromium, manually set it as you want, then start xwininfo. It will prompt you to click on a window. Click on the Chromium window. Copy the relevant data from the xwininfo output into the script fragment above.

devilspie2 Should configure itself to run automatically. When it is running and you start Chromium, Chromium should immediately be resized and repositioned.

You can read a useful tutorial to devilspie2 at https://www.linux-magazine.com/Issues/2017/205/Tutorial-Devilspie2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.