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

Dave M G martin at autotelic.com
Sat Mar 5 10:36:44 UTC 2011


Brian,

Your ImageMagick script works great!

A couple of tweaks I made was to call:

xset dpms force off;

... just before "kill -9 $PID" line, just so the screen goes off just
before the image stops, which makes it smoother.

So, right now, what I do is combination of effects.

When the screen is off, I use the ImageMagick method, but when the
screen is on, use the aosd_cat method. The aosd_cat can have a
transparent background and stuff which is good.

Here is the aosd_cat command I have. It overlays a time on the centre of
the screen:

date +"%H:%M, %A %B, %d, %Y" | aosd_cat --font="Ubuntu 48"
--shadow-offset=1 --back-color=black --back-opacity=200 --position=4
--padding=32 --fore-color=white --lines=0 --fade-in=0 --fade-out=0
--lines=3 --age=1

I have the script mapped to a button on my remote control, so we're off
and running.

There's only one problem left.

When I'm looking at the MythTV interface and start the script, it uses
the aosd_cat command. This is good.

When the screen is off and I start the script, it uses the ImageMagick
command. This is also good.

However, when I'm watching a video, and I start the script, it uses the
ImageMagick command. This is bad.

It's as if when a video plays, xset thinks the monitor is off.

Any ideas what that's about?

I've included my whole script as it stands now here:

- - -
#!/bin/bash

# Be careful of line breaks if copying and pasting
# the contents of this file.
# Make sure you have the necessary apps:
# sudo apt-get install qiv aosd_cat imagemagick

#Create the date string.
#Use 'tr' to insert a line feed to place date and time on separate lines
DATESTRING=`date +".%H:%M..%A.%B %d, %Y" | tr "." "\n"`

STATUS=`xset -q | grep "Monitor is" | awk '{print $3}'`

if [ "${STATUS}" = "On" ]
then
   date +"%H:%M, %A %B, %d, %Y" | aosd_cat --font="Ubuntu 48"
--shadow-offset=1 --back-color=black --back-opacity=200 --position=4
--padding=32 --fore-color=white --lines=0 --fade-in=0 --fade-out=0
--lines=3 --age=1;

else

#Define background image file location
BGFILE='/home/mythbuntu/.lirc/black_bg.jpg'

#Define clock image file location
CLOCKFILE='/home/mythbuntu/.lirc/black_clock.jpg'

#Get display width
WIDTH=`xdpyinfo | grep 'dimensions:' | awk '{print $2}' | cut -dx -f1`

#Get display height
HEIGHT=`xdpyinfo | grep 'dimensions:' | awk '{print $2}' | cut -dx -f2`

#Define text height as a function of display height
POINTSZ=$(echo $HEIGHT/6 | bc)

#Remove the background image file because 'convert' will auto increment
and not overwrite
rm -f $BGFILE

#Create a blank canvas
convert -size ${WIDTH}x${HEIGHT} xc:black $BGFILE

#Write date/time over blank canvas
convert -font ubuntu -fill white -pointsize $POINTSZ -draw 'text
100,200 "'"$DATESTRING"'"' $BGFILE $CLOCKFILE

xdotool key shift;
xset dpms force on;

#Display date/time image
qiv --fullscreen --scale_down -i $CLOCKFILE &

#Get procid
PID=$!

#Keep image on display for 5 seconds
sleep 5

xset dpms force off;

#Kill qiv to remove date/time image from display ('killall qiv' could
also be used)
kill -9 $PID

fi
exit 0
- - -

-- 
Dave M G


More information about the mythtv-users mailing list