| Unix Content | Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| Is there a shell tool (xwininfo, xprop, etc) way to get the X WindowID for a window based on a partial match? xwininfo can do it, but you have to pass it the entire name. Quite often, it is inconvenient and/or you may not know it. |
|
#2
|
| On 2008-10-06, Kenny McCormack > Is there a shell tool (xwininfo, xprop, etc) way to get the X WindowID > for a window based on a partial match? xwininfo can do it, but you have > to pass it the entire name. Quite often, it is inconvenient and/or you > may not know it. I forget which, but either xwininfo or xprop will give you the window ID in hex. I used that the other day for some screen captures. -- Robert Riches spamtrap42@verizon.net (Yes, that is one of my email addresses.) |
|
#3
|
| In article Robert Riches >On 2008-10-06, Kenny McCormack >> Is there a shell tool (xwininfo, xprop, etc) way to get the X WindowID >> for a window based on a partial match? xwininfo can do it, but you have >> to pass it the entire name. Quite often, it is inconvenient and/or you >> may not know it. > >I forget which, but either xwininfo or xprop will give you >the window ID in hex. I used that the other day for some >screen captures. Yes, but only if given the full window name. Suppose I have a window called: Very long name, version x.y.z on 10/6/08 I can use xwininfo to get the ID for that window, but only if I write out the whole name. It should be clear why that is not feasible. I'd like to be able to just say "Very long name" (initial part of the title). |
|
#4
|
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kenny McCormack writes: [...] > Yes, but only if given the full window name. > Suppose I have a window called: > Very long name, version x.y.z on 10/6/08 > I can use xwininfo to get the ID for that window, but only if I write > out the whole name. It should be clear why that is not feasible. > I'd like to be able to just say "Very long name" (initial part of the > title). % xlsclients -a -l |awk '/^Window/ { if(gsub(":","", $2)) \ printf("%s ", $2); } /^[[:space:]]*Name:/ { print($2); }' 0x1000001 emacs 0x1606daf urxvt 0x1600009 0x160c124 urxvt Ashish - -- () ascii ribbon campaign - against HTML e-mail /\ www.asciiribbon.org - against proprietary attachments ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkjrTtsACgkQHy+EEHYuXnSSfACfZAI8x9ejYw Y/1bo2O1PGCQPK va8An31Xbybh/6a01J1zAbxh+5pOdUHC =TmA0 -----END PGP SIGNATURE----- |
|
#5
|
| In article <874p3ok46f.fsf@chateau.d.lf>, Ashish Shukla ठशॠष श ॠठॠल .... >> I can use xwininfo to get the ID for that window, but only if I write >> out the whole name. It should be clear why that is not feasible. >> I'd like to be able to just say "Very long name" (initial part of the >> title). > >% xlsclients -a -l |awk '/^Window/ { if(gsub(":","", $2)) \ > printf("%s ", $2); } /^[[:space:]]*Name:/ { print($2); }' >0x1000001 emacs >0x1606daf urxvt >0x1600009 >0x160c124 urxvt Yes. xlsclients looks very useful. One to add to the list... A bit of background: Even though I've been using Unix and X for decades (literally), I've never, until very recently, had the need to do "UI automation" in the Unix/X context. Hence, all these questions. It seems there's no single unified approach and no good way to find the names of all these little tools. |
|
#6
|
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kenny McCormack writes: [...] > A bit of background: Even though I've been using Unix and X for decades > (literally), I've never, until very recently, had the need to do "UI > automation" in the Unix/X context. Hence, all these questions. It > seems there's no single unified approach and no good way to find the > names of all these little tools. Back in the days, when X used to be monolithic, 'rpm -ql |fgrep bin' seems to do the job. Anyways most of these tools have their names starting with 'x'. Checking out following will also be helpful: http://xorg.freedesktop.org/releases/current/src/app/ Ashish - -- () ascii ribbon campaign - against HTML e-mail /\ www.asciiribbon.org - against proprietary attachments ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkjralkACgkQHy+EEHYuXnTBLQCg70giEVrY/13Ca5+AN7v7QqjQ z9YAnAry2i+oZVA4PXGjrq7CwtJo+b6y =rdMf -----END PGP SIGNATURE----- |
|
#7
|
| In article <87ej2sik6h.fsf@chateau.d.lf>, Ashish Shukla > >[...] > >> A bit of background: Even though I've been using Unix and X for decades >> (literally), I've never, until very recently, had the need to do "UI >> automation" in the Unix/X context. Hence, all these questions. It >> seems there's no single unified approach and no good way to find the >> names of all these little tools. Actually, I spoke too soon. xlsclients doesn't display information for all open windows (and, of course, skips the one I am interested in). Do you know why this is? >Back in the days, when X used to be monolithic, 'rpm -ql >|fgrep bin' seems to do the job. Anyways most of these tools have their >names starting with 'x'. Checking out following will also be helpful: > Knowing the names isn't the hard part. Knowing what they do is... |
|
#8
|
| -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Kenny McCormack writes: > In article <87ej2sik6h.fsf@chateau.d.lf>, > Ashish Shukla [...] > Actually, I spoke too soon. xlsclients doesn't display information for > all open windows (and, of course, skips the one I am interested in). > Do you know why this is? Hmm...? On my box it works fine ? No ideas, why it fails on your box. May be it is only meant to show clients connected, not windows. Try following command, may be that'll help: % xwininfo -children -root >> Back in the days, when X used to be monolithic, 'rpm -ql >> |fgrep bin' seems to do the job. Anyways most of these tools have their >> names starting with 'x'. Checking out following will also be helpful: >> > Knowing the names isn't the hard part. Knowing what they do is... RTFM Ashish - -- () ascii ribbon campaign - against HTML e-mail /\ www.asciiribbon.org - against proprietary attachments ·-- ·- ···· ·--- ·- ···- ·- ·--·-· --· -- ·- ·· ·-·· ·-·-·- -·-· --- -- -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEARECAAYFAkjrty8ACgkQHy+EEHYuXnTRcwCfSbkJ2udf7v eIJQsfEaD9RdC1 WZkAn0GZVogaHW3ft97WJgDqpLHytoz2 =G4wE -----END PGP SIGNATURE----- |
|
#9
|
| On 2008-10-07, Kenny McCormack > In article > Robert Riches >>On 2008-10-06, Kenny McCormack >>> Is there a shell tool (xwininfo, xprop, etc) way to get the X WindowID >>> for a window based on a partial match? xwininfo can do it, but you have >>> to pass it the entire name. Quite often, it is inconvenient and/or you >>> may not know it. >> >>I forget which, but either xwininfo or xprop will give you >>the window ID in hex. I used that the other day for some >>screen captures. > > Yes, but only if given the full window name. > > Suppose I have a window called: > > Very long name, version x.y.z on 10/6/08 > > I can use xwininfo to get the ID for that window, but only if I write > out the whole name. It should be clear why that is not feasible. > I'd like to be able to just say "Very long name" (initial part of the > title). Can you click on the window or not? If you can, one of the two, xwininfo and xprop, will give you the ID in hexadecimal. Or, is your question asking how to do an approximate string match? -- Robert Riches spamtrap42@verizon.net (Yes, that is one of my email addresses.) |
|
#10
|
| In article Robert Riches .... >Can you click on the window or not? If you can, one of the >two, xwininfo and xprop, will give you the ID in >hexadecimal. Yes, I know that xwininfo allows you to select the window by clicking on it - and that is what I am currently doing in my script. The point was to try to avoid having to do that - that is, make the process not require manual intervention. Note also that one problem with the "click on the window to choose it" method is that the window in question has to be visible. Sometimes, I find that the window I want is covered up, and, of course, you only get one click! >Or, is your question asking how to do an approximate string >match? Not really "approximate", but rather "initial part of". Note, incidentally, that a year or so ago, I asked here about a way to "raise" a window, and you contributed a C program that walks the window tree and finds windows matching a name. I modified that program to match window names on initial string and I still use it (it is called "xraise"). That program *could* be a solution to the instant problem; the only reason I'm not happy with that is that it doesn't seem to actually "raise" the window anymore (see other thread). |
|
#11
|
| On 2008-10-08, Kenny McCormack > In article > Robert Riches > ... >>Can you click on the window or not? If you can, one of the >>two, xwininfo and xprop, will give you the ID in >>hexadecimal. > > Yes, I know that xwininfo allows you to select the window by clicking on > it - and that is what I am currently doing in my script. The point was > to try to avoid having to do that - that is, make the process not > require manual intervention. Note also that one problem with the "click > on the window to choose it" method is that the window in question has to > be visible. Sometimes, I find that the window I want is covered up, > and, of course, you only get one click! > >>Or, is your question asking how to do an approximate string >>match? > > Not really "approximate", but rather "initial part of". > > Note, incidentally, that a year or so ago, I asked here about a way to > "raise" a window, and you contributed a C program that walks the window > tree and finds windows matching a name. I modified that program to > match window names on initial string and I still use it (it is called > "xraise"). That program *could* be a solution to the instant problem; the > only reason I'm not happy with that is that it doesn't seem to actually > "raise" the window anymore (see other thread). It sounds like there are two problems here: A partial (initial) string match. That should be easy for you to code once you nail down your requirements. I think I saw that thread but didn't pay attention. I'm sorry I can't afford the time to help with that issue. -- Robert Riches spamtrap42@verizon.net (Yes, that is one of my email addresses.) |