Move A Window That Is Outside The Screen

From Birnam Designs Wiki

Jump to: navigation, search

One of my apps somehow managed to find itself off the edge of my screen -- at 4520,0. (My dual screen setup has a resolution of 3920x1600) It was a small Adobe AIR app that displayed weather information in a widget-type window. It used an icon in the system tray but wasn't in the taskbar, so I couldn't right-click and select "Move". Also the app doesn't have a 'minimize' option, so, seeing the icon in the system tray meant the application was running and should have been visible -- but it wasn't!

To fix the problem, I used wmctrl On my Kubuntu system, this utility was installed with:

sudo apt-get install wmctrl

I imagine that other systems will have their own yum/zipper/emerge/etc. variation.

You can generate a window list that displays window geometry like this:

david@BIRNAM:~$ wmctrl -lG
0x02e0003e  0 4520 480  200  100  BIRNAM AccuWeather.com Stratus
0x04a00001  0 2    100  337  726  BIRNAM Conky (BIRNAM)
0x06600021  0 3624 600  1267 898  BIRNAM Editing Move A Window That Is Outside The Screen - BDWiki - Chromium
0x03e004e5  0 320  100  1280 575  BIRNAM Yakuake
david@BIRNAM:~$

The list output breaks down as:

[windowID] [gravity] [X] [Y] [Width] [Height] [System] [Window Title]

Gravity refers to docking behavior, the default value is 0, which means "place at the reference point." Read more about gravity in the EWMH spec.

The AccuWeather.com Stratus application is the one causing trouble. You can see the X position is outside my screen dimensions.

You can then use the same wmctrl utility to move the window.

david@BIRNAM:~$ wmctrl -r Stratus -e "0,800,480,200,100"

The -r value selects the window to operate on. It looks for the first window whose title contains the value as a substring. (normally case insensitive, but a -F flag can make it case sensitive) The -e value is a string formatted as:

"[gravity],[X],[Y],[Width],[Height]"

Run that, and viola! The window is moved!

Share This!
This page was last modified on 11 February 2010, at 20:02. This page has been accessed 423 times.