Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (3) </ [1] 2 3 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: "Add Icon" script, bit of user-friendliness< Next Oldest | Next Newest >
RoGuE_StreaK Offline





Group: Members
Posts: 418
Joined: Jan. 2004
Posted: Feb. 12 2005,13:15 QUOTE

Another "just had a thought" from my delusional brain.
How about a small script, run from the "Desktop" part of the menu, to add a bit of user-friendliness to the creation of an icon, by using the inputed variables to create a .lnk file?  Say, on click of "menu / Desktop / Create icon" =>
1.  "Icon Caption" - gives the caption, and the file name for the created .lnk
2.  "Executable Command, eg. /usr/bin/gimp" - gives the command line, obviously may be a little too much for complete newbies, but...
3.  "Icon Image" - gives the name of the gif or png, maybe tells them to place it in /home/dsl/.xtdesktop?

Coordinates don't need to be specified, 'cause once it's made, the user can just drag the new icon to where they want it.

Of course it would be good if the "Command" and "Icon Image" had a "browse" function, but I'm guessing this would complicate it a bit.

The basic version should be a fairly small and simple script?  I'm not too knowledgeale about scripting, but I think I could probably figure out how to do this to some degree if need be?
Would just add a little bit more user-friendliness for those coming from windoze who are used to being able to create icons etc by right-clicking the desktop.

Hmm, actually, a similar principal could possibly apply to the menu, or at least the mydsl part of it, correct?  As each mydsl item creates it's own seperate link file under /var/temp/mydsl.menu
?


--------------
"I find your lack of penguin disturbing"
                                      - Darth Tux
Back to top
Profile PM WEB 
TyphoonMentat (not logged in)
Unregistered






Posted: Feb. 12 2005,16:01 QUOTE

How about something like this:

Code Sample

#!/bin/sh
DIA="Xdialog --wmclass"

$DIA --2inputsbox "Please enter a name and a command for your icon." 0 0 "Name:" "" "Command:" "" 2>/tmp/tic
ICON_NAME=`cat /tmp/tic | perl -e '$x=<>;if($x=~/^(.*?)\/.+/{print $1}'`
ICON_CMD=`cat /tmp/tic | perl -e '$x=<>;if($x=~/^(.*?)\/(.*)/{print $2}'`

$DIA --msgbox "Now choose a picture for your icon." 0 0
$DIA --fselect /home/knoppix/.xtdesktop 0 0 2> /tmp/tic
ICON_PIC=`cat /tmp/tic`
rm -f /tmp/tic

cat <<EOF>/home/knoppix/.xtdesktop/$ICON_NAME.lnk
table Icon
Type: Program
Caption: $ICON_NAME
Command: $ICON_CMD
Icon: $ICON_PIC
X: 25
Y: 270
end
EOF


(apologies for any formatting errors)
Back to top
TyphoonMentat Offline





Group: Members
Posts: 183
Joined: Oct. 2003
Posted: Feb. 12 2005,18:17 QUOTE

Corrected version:

Code Sample
#!/bin/sh
DIA="Xdialog --wmclass --title Icon"

$DIA --2inputsbox "Please enter a name and a command for your icon." 0 0 "Name:" "" "Command:" "" 2>/tmp/tic
ICON_NAME=`cat /tmp/tic | perl -e '$x=<>;if($x=~/^(.*?)\/.+/{print $1}'`
ICON_CMD=`cat /tmp/tic | perl -e '$x=<>;if($x=~/^(.*?)\/(.*)/{print $2}'`

$DIA --msgbox "Now choose a picture for your icon." 0 0
$DIA --fselect /home/dsl/.xtdesktop 0 0 2> /tmp/tic
ICON_PIC=`cat /tmp/tic`
rm -f /tmp/tic

cat <<EOF>/home/dsl/.xtdesktop/$ICON_NAME.lnk
table Icon
Type: Program
Caption: $ICON_NAME
Command: $ICON_CMD
Icon: $ICON_PIC
X: 25
Y: 270
end
EOF
Back to top
Profile PM 
RoGuE_StreaK Offline





Group: Members
Posts: 418
Joined: Jan. 2004
Posted: Feb. 13 2005,03:56 QUOTE

Thanks TyphoonMentat, but couldn't get it to work - looking at the script, I assume it needs perl to work, and perl isn't on in the standard iso, correct?

--------------
"I find your lack of penguin disturbing"
                                      - Darth Tux
Back to top
Profile PM WEB 
cbagger01 Offline





Group: Members
Posts: 4264
Joined: Oct. 2003
Posted: Feb. 13 2005,07:10 QUOTE

perl is on the standard iso

But xdialog ISN'T

A slight rewrite with whiptail instead of xdialog is in order.

But I think that the file selector is not supported in whiptail, but I could be wrong.
Back to top
Profile PM 
11 replies since Feb. 12 2005,13:15 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (3) </ [1] 2 3 >/
reply to topic new topic new poll
Quick Reply: "Add Icon" script

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code