[openbox] Launching applications

Anthony Thyssen A.Thyssen at griffith.edu.au
Wed Oct 5 19:39:46 EDT 2011


On Wed, 5 Oct 2011 15:25:51 -0700
Brian Mattern <rephorm at rephorm.com> wrote:
| On Mon, 03 Oct 2011, Anthony Thyssen wrote:
| 
| > Now to see if a "mutt terminal window" is present do any of these...
| > 
| >    xwininfo -root -all | grep '"mutt"'
| >    xwininfo -root -tree | awk '/"mutt"/ {print; exit}'
| >    xwit -names mutt -print
| >    xdotool search -limit 1 --classname mutt  getwindowgeometry -shell
| >    wmctrl -l | awk '$4 == "mutt"'
| >    xlsclients -l | grep " -name mutt "
| > 
| 
| If anyone is interested, I've added a "--iconname" option to xdotool.
| The patch[1] applies to xdotool-2.20110530.1 (latest version).
| The motivation for adding this is below.
| 
| [1] http://rephorm.com/files/patches/xdotool_add-option-to-search-iconname.patch
| 
| I have zsh set my terminal window title to the last run command. This increases the likelihood of having windows that aren't mutt, but have the term 'mutt' in the title. So, I decided to use `urxvt -n muttTerminal -e mutt`. In this case, I get window with the title 'mutt', but with the WM_ICON_NAME set to 'muttTerminal'. I can then match on that in my 'launch_mail' script:
| 
| xdotool search --iconname muttTerminal set_desktop_for_window `xdotool \
|   get_desktop` windowraise windowactivate || urxvt -n muttTerminal -e mutt 
| 
| Note that this pulls the open mutt instance to the current desktop,
| raises it and then activates it. Thanks to everyone for the ideas on how
| to implement this (which I had been meaning to do for some time to avoid
| having an open mutt on every virtual desktop...).
| 
That makes four window properties...

                      X Command Argument             xdotool search arg
   Class               (not settable)                   --class
   Class Instance      -name                            --classname
   Window Title        -title                           --name
   Icon Title          -n                               --iconname

Note that class and class instance that share the same property.
but all are completely separate identification methods.  Setting one
does not typically set another.

Note the title gets stored in the property  WM_NAME (window name, not
Class instance name) which is why the two sets of argument do not
match up (causing some confusion).

On top of this you also have other properties such as
  WM_COMMAND   _OB_APP_NAME  _OB_APP_CLASS  
Though you may not be able to rely on these for all client programs
or all window managers.


Actually I can find any method of searching for a window with a specific
property value!

Brian that may be something to add to xdotool :-)



  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 --------------------------------------------------------------------------
  "You know, just once I'd like to meet an alien menace
        that wasn't immune to bullets.    -- Brigadier, Doctor Who, "Robot"
 --------------------------------------------------------------------------
   Anthony's Castle     http://www.ict.griffith.edu.au/anthony/


More information about the openbox mailing list