[mythtv-users] Full screen time display, with screen on

Brian Kirkman bkirkman at qwest.net
Thu Mar 3 20:29:21 UTC 2011


On 3/3/2011 7:24 AM, Dave M G wrote:
> Brian,
>
> Thanks for responding.
>
> Okay, I've got something kind of working but with a few small issues.
>
> Here is the script:
>
> - - -
> #!/bin/bash
>
> STATUS=`xset -q | grep "Monitor is" | awk '{print $3}'`
>
> if [ "${STATUS}" = "On" ]
> then
>     date +"%H:%M %m.%d.%Y" | tr " " "\n" | osd_cat --pos=middle
> --align=centre --font='-*-lucida-bold-*-*-*-128-*-*-*-*-*-*-u';
> else
>     xdotool key shift;
>     xset dpms force on;
>     date +"%H:%M %m.%d.%Y" | tr " " "\n" | osd_cat --pos=middle
> --align=centre --font='-*-lucida-bold-*-*-*-128-*-*-*-*-*-*-u';
> sleep 5;
> xset dpms force off
> fi
> exit 0
> - - -
>
> The problems:
>
> 1. Setting the font is an incredible hassle! It took me forever to
> figure out that the only hope in this world of getting the right syntax
> for font configuration to use the program "xfontsel", and even then, it
> fails more than it works.
>
> Right now, the font setting I have is literally the only one I could get
> to work on my system. The Lucida font looks like crap, it's all jaggy
> and pixelated, and it's red.
>
> I'd really like to get a nice white Ubuntu font that is smooth.
>
> However, this fails:
> -*-ubuntu-bold-*-*-*-128-*-*-*-*-*-*-u
>
>
> 2. In the "else" case of the script above, I'd like for the time to
> appear on a black background. There doesn't seem to be an option in
> osd_cat for this. Is there another way to do that?
>
> --
> Dave M G
Dave,
I know the font config is a hassle.  I still don't really understand all 
the options.  I'll try to look into it a little more and see if I can be 
of any assistance.  That being said (and I hate to "fork" our little 
project so quickly) there might be a couple of other options in order to 
get a black background and nice fonts.

One is to possibly use xscreensaver if you use it by default.  You might 
be able to use the "FontGlide" or "GLText" screensavers to display the 
time and date.  My other thought is a major hack, but I'm sure with 
enough elbow grease, you can script something up.  It involves the trick 
of generating a raster image that has the date and time from within your 
script.  I think it could be done using pbmtext and a few other tools.  
Check here for starters.

http://linux.about.com/library/cmd/blcmdl1_pbmtext.htm

This page is more comprehensive and looks like it has some good ideas.

http://linux.about.com/library/cmd/blcmdl1_netpbm.htm

Okay, I figure there has to be a simpler way.  How about ImageMagick?  
Try this link.  See the "Adding Text" section.  You could create your 
base image as a solid black background, and then use ImageMagick to 
overlay the date and time.

http://www.linux.com/archive/feature/113978

You could then throw it up on the screen using xli, qiv, or zgv, amongst 
several image programs, then kill it after 5 seconds or a button press.

These are just some thoughts of a few building blocks that might work 
out for you.  The approach above might be a little slow when trying to 
generate an image.  I'm not too sure without trying.  I might play 
around with it this evening.  Let us know if you give it a try.

-Brian




More information about the mythtv-users mailing list