Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 19 Dec 2014, 19:47
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to list current opened ROX windows? (Solved)
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Mon 24 Feb 2014, 08:14    Post subject:  How to list current opened ROX windows? (Solved)  

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:
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, 06:51; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4454
Location: Gatineau (Qc), Canada

PostPosted: Mon 24 Feb 2014, 13:16    Post subject:  

Hello, argolance.

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

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:
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:
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

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
amigo

Joined: 02 Apr 2007
Posts: 2291

PostPosted: Mon 24 Feb 2014, 13:31    Post subject:  

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!
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Mon 24 Feb 2014, 15:00    Post subject:  

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.

_________________

Back to top
View user's profile Send private message Visit poster's website 
some1

Joined: 17 Jan 2013
Posts: 34

PostPosted: Mon 24 Feb 2014, 22:21    Post subject:  

Hi
Quote:

Sorry, I should have say....

I guess Amigo and Musher0 have done the groundwork for what you want Very Happy

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

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:

rox -D /
while read line; do

rox "$line"        #quote if EVER space in pathname
          #sleep ?
done<mywins

--------
alternative -likely too snappy
Code:

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
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 25 Feb 2014, 06:50    Post subject:  

Bonjour,
... Right in the target Very Happy !
musher0 wrote:
(Good luck!)

I got it, indeed!
some1 wrote:
-likely too snappy

What do you mean?
Merci!

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
some1

Joined: 17 Jan 2013
Posts: 34

PostPosted: Tue 25 Feb 2014, 11:34    Post subject:  

Bonjour'Smile'

Quote:

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:

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
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2291

PostPosted: Tue 25 Feb 2014, 13:02    Post subject:  

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?
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 25 Feb 2014, 13:51    Post subject:  

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... Embarassed

Cordialement.
140225_184204_506x525_easyshot.png
 Description   
 Filesize   36.35 KB
 Viewed   368 Time(s)

140225_184204_506x525_easyshot.png

140225_184810_412x199_easyshot.png
 Description   
 Filesize   62.86 KB
 Viewed   359 Time(s)

140225_184810_412x199_easyshot.png

140225_185052_412x232_easyshot.png
 Description   
 Filesize   36.59 KB
 Viewed   359 Time(s)

140225_185052_412x232_easyshot.png


_________________


Last edited by Argolance on Tue 25 Feb 2014, 14:53; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4454
Location: Gatineau (Qc), Canada

PostPosted: Tue 25 Feb 2014, 14:52    Post subject:  

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
Example_of_windows-list_in_lxp-icewm.jpg
 Description   ("Fenêtres" means "windows".)
 Filesize   12.24 KB
 Viewed   347 Time(s)

Example_of_windows-list_in_lxp-icewm.jpg


_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 25 Feb 2014, 15:09    Post subject:  

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.
Quote:
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, 19:00; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
zigbert


Joined: 29 Mar 2006
Posts: 5813
Location: Valåmoen, Norway

PostPosted: Tue 25 Feb 2014, 17:43    Post subject:  

Argolance
Are you willing to share your script?


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Tue 25 Feb 2014, 18:52    Post subject:  

Bonsoir,
zigbert wrote:
Are you willing to share your script?

Yes of course, with great pleasure... as soon as it is ready!

Cordialement.

_________________

Back to top
View user's profile Send private message Visit poster's website 
musher0


Joined: 04 Jan 2009
Posts: 4454
Location: Gatineau (Qc), Canada

PostPosted: Wed 26 Feb 2014, 03:13    Post subject:  

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.
Quote:
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! Smile 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? Smile

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

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

Thanks in advance. BFN.

musher0

_________________
"Logical entities must not be multiplied needlessly." / "Il ne faut pas multiplier les êtres logiques inutilement." (Ockham)
Back to top
View user's profile Send private message Visit poster's website 
Argolance


Joined: 06 Jan 2008
Posts: 1851
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Wed 26 Feb 2014, 20:57    Post subject:  

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. Rolling Eyes
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.

_________________

Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 2 [16 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0979s ][ Queries: 12 (0.0048s) ][ GZIP on ]