Saturday, May 29, 2010

How to get the window ID (Xwindows)

Here is how you can the the x windows id:

$ xwininfo

Now click on the window you would like to get the id, eg. Firefox. You will get some results like this:

$ xwininfo

xwininfo: Please select the window about which you
          would like information by clicking the
          mouse in that window.

xwininfo: Window id: 0x28000c8 "Getting window id for certain process id (for sharing theapplication) - Unix Linux Forum - - Mozilla Firefox"

  Absolute upper-left X:  107
  Absolute upper-left Y:  102
  Relative upper-left X:  0
  Relative upper-left Y:  0
  Width: 847
  Height: 627
  Depth: 24
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0x20 (installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +107+102  -326+102  -326-295  +107-295
  -geometry 847x627+104+78

Here, the window id of Firefox is 0x28000c8.

Now you'll ask yourself why on earth would I need the window id. This is useful for example if you want to record a video with recordMyDesktop which takes the window id as an argument like this:

$ recordmydesktop -windowid 0x28000c8

1 comment:

  1. I wanted to record a video with recordMyDesktop so I needed to know how to get window id.Thanks your blog saved me a lot of time as it provide all the steps which are easy to follow.
    e signatures