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 Sat 25 Oct 2014, 02:33
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
move icon by a script
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Sun 23 Dec 2012, 10:22    Post_subject:  move icon by a script
Sub_title: 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
View user's profile Send_private_message 
puppyluvr


Joined: 06 Jan 2008
Posts: 3213
Location: Chickasha Oklahoma

PostPosted: Sun 23 Dec 2012, 10:31    Post_subject:  

Very Happy 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
http://puppylinuxstuff.meownplanet.net/puppyluvr/
Puppy Linux Users Group on Facebook

Puppy since 2.15CE...
Back to top
View user's profile Send_private_message Visit_website 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Sun 23 Dec 2012, 11:05    Post_subject:  

puppyluvr wrote:
Very Happy 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
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: 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
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: 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
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: 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
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Sun 23 Dec 2012, 18:50    Post_subject:  

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/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!


Hey SFR,

it works! Very Happy

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

Greetings!

Wolfgang
Back to top
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: 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
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: 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. Wink

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.

Edited_time_total
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Sun 23 Dec 2012, 21:53    Post_subject:  

I've been playing with this and couldn't resist. Laughing

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! Wink

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
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: 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. Wink

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? Smile

EDIT: absolutely awesome! The scripts are great!

Greetings!

Wolfgang
Back to top
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: Mon 24 Dec 2012, 10:45    Post_subject:  

I'm glad it works fine for you. Smile

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
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: Thu 27 Dec 2012, 13:43    Post_subject:  

SFR wrote:
I'm glad it works fine for you. Smile

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
View user's profile Send_private_message 
SFR


Joined: 26 Oct 2011
Posts: 1078

PostPosted: 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. Wink
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
View user's profile Send_private_message 
der-schutzhund

Joined: 26 Nov 2007
Posts: 781
Location: Blomberg / Germany

PostPosted: 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
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


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