How to list current opened ROX windows? (Solved)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

How to list current opened ROX windows? (Solved)

#1 Post by Argolance »

Bonjour,
All is the title!
[EDIT]: I would like my script to list all current opened ROX windows (if exist), keep this list inside a temporary file, close these windows...

Code: Select all

rox -D /
... then restore the windows when script has finished working.

Thank you for your attention.

Cordialement.
Last edited by Argolance on Tue 25 Feb 2014, 10:51, edited 1 time in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello, argolance.

You could install wmctrl (from http://tomas.styblo.name/wmctrl/) and try
the one-liner example below! ;)

It's only a sketch, but it should work on your set-up also. In a script, you'd
probably want to rework the repetitive parts with a loop using the "wmctrl.lst" file.

Code: Select all

rox ~ / /usr;sleep 5;echo;wmctrl -l | awk '$4 ~ /\/|\~/ { print $4 }' > wmctrl.lst;wmctrl -c "usr";wmctrl -c "/ +T";wmctrl -c "~ +T";sleep 5;rox / ~ /usr;echo;echo "That's how it's done. :-)";echo
(Good luck!)

Otherwise, I know of

Code: Select all

ps | grep ROX | grep -v grep
but it lists ROX-Filer only once, no matter how many ROX windows are open.

Have you tried anything else?

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#3 Post by amigo »

Took awhile to find anything useful:
xwininfo -tree -root |less
or:
xwininfo -tree -root |grep ROX

or maybe:
xprop -root |grep ^_NET_CLIENT_LIST

Have fun parsing the output!

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#4 Post by Argolance »

Bonsoir,
Thank you a lot guys!

Sorry, I should have say that I only intend to get ROX filer opened directories windows list. That is to say: User runs my script. Assuming he has previously opened, for example, /root/, /etc, /root/my-documents/my-pictures directories for any reason, this is the list of these directories, opened with ROX, I would like to get, in order to close them firstly, then open them again when user quits the script/application.

Cordialement.

some1
Posts: 117
Joined: Thu 17 Jan 2013, 11:07

#5 Post by some1 »

Hi
Sorry, I should have say....
I guess Amigo and Musher0 have done the groundwork for what you want :D

Some awk -as it came to mind - a piped one-liner ::

Code: Select all

xwininfo -root -tree| 
awk -F'"' '(($2 ~ /^[\/\~]/) && ($4 ~ "ROX-Filer") && ($6 ~ "ROX-Filer")){print $2}'| 
awk '{sub(/~/,"/root")}; 1'| 
awk '{sub(/ \(/,"|")}; 1'| 
awk -F'|' '{print $1}' >mywins
]
1. get xwininfo for all windows
2. grep for wanted windows:
i) shall have patk starting with / OR ~
ii) $4 SHALL be ROX-Filer, perhaps the query of $6 is not needed
3. rox do not know ~,so replace with /root
4 rox adds suffixes (All).(Thumdnails) etc -possibly localized
so a two-step process to get rid of the cruft:
i) replace ' (' with |
ii) we drop '|' and whats to the right - so
set '|' as fieldseperator and print first field
Dragons:
if ' (' in the real path
if '|' exists *in front of' the one we insert.
So not really an all-weather solution.

Substitute awk with grep,sed as fancied.
-----

Code: Select all

rox -D /
while read line; do

rox "$line"        #quote if EVER space in pathname
          #sleep ?
done<mywins
--------
alternative -likely too snappy

Code: Select all

IFS=$'\n'
ar=($(<mywins))
rox -D /
IFS=' '
rox ${ar[*]}  #no spaces in paths -right?
--------
Issues: Big directories takes time rendering
Rox applies its own window positioning on *new*/non-configured
windows.
xdotool can give you some positioning-control.
: -which is probably what Musher0 are into with wmctrl
-------
Rox needs some empathy and support,not a spanking - in our
correctional endevours....

Cheers

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#6 Post by Argolance »

Bonjour,
... Right in the target :D !
musher0 wrote:(Good luck!)
I got it, indeed!
some1 wrote:-likely too snappy
What do you mean?
Merci!

Cordialement.

some1
Posts: 117
Joined: Thu 17 Jan 2013, 11:07

#7 Post by some1 »

Bonjour':)'
likely too snappy
too fast
The code delivers a list of windows for rox to bring up.
Rox reacts immidiately bringing up the windows -
but the rendering of the content may be very slow - with weird
visuals.A matter of ressourcehandling by rox,the system.
(Like opening a directory with 100000 items - rox likely
chokes,goes into an introvertive-mood)
A rox-call per window along with a small sleep might soften that nuisance.

---
The parsing yesterday/above contained some awk-acrobatics -
which blew up the bytecode -and perhaps also contained a speed-penalty.

Assuming the turf is small enough - i.e. small number of windows and
smallish windows-titles -parsing with bashops might be very fast.
But note,bashops degrades very fast outside their preferred turf.

.

Code: Select all

