Tiny Core Linux
Tiny Core Base => TCB Tips & Tricks => Topic started by: MakodFilu on February 20, 2009, 04:55:37 AM
-
a) Just click anywhere in your desktop for the pop-up menu, select Run command and input the following:
aterm -title Calendar --geometry 40x18 -e dialog --no-cancel --calendar "Use cursor keys to navigate" 0 38
Voilá! A browsable calendar.
b) Create a text file named background-viewer.sh somewhere (i. e. your home directory):
#!/bin/sh
for x in /opt/.backgrounds/*.[jJ][pP]*[gG]
do
echo \<img src=\"$x\" /\> >> ~/backgrounds.htm
done
help ~/backgrounds.htm
cp your photos to /opt/.backgrounds (note the dot) and you are set, an image viewer, gmail style. Works with .bmp and .png too, just edit the dedicated line.
c) rm /usr/bin/unlzma # The unlzma applet is not in busybox anymore.
d) update syslinux. The bundled version behave funny when splash screens are present.
-
I had no idea there was a built-in calendar in dialog. Nice.
I've been using a similar (less dirty) html generator to list and view animated gifs, since most Linux image viewers don't show the animation. Note it relies on CSS and iframe support, and has a couple of minor things customized to my system.
cat << EOF > Gifs.html
<html>
<head>
<title>GIF Images</title>
</head>
<style type="text/css">
a { font-family: verdana, arial, helvetica, sans-serif; font-size: 10;
color: #000000; text-decoration: none; padding: 2px; line-height: 2em;
border-style: solid; border-width: 1px; border-color: #DDDDDD }
a:hover { border-color: #000000 }
</style>
<body>
<iframe name="picture" frameborder="0" width="100%" height="360" src="000.jpg"></iframe>
<hr/>
EOF
for i in *.[Gg][Ii][Ff]; do
name=`echo "$i"|sed 's/\.[Gg][Ii][Ff]$//'`
size=`ls -lh "$i" | awk '{print $5}'`
echo "<a href=\"$i\" target=\"picture\" title=\"$i - $size\">$name</a>" >>Gifs.html
done
echo "</body></html>" >>Gifs.html
-
using the help viewer is inspired, though :) i just noticed it yesterday.
-
That's it, that is the trick. No .tce nor .tcz needed.
Unfortunately, animated gif don't work, not even CSS. However, borrowing from mikshaw script:
#!/bin/sh
cat << EOF > ~/backgrounds.html
<html><head><title>Available backgrounds</title>
</head>
<body>
EOF
for x in /opt/.backgrounds/*.[gGpPbBjJ][iInNmMpP]*[fFpPgG]
do
echo \<img src=\"$x\" /\>\<hr /\> >> ~/backgrounds.html
done
echo "</body></html>" >>~/backgrounds.html
help ~/backgrounds.html
Now it can show all your available wallpapers for you to choose. Beware, the code as it is would also load .pig files, so take care not to make this code look even dirtier by misplacing files in /opt/.backgrounds (((:
-
If you are worried about that, you could use something like this instead:
for x in `ls -1 /opt/.backgrounds/ | grep -i "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
-
If you are worried about that, you could use something like this instead:
for x in `ls -1 /opt/.backgrounds/ | grep -i "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
needs a "*" (edit: don't think "-l" is necessary :) )
for x in `ls /opt/.backgrounds/* | grep -i "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
-
I think I should open the regex book I have and start reading it once and for all (: (or twice, or...)
-
needs a "*" (edit: don't think "-l" is necessary :) )
for x in `ls /opt/.backgrounds/* | grep -i "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
Actually, the * and the -1 (note: it's a one) are not needed. I usually use -1 by default so I can set IFS, etc if the paths might contain spaces.
-
needs a "*" (edit: don't think "-l" is necessary :) )
for x in `ls /opt/.backgrounds/* | grep -i "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
Actually, the * and the -1 (note: it's a one) are not needed. I usually use -1 by default so I can set IFS, etc if the paths might contain spaces.
It doesn't work without the "*" for me.
-
Odd - globbing shouldn't be needed. What kind of setup/environment do you have?
-
I followed the advice for accessing the calendar, but my screen just blinked (I think showing the calendar), but then the terminal closed. How do I get it to persist?
-
Odd - globbing shouldn't be needed. What kind of setup/environment do you have?
Sorry I missed see your question. Without the "*" it omits the path.....(.necessary because backgrounds.html is stored in $HOME)
-
I followed the advice for accessing the calendar, but my screen just blinked (I think showing the calendar), but then the terminal closed. How do I get it to persist?
are you using the latest version of tc? i just tried it in tc 1.0, i think busybox has been updated since then. make certain you typed everything exactly, including the 0 38. normally i would suggest putting the part after -e in double quotes and adding && read, but since "use navigation commands" is in quotes you'll need to give more information, like whether you're trying to run this from the jwm menu and what version of tc.