the way to check whether any AW is running on the given X display


Subject: the way to check whether any AW is running on the given X display
From: Vlad Harchev (hvv@hippo.ru)
Date: Fri Dec 29 2000 - 07:43:13 CST


Background:

 There is a 'xlsclients' utility that is included in the X distribution from
x.org - i.e. the chances that it's installed on computer with X on it are
very high (or we can ship it - it's very small). It lists all clients
connected to the given X server, even remote ones. For example, on my box
running 'xlsclients -la' prints

Window 0xc00001:
  Machine: h
  Command: /usr/bin/gnome-session
  Instance/Class: gnome-session/Gnome-session
Window 0x1c00001:
  Machine: h
  Command: panel
  Instance/Class: panel/Panel
Window 0x2c00001:
  Machine: h
  Command: gmc
  Instance/Class: gmc/Gmc
Window 0x1400001:
  Machine: h
  Command: gnomepager_applet
  Instance/Class: gnomepager_applet/Gnomepager_applet
Window 0x3000001:
  Machine: h
  Command: quicklaunch_applet
  Instance/Class: quicklaunch_applet/Quicklaunch_applet
Window 0x3400001:
  Machine: h
  Command: gnome-help-browser
  Instance/Class: gnome-help-browser/Gnome-help-browser

 The instance/class of any gtk-based application could be set with the
following additional arguments:
        "--name 'TheName' --class 'TheClassname'"

 So, algorithm:
 We modify makewrapper.sh and all scripts that generate AbiWord script to add
the following command line options to AW:
        --name abiword --class Abiword

 Then we check whether AW is running after AbiWord_[ds] process is finished by
using:
        xlsclients -l | grep -F "Instance/Class: abiword/Abiword"
 The return status is 0 if there are any instances of AW running on the X
display AW was started at.

 This will work fine if there are no AWs started using non-upgraded AbiWord
script (i.e. by script that doesn't add "--name abiword --class Abiword" to
the commandline). We can be nice and support this case - we will have to
grep for the following additional things:
        "Instance/Class: AbiWord_d/AbiWord_d"
        "Instance/Class: AbiWord_s/AbiWord_s"

 If xlsclients is not installed, we should assume that either no AWs is
started or provide URL of where sources of it could be acquired from.

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Fri Dec 29 2000 - 08:29:33 CST