xwininfo -root -tree|awk -F'"' '(($2 ~ /^[\/\~]/) && ($4 ~ "ROX-Filer")){print $2}'>awkout
$(>mywins)
while read line; do
line=${line/\~/\/root}
echo "${line%' ('*}">>mywins
done<awkout
xdotool,wmctrl may be needed/good for visual-effect -
but your wanted list - can be efficiently harvested by internal tools.

Cheers

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#8 Post by amigo »

I'm wondering why you want to close and then reopen the windows in the first place? You know they will be refreshed automatically, right?

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#9 Post by Argolance »

Bonsoir,
some1 wrote:The parsing yesterday/above contained some awk-acrobatics -
which blew up the bytecode -and perhaps also contained a speed-penalty.
"acrobatics", perhaps, but working perfectly. I am nevertheless going to try your suggestion above...
amigo wrote:I'm wondering why you want to close and then reopen the windows in the first place? You know they will be refreshed automatically, right?
I made a script called "pattern switcher", which changes windows background. It needs to close all opened ROX windows to let user directly/immediately see the result inside a single ROX window (/root/my-documents) and this is not possible if any other window stays opened. Then, if satisfied of his choice, user closes the application and, if exist, all opened windows are restored (placement on the desktop doesn't matter). I admit this is not essential (as well as the whole script! :wink: ) and could easily come across it... :oops:

Cordialement.
Attachments
140225_184204_506x525_easyshot.png
(36.35 KiB) Downloaded 450 times
140225_184810_412x199_easyshot.png
(62.86 KiB) Downloaded 439 times
140225_185052_412x232_easyshot.png
(36.59 KiB) Downloaded 442 times
Last edited by Argolance on Tue 25 Feb 2014, 18:53, edited 1 time in total.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Hi, argolance.

I was going to ask the same question amigo asked. Thanks for your answer.

Another useful script that I can see derived from this "research" could be an wm-
independent "windows list".

For ex., icewm has it, wmx has it, pekwm has it; but not jwm, not echinus.

BFN.

musher0
Attachments
Example_of_windows-list_in_lxp-icewm.jpg
(&quot;Fenêtres&quot; means &quot;windows&quot;.)
(12.24 KiB) Downloaded 430 times
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#11 Post by Argolance »

Hi,
musher wrote:For ex., icewm has it, wmx has it, pekwm has it;
This script, like many others I am working on, are firstly made for ToOpPy which intends, as you know it :wink:, to keep "religiously" and work strictly with JWM and ROX. In any case, it would be to difficult to adapt these scripts for them to work with all the file and window managers.
but not jwm, not echinus.
Don't know if the latest JWM release does it?
Perhaps!

Cordialement.
Last edited by Argolance on Tue 25 Feb 2014, 23:00, edited 1 time in total.

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#12 Post by zigbert »

Argolance
Are you willing to share your script?


Sigmund

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#13 Post by Argolance »

Bonsoir,
zigbert wrote:Are you willing to share your script?
Yes of course, with great pleasure... as soon as it is ready!

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#14 Post by musher0 »

Argolance wrote:Hi,
musher wrote:For ex., icewm has it, wmx has it, pekwm has it;
This script, like many others I am working on, are firstly made for ToOpPy which intends, as you know it :wink:, to keep "religiously" and work strictly with JWM and ROX. In any case, it would be to difficult to adapt these scripts for them to work with all the file and window managers.
but not jwm, not echinus.
Don't know if the latest JWM release does it?
Perhaps!

Cordialement.
Hello, argolance.

Yes-yes, I know you are a focused person! :) ROX and jwm only!

But can you be a little more precise?
> Don't know if the latest JWM release does it? Perhaps!

Well... you're a jwm specialist! If you don't know, who does? :)

So... does the latest jwm show a windows list on screen or not? :)

The versions of jwm that I know do it in the "tray", but that's not the same.

Thanks in advance. BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

User avatar
Argolance
Posts: 3767
Joined: Sun 06 Jan 2008, 22:57
Location: PORT-BRILLET (Mayenne - France)
Contact:

#15 Post by Argolance »

Hello mate!
musher0 wrote:Well... you're a jwm specialist! If you don't know, who does?
... As far as i know, I like a lot but am absolutely not a "specialist" of JWM. :roll:
But on the other hand, we are both specialists of the digression... :wink:

So, please, let me send you a PM soon to go further!

Cordialement.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#16 Post by musher0 »

Argolance wrote:Hello mate!
musher0 wrote:Well... you're a jwm specialist! If you don't know, who does?
... As far as i know, I like a lot but am absolutely not a "specialist" of JWM. :roll:
But on the other hand, we are both specialists of the digression... :wink:

So, please, let me send you a PM soon to go further!

Cordialement.
Hi, argolance.

Sure, feel free to PM anytime you wish.

Thanks for the additional details about your relationship with jwm. Sorry then, for my
previous remark: I thought you were giving me an "on-the-fence" answer ("réponse de
Normand") to get me to try the new version of jwm. (Which I can't at present, since I've
got work "up to my ears" right now. ["Je suis dans l'jus, quoi !"])

BFN.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply