Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: James Waldby Newsgroups: alt.os.linux.mandrake,comp.os.linux.development.apps Subject: Re: HOW2 find Desktop,VT corresponding to pid. Date: Thu, 28 Apr 2011 14:06:07 +0000 (UTC) Organization: A noiseless patient Spider Lines: 43 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 28 Apr 2011 14:06:07 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="ykbLuRqdoTlroYrIibPcFA"; logging-data="25212"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19fN+zdHfk1qc8PvpK5BYCd" User-Agent: Pan/0.133 (House of Butterflies) Cancel-Lock: sha1:5M7YgTkxMaZipTgb85dVuQKGok8= Xref: x330-a1.tempe.blueboxinc.net comp.os.linux.development.apps:101 On Sun, 24 Apr 2011 11:27:55 +0000, no.top.post wrote: > I need to have a table: > mapping the (Desktop,VT): pair having mc open, to it's path. So: 4,3 > /mnt/p6/Debug/dog > means that whe 'data arrives for /mnt/p6/Debug/dog', I need to switch to > Desktop:4, VT:3. > > Previously I wrote a utility which gets all mc paths from `lsof | grep > mc`, with the corresponding pid/S; and 'examines the graph drawn' by > `pstree -p`; and from the position of the 'mc branch' in `pstree -p` > could determine the D,V: pair, having the pid corresponding to the path. > So via 2 stages, I could map the path to the D,V. > > That worked OK for Mandrake 9. > For FC1 it failed, because [...] > Now I've got Slak13, and the `pstree -p`representation is completely > different, so that I can't see the D,V corresponding to the pid [so > far].[...] > OTOH, the system must know 'which file is open in any D,V'. > I've browsed around /proc, but I can't see how to solve this. Likewise - In a brief look on linux 2.6.35.12-88.fc14 system, I don't see any window info in process's /proc subdirectory. > Since D & V are 'attributes' of the window manager, probably this is a > wm problem. > The method that I eventually got working nicely, was under KDE3, but now > I want to use Xfce. > > == TIA. > -> try: lsof | grep > --> lsof | cut -c11-14 == shows the list of pid for -> > lsof | grep Maybe try wmctrl -lp | grep $pid to get the window id for a given pid, and perhaps wmctrl -a $windowid to give the window the focus. The wmctrl manpage says it's Xfce compatible and also suggests zenity "for building scripts with wmctrl" -- jiw