WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Quick tricks, calendar, dirty image viewer  (Read 4051 times)

Offline MakodFilu

  • Newbie
  • *
  • Posts: 46
Quick tricks, calendar, dirty image viewer
« on: February 20, 2009, 01: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):
Code: [Select]
#!/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.

Offline mikshaw

  • Sr. Member
  • ****
  • Posts: 368
Re: Quick tricks, calendar, dirty image viewer
« Reply #1 on: February 20, 2009, 04:35:20 AM »
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.
Code: [Select]
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

Offline tobiaus

  • Suspended
  • Hero Member
  • *****
  • Posts: 599
Re: Quick tricks, calendar, dirty image viewer
« Reply #2 on: February 20, 2009, 11:48:03 AM »
using the help viewer is inspired, though :) i just noticed it yesterday.

Offline MakodFilu

  • Newbie
  • *
  • Posts: 46
Re: Quick tricks, calendar, dirty image viewer
« Reply #3 on: February 23, 2009, 02:48:06 AM »
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:

Code: [Select]
#!/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 (((:
« Last Edit: February 23, 2009, 02:50:17 AM by MakodFilu »

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: Quick tricks, calendar, dirty image viewer
« Reply #4 on: March 01, 2009, 09:01:00 PM »
If you are worried about that, you could use something like this instead:
Code: [Select]
for x in `ls -1 /opt/.backgrounds/ | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Quick tricks, calendar, dirty image viewer
« Reply #5 on: March 01, 2009, 11:16:27 PM »
If you are worried about that, you could use something like this instead:
Code: [Select]
for x in `ls -1 /opt/.backgrounds/ | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `

needs a "*" (edit: don't think "-l" is necessary :) )
Code: [Select]
for x in `ls  /opt/.backgrounds/* | grep -i  "\.\(gif\|png\|bmp\|jpg\|jpeg\)" `
« Last Edit: March 02, 2009, 12:08:29 AM by jpeters »

Offline MakodFilu

  • Newbie
  • *
  • Posts: 46
Re: Quick tricks, calendar, dirty image viewer
« Reply #6 on: March 02, 2009, 04:03:26 AM »
I think I should open the regex book I have and start reading it once and for all (: (or twice, or...)

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: Quick tricks, calendar, dirty image viewer
« Reply #7 on: March 02, 2009, 11:32:47 AM »
needs a "*" (edit: don't think "-l" is necessary :) )
Code: [Select]
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.

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Quick tricks, calendar, dirty image viewer
« Reply #8 on: March 02, 2009, 12:46:21 PM »
needs a "*" (edit: don't think "-l" is necessary :) )
Code: [Select]
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. 

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: Quick tricks, calendar, dirty image viewer
« Reply #9 on: March 08, 2009, 12:09:53 PM »
Odd - globbing shouldn't be needed.  What kind of setup/environment do you have?

Offline tshandy33

  • Newbie
  • *
  • Posts: 4
Re: Quick tricks, calendar, dirty image viewer
« Reply #10 on: March 23, 2009, 06:51:46 AM »
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?

Offline jpeters

  • Restricted
  • Hero Member
  • *****
  • Posts: 1017
Re: Quick tricks, calendar, dirty image viewer
« Reply #11 on: March 23, 2009, 12:24:00 PM »
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)  
« Last Edit: March 23, 2009, 12:29:32 PM by jpeters »

Offline tobiaus

  • Suspended
  • Hero Member
  • *****
  • Posts: 599
Re: Quick tricks, calendar, dirty image viewer
« Reply #12 on: March 23, 2009, 01:06:16 PM »
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.