Author |
Message |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Sun 23 Dec 2012, 10:22 Post subject:
move icon by a script Subject description: seeking a special script |
|
Hi all,
i need a script to move a icon on the Desktop to a new position (x,y).
can someone help me?
Wolfgang
P.S. Am really looking forward to your answers!
|
Back to top
|
|
 |
puppyluvr

Joined: 06 Jan 2008 Posts: 3466 Location: Chickasha Oklahoma
|
Posted: Sun 23 Dec 2012, 10:31 Post subject:
|
|
Hello,
Icon locations are controlled here:
/root/Choices/ROX-Filer/PuppyPin
But you have to restart Rox to change them, so doing so with a script would be difficult.
_________________ Close the Windows, and open your eyes, to a whole new world
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!
Puppy since 2.15CE...
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Sun 23 Dec 2012, 11:05 Post subject:
|
|
puppyluvr wrote: | Hello,
Icon locations are controlled here:
/root/Choices/ROX-Filer/PuppyPin
But you have to restart Rox to change them, so doing so with a script would be difficult. |
Hi puppyluvr!
A restart should not be!
The icons you can move with the mouse and you need not a restart.
I would love to develop a whole new user interface only with icons!
Wolfgang
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 23 Dec 2012, 13:24 Post subject:
|
|
Hey Der-schutzhund
This little script should do the job; just make backup of your PuppyPin first, because I haven't tested it extensively:
Code: | #!/bin/bash
MYNAME="$(basename $0)"
[ "$#" -ne 3 ] && echo -e "Usage:\n$MYNAME <icon_name> <new_X> <new_Y>" && exit 1
x="`echo $2 | tr -cd [:digit:]`"
y="`echo $3 | tr -cd [:digit:]`"
[ "$x" = "" ] || [ "$y" = "" ] && echo "<new_X> & <new_Y> must be numerical values..." && exit 1
PINDIR="$HOME/Choices/ROX-Filer"
TEMP=`grep -n -w -m1 "label=\"$1\"" "$PINDIR/PuppyPin"`
[ ! "$TEMP" ] && echo "Can't find such icon..." && exit 1
LINE_NUM=`echo ${TEMP%:*}`
NEW="<icon x=\"$x\" y=\"$y\" ""`echo "$TEMP" | cut -f6- -d ' '`"
touch "$PINDIR/PuppyPin_new"
awk 'NR>=1&&NR<='$(($LINE_NUM-1))'' "$PINDIR/PuppyPin" > "$PINDIR/PuppyPin_new"
echo " $NEW" >> "$PINDIR/PuppyPin_new"
awk 'NR>='$(($LINE_NUM+1))'' "$PINDIR/PuppyPin" >> "$PINDIR/PuppyPin_new"
mv "$PINDIR/PuppyPin_new" "$PINDIR/PuppyPin"
rox --pinboard=/root/Choices/ROX-Filer/PuppyPin |
Usage example:
script_name calc 200 500
But it's not perfect:
- If there are two or more icons with the same names, only the first (according to order in /root/Choices/ROX-Filer/PuppyPin) will be moved.
- Refreshing the pinboard causes that Conky disappears (if one have it).
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Sun 23 Dec 2012, 15:56 Post subject:
|
|
Hey sfr,
nice but the screen is for a moment dark, because of the refresh!
This is my idea:
All icons are assigned to groups.
For example, office, programming, system, as in the text menu.
For this first level, there are major icons or using wbar.
If you click on the icon for the Office then Office icons are moved to their positions.
If you then click on the mainicon system the following happens:
- The current positions of office icons are stored in a list.
- The office icons are all pushed to the position 10,10.
- The positions of the system icons are read from a list.
- The system icons are pushed to their old positions
With this simple procedure could be used to enable a clear view, graphical menu system. All commands are accessible in two clicks. No text menus longer needed.
What do you think?
Greetings!
Wolfgang
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 23 Dec 2012, 16:33 Post subject:
|
|
Sounds good and should be absolutely possible to implement, especially that there's a much better way to control Pinboard icons (no blinking).
First script from this post sets new icon at desired coordinates:
http://www.murga-linux.com/puppy/viewtopic.php?p=344752#344752
It's also possible to remove an icon with <PinboardRemove> tag, details here:
http://rox.sourceforge.net/Manual/Manual/Manual.html#soap
EDIT: I haven't noticed before - in the first post of the above thread there's already working script for adding, removing and changing desktop icons.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Sun 23 Dec 2012, 18:50 Post subject:
|
|
Hey SFR,
it works!
But .... if i add for example 20 icons it will take ca. 2 sec.
Greetings!
Wolfgang
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Sun 23 Dec 2012, 19:09 Post subject:
|
|
Code: | #!/bin/bash
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
<PinboardAdd>
<Path>$1</Path>
<X>$2</X>
<Y>$3</Y>
<Label>$4</Label>
<Args>$5</Args>
</PinboardAdd>
</env:Body>
</env:Envelope>" | rox -R |
Is it possibly to make the script faster?
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 23 Dec 2012, 19:30 Post subject:
|
|
Hmm, I just tried and ROX's SOAP RPC mechanism accepts multiple <Pinboard...> tags at once.
Check out display time of the following one.
Code: | #! /bin/bash
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*1))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*2))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*3))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*4))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*5))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*6))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*7))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*8))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*9))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*10))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
</env:Body></env:Envelope>" | rox -R |
EDIT: In this (and the one below) script I've hardcoded <Y>600</Y> values, so you may need to change it if you have less tall screen.
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Last edited by SFR on Sun 23 Dec 2012, 22:41; edited 1 time in total
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Sun 23 Dec 2012, 21:53 Post subject:
|
|
I've been playing with this and couldn't resist.
Just for fun:
Code: | #! /bin/bash
# ==================
# BOUNCING RXVT ICON
# ==================
# For best results make sure that 'ROX Options -> Pinboard -> Icon grid step' is set to 'Fine'
[ ! -f /usr/bin/rxvt ] && exit 1
# Create sinus table
PI=`echo "4*a(1)" | bc -l`
for i in {0..31}; do
RAD=`echo "$i*($PI/32)" | bc -l`
VAL=`echo "s($RAD) * 150 + 32" | bc -l`
SIN[$i]=${VAL/.*}
echo ${SIN[$i]}
done
# Bounce 3 times and exit
for j in {1..3}; do
for i in `seq 0 2 31`; do
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>${SIN[$i]}</X><Y>600</Y>
<Label> </Label><Args>+sb</Args>
</PinboardAdd>
<PinboardRemove><Path>/usr/bin/rxvt</Path>
<Label> </Label>
</PinboardRemove>
</env:Body></env:Envelope>" | rox -R
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>${SIN[$(($i+1))]}</X><Y>600</Y>
<Label> </Label>
</PinboardAdd>
<PinboardRemove><Path>/usr/bin/rxvt</Path>
<Label> </Label>
</PinboardRemove>
</env:Body></env:Envelope>" | rox -R
done
done |
PS. And it's still clickable!
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Mon 24 Dec 2012, 09:02 Post subject:
|
|
SFR wrote: | Hmm, I just tried and ROX's SOAP RPC mechanism accepts multiple <Pinboard...> tags at once.
Check out display time of the following one.
Code: | #! /bin/bash
echo "<?xml version=\"1.0\"?>
<env:Envelope xmlns:env=\"http://www.w3.org/2001/12/soap-envelope\">
<env:Body xmlns=\"http://rox.sourceforge.net/SOAP/ROX-Filer\">
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*1))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*2))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*3))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*4))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*5))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*6))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*7))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*8))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*9))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
<PinboardAdd><Path>/usr/bin/rxvt</Path><X>$((64*10))</X><Y>600</Y>
<Label>RXVT</Label><Args>+sb</Args>
</PinboardAdd>
</env:Body></env:Envelope>" | rox -R |
EDIT: In this (and the one below) script I've hardcoded <Y>600</Y> values, so you may need to change it if you have less tall screen.
Greetings! |
Hey SFR,
i have not tested yet but that this approach i would have also tried next!
Did you get your Christmas gifts yet?
EDIT: absolutely awesome! The scripts are great!
Greetings!
Wolfgang
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Mon 24 Dec 2012, 10:45 Post subject:
|
|
I'm glad it works fine for you.
Merry X-mas &
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Thu 27 Dec 2012, 13:43 Post subject:
|
|
SFR wrote: | I'm glad it works fine for you.
Merry X-mas &
Greetings! |
Hey SFR,
the new graphical menu system is ready and works fine!
What I now missing is a small info window that displays a text.
The window should not contain any buttons.
It should be able to be generated by a script, and cleared again.
In this window, I will show you the active program group.
I have already experimented with xdialog.
Since bothers me but the title and I can not delete can also by a script.
Do you have an idea?
Greetings!
Wolfgang
|
Back to top
|
|
 |
