move icon by a script
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
move icon by a 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!
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!

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...
I am Lead Dog of the
Puppy Linux Users Group on Facebook
Join us!
Puppy since 2.15CE...
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Hi puppyluvr!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.
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
Hey Der-schutzhund
This little script should do the job; just make backup of your PuppyPin first, because I haven't tested it extensively:
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!
This little script should do the job; just make backup of your PuppyPin first, because I haven't tested it extensively:
Code: Select all
#!/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
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!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
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
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
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/viewto ... 752#344752
It's also possible to remove an icon with <PinboardRemove> tag, details here:
http://rox.sourceforge.net/Manual/Manua ... .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!
First script from this post sets new icon at desired coordinates:
http://www.murga-linux.com/puppy/viewto ... 752#344752
It's also possible to remove an icon with <PinboardRemove> tag, details here:
http://rox.sourceforge.net/Manual/Manua ... .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!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Hey SFR,SFR wrote: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/viewto ... 752#344752
It's also possible to remove an icon with <PinboardRemove> tag, details here:
http://rox.sourceforge.net/Manual/Manua ... .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!
it works!

But .... if i add for example 20 icons it will take ca. 2 sec.

Greetings!
Wolfgang
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Code: Select all
#!/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
Hmm, I just tried and ROX's SOAP RPC mechanism accepts multiple <Pinboard...> tags at once.
Check out display time of the following one.
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!
Check out display time of the following one.

Code: Select all
#! /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
Greetings!
Last edited by SFR on Mon 24 Dec 2012, 02:41, edited 1 time in total.
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
I've been playing with this and couldn't resist.
Just for fun:
PS. And it's still clickable!
Greetings!

Just for fun:
Code: Select all
#! /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

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Hey SFR,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.
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.Code: Select all
#! /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
Greetings!
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
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Hey SFR,SFR wrote:I'm glad it works fine for you.![]()
Merry X-mas &
Greetings!
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
Hey Wolfgang
You mean something like this, to display undecorated window with text?
BTW, did you see Zigbert's modified gtkdialog-splash?
http://www.murga-linux.com/puppy/viewto ... 564#626564
You could customize it to your needs, too.
Also, urxvt gives a lot of possibilities; here's example.
Good luck &
Greetings!
You mean something like this, to display undecorated window with text?
Code: Select all
#! /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
http://www.murga-linux.com/puppy/viewto ... 564#626564
You could customize it to your needs, too.
Also, urxvt gives a lot of possibilities; here's example.

Code: Select all
#!/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
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
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
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
Not sure if I understand...
To destroy a window you can use the technique from my previous post:
But if this info window is supposed to be placed on fixed position, it's better to only change its contents, like in this:
(When you run this script, just modify contents of /tmp/temp_text.txt file and the change in the window will be visible after max. 1 second.)
But like I said, I'm not sure if I fully understand your design plan.
Greetings!
To destroy a window you can use the technique from my previous post:
Of course instead of 'sleep 5' you need to put a condition, like:gtkdialog -G 256x48+400+400 -p MAIN & WINDOW_PID=$!
sleep 5
kill $WINDOW_PID # kill window
Code: Select all
if [ something ]; then
kill $WINDOW_PID
fi
Code: Select all
#! /bin/bash
touch /tmp/temp_text.txt
echo "initial msg" > /tmp/temp_text.txt
export MAIN='
<window width-request="300">
<text><variable>MESSAGE</variable><input file>/tmp/temp_text.txt</input></text>
<timer interval="1" visible="false">
<action>refresh:MESSAGE</action>
</timer>
</window>
'
gtkdialog -p MAIN
But like I said, I'm not sure if I fully understand your design plan.

Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
Hey,
i have made 2 scripts like:
This script to make the Infowindow:
And a script to clear the Infowindow:
Then I have used the first script that generates info window, and later with the second script tries again to delete.
Sometimes I could not delete the window anymore.
That's the problem!
Greetings!
Wolfgang
i have made 2 scripts like:
This script to make the Infowindow:
Code: Select all
#! /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=$!
Code: Select all
#! /bin/bash
kill $WINDOW_PID # kill window
Sometimes I could not delete the window anymore.
That's the problem!
Greetings!
Wolfgang
The problem is that the second script can't read the real $WINDOW_PID value, as it is complete different process that has no access to another processes' data.
But the workaround is simple, it's enough to use a temporary file.
First script:
Second script:
Greetings!
But the workaround is simple, it's enough to use a temporary file.
First script:
Code: Select all
#! /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=$!
echo $WINDOW_PID > /tmp/temp_PID
Code: Select all
#! /bin/bash
[ -f /tmp/temp_PID ] && WINDOW_PID=`cat /tmp/temp_PID` || exit
rm -f /tmp/temp_PID # remove temp file, if already used
kill $WINDOW_PID # kill window
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]
-
- Posts: 1045
- Joined: Mon 26 Nov 2007, 22:07
- Location: Blomberg / Germany
You're welcome.der-schutzhund wrote:Absolutely brilliant!
Thank you so much!
Where do you live and what you do professionally?
Greetings!
Wolfgang

We're neighbours actually - the next country eastward.
Currently I'm happily unemployed yet (I truly hated my last job), that's why I have some more time to tinker with Puppy, but have no profession as such; general high school.
Everything (useful) that I know, I've learned by myself...
Cheers from PL &
Greetings!
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]