[Remind-Fans] A little script I use to put remind on the desktop

Shelagh Manton shelagh.manton at gmail.com
Fri Aug 29 21:13:11 EDT 2008


On Tue, 26 Aug 2008 13:09:19 -0400 (EDT)
"Steven W. Orr" <steveo at syslang.net> wrote:

> On Tuesday, Aug 5th 2008 at 00:13 -0000, quoth Shelagh Manton:
> 
> =>As the subject says. This was devised for xfce4 but I'm sure that
> the =>guts of the script would be useful for any desktop. At least on
> *nix =>OSes.
> =>
> =>It does have three dependencies ssed imagemagick and enscript.
> =>Most are available with distro package managers but may not be
> =>installed by default. ssed (super sed) might be the only one that is
> =>difficult to get. 
> =>
> =>8< -----------------------------------------------------------
> =>#!/bin/bash
> =>#dailypic: make a picture for desktop of the output of remind.
> =>
> =>empty='s/\e\[0m/@color{default}/g
> =>s/\e\[0;31m/@color{1 0 0}/
> =>s/\e\[0;32m/@color{0 1 0}/
> =>s/\e\[0;33m/@color{1 1 0}/
> =>s/\e\[0;34m/@color{0 0 1}/
> =>s/\e\[0;35m/@color{1 0 1}/
> =>s/\e\[0;36m/@color{0 1 1}/
> =>s/\e\[0;37m/@color{0 0 0}/
> =>s/\e\[31;1m/@color{1 0 0}/
> =>s/\e\[32;1m/@color{0 1 0}/
> =>s/\e\[33;1m/@color{1 1 0}/
> =>s/\e\[34;1m/@color{0 0 1}/
> =>s/\e\[35;1m/@color{1 0 1}/
> =>s/\e\[36;1m/@color{0 1 1}/
> =>s/\e\[37;1m/@color{0 0 0}/'
> =>
> =>picture="/path/to/your/wallpapers/daily.png"
> =>
> =>remind | ssed "$empty" \
> 	 | enscript --escapes=@ -Br -fPalatino-Bold16 -q -o -\
>          | convert -trim -transparent white -rotate 90 - "$picture"
> =>xfdesktop
> =>
> =>Shelagh
> 
> How about something like:
> 
> color[0]="\e[0;31m"	# Call is red blue green or whatever
> tomap[0]='1 0 0'
> color[1]="\e[0;32m"
> tomap[1]='0 1 0'
> etc
> picture=/path/to/your/wallpapers/daily.png # No quotes needed.
> remind | while read line
> do
>     for (( ii=0; ii < ${#color[@]}; ii++ ))
>     do
>         tmp="$line"
> 	line=${tmp/${color[ii]}/@color{"${tomap[ii]}"\}}
>     done
>     echo "${line}"
> done | enscript --escapes=@ -Br -fPalatino-Bold16 -q -o - \
>      | convert -trim -transparent white -rotate 90 - $picture
> xfdesktop
> 
> It'll run faster, it'll eliminate a process, and it eliminates the
> need for supersed.
>     
Sadly I did try this. It didn't work. The text was not transformed as
expected. I think it might be because the colour escapes are not
straight forward text. This is why I ended up, after wrestling with sed
for a while trying to tweak the regexp, going with ssed. It could
handle the escapes.

Anyway, thank for suggesting it as it made me look more closely at bash
string manipulations and arrays. But I think I will leave the script as
it stands, dependant on ssed.

Shelagh

-- 

----------------------------------------------------------------
Jabber: shelagh.manton at gmail.com
----------------------------------------------------------------



More information about the Remind-fans mailing list