[mythtv-users] mythwelcome questions

Ma Begaj derliebegott at gmail.com
Fri Oct 12 15:43:23 UTC 2007


> Care to post your scripts and solutions in more detail?  This looks
> useful!

here is the code:

.xinitrc starts xscreensaver without splash screen, perl script which
watches for screensaver status and mythwelcome with a new log file
every time:
--------------------------------------------------------------------
fvwm2 &
ps -C xscreensaver || xscreensaver -no-splash &
killall -9 screensaver-watch >/dev/null 2>&1
/home/mythtv/screensaver-watch >/dev/null 2>&1 &
/usr/bin/mythwelcome >/tmp/mythfront`date +%FT%T` 2>&1
--------------------------------------------------------------------

screensaver-watch is a perl script which catches xscreensaver status:
--------------------------------------------------------------------
#!/usr/bin/perl -w
use strict;

delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin';

$<=0;

open(XS,"/usr/bin/xscreensaver-command -watch|") or die;
while(<XS>) {

   ## close mythfrontend and deactivate screensaver
   if(/^BLANK/i) {
      system("killall mythfrontend");
      system("xscreensaver-command -deactivate");
   }
}
--------------------------------------------------------------------

when the xscreensaver status is BLANK, the perl script kills the
mythfrontend, deactivates screensaver and mythwelcome is automatically
active. I set in mythwelcome to shutdown mythbox in 60 seconds after
getting active.

other recognized xscreensaver status are: UNBLANK and LOCK, so you can
expand the script.

the shutdown time for mythwelcome can be set in mythwelcome
preferences (mythwelcome -s).
idle timeout for xscreensaver (how long to wait to get activated) can
be set in ~/.xscreensaver or in a gui (run xscreensaver-demo).


M.


More information about the mythtv-users mailing list