SFR

Joined: 26 Oct 2011 Posts: 1655
|
Posted: Thu 27 Dec 2012, 15:33 Post subject:
|
|
Hey Wolfgang
You mean something like this, to display undecorated window with text?
Code: | #! /bin/bash
# decorated="false" - no window decorations
# skip_taskbar_hint="true" - no script name on the taskbar (thanks to Puppylvr ;)
export MAIN='
<window decorated="false" skip_taskbar_hint="true">
<text use-markup="true"><label>"<b><span color='"'blue'"' size='"'xx-large'"'><u>Some message...</u></span></b>"</label></text>
</window>
'
# -G <width>x<height>+<X_position>+<Y_position>
gtkdialog -G 256x48+400+400 -p MAIN & WINDOW_PID=$!
sleep 5
kill $WINDOW_PID # kill window |
BTW, did you see Zigbert's modified gtkdialog-splash?
http://www.murga-linux.com/puppy/viewtopic.php?p=626564#626564
You could customize it to your needs, too.
Also, urxvt gives a lot of possibilities; here's example.
Code: | #!/bin/bash
tail -n +4 $0 > /tmp/scroller_temp.txt
exec urxvt -foreground 7 -transparent -borderLess +sb -g 40x1+0+0 -fn 'xft:DejaVu Sans Mono-18:bold:dpi=76' -e bash /tmp/scroller_temp.txt
# -g <width>x<height>+<X_position>+<Y_position>
MESSAGE="Hello Wolfgang!"
MESSAGE=" "$MESSAGE
LEN=${#MESSAGE}
POS=0
# Main scroll function
echo -ne "\033[?25l" # disable cursor
for i in `seq 0 $LEN`; do
TEXT=${MESSAGE:$POS:40}
((POS++))
[ $POS = $LEN ] && POS=0
echo
echo -n "$TEXT"
sleep 0.2
done |
Good luck &
Greetings!
_________________ [O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
|
Back to top
|
|
 |
der-schutzhund
Joined: 26 Nov 2007 Posts: 1040 Location: Blomberg / Germany
|
Posted: Thu 27 Dec 2012, 16:29 Post subject:
|
|
Hey SFR,
the problem is not the making of the info window but later delete!
The info window is created when a new program group appears as "office." Then you work with open office, etc. At some point changes as you for image processing and then erased in the first window.
Then a new info window will be taken "imaging" and so on.
The window must have a unique address such as a button!
Greetings.
Wolfgang
|
Back to top
|
|
 |
|