4

I am running Linux Mint 13, with a KDE 4 desktop manager. I would like to launch applications from a terminal (konsole in my specific case) and setting the exact size of the window and the location of the window. As an example, if I launch Kate and Chromium from a terminal, I want Kate's window the cover the left-half of my screen and I want Chromium to cover the upper-right quarter of my screen.

How can I accomplish this?

ps: I have a 15.6" screen set to a 1920x1080 resolution.

5
  • 2
    For some applications: you may use -geometry WIDTHxHEIGHT+X+Y Commented Oct 8, 2013 at 16:15
  • 1
    This link explains the comment above but only some applications accept -geometry. Also, some apps don't use pixels but columns and rows. Commented Oct 8, 2013 at 16:20
  • 1
    If -geometry isn't giving you the result you want, try wmctrl. chromium && wmctrl -r chomium -e 'g,x,y,w,h' You might need a sleep delay before wmctrl. Its a bit more complicated to figure out which chromium window to control when you have multiple open. Commented Oct 8, 2013 at 18:26
  • With -geometry you can also leave off width and height. You can also use negative numbers to offset from the right-hand and bottom edges of the screen. Commented Oct 8, 2013 at 22:14
  • Maybe I am using it wrong but wmctrl did not work for me. I will play around with it some more in the weekend. Commented Oct 10, 2013 at 11:45

2 Answers 2

4

If you don't want to specify the geometry/position during startup, but permanently, simple use Kwin's rule system:

  • Launch the desired application
  • Right-click on the title-bar or use Alt+F3
  • More Actions
  • Special Window Settings
  • Tab: Window matching
    • Check, whether the values were detected correctly, otherwise use the Detect Windows Properties button to capture the data of the target window
  • Tab: "Size & Position"
    • Enable the checkboxes of Position and Size
    • Select, when to apply the Position/Size (Apply Initially, Force, etc.)
    • Set the value for Position and/or Size

You can do way more than just this using the window rules, see also: Screenshot of window specific settings in kwin.

1
  • I managed to get this working with some programs, however some others have quite random behaviour. Some times it works some times it doesn't. Commented Oct 10, 2013 at 11:44
3

Run xwinifo and click on the window of the application you want to start.

Note down the line at the bottom

-geometry WxH+X+Y

where W, H are the width and Height, X, Y are the coordinates of the start of the window.

Then try starting the application with that as a command arguements e.g. for Konsole:

konsole -geometry WxH+X+Y

It should end up reasonably close to where you want. My Y coordinate was about 22 pixels too low - but it gives you something to work with. Perhaps the header of the application (decoration?) is not counted properly?

Anyway do this for all windows you want. Put into a shell script and you can run that to start them all up. e.g.

#! /bin/sh

konsole -geometry WxH+X+Y &
konsole -geometry WxH+X+Y &
konsole -geometry WxH+X+Y &

Where the exact values for W/H/X/Y are obtained from the wininfo command.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.