Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:on_screen_display_with_xosd [2009/03/09 16:11]
Joel Dare
linux:on_screen_display_with_xosd [2020/06/01 22:53] (current)
Line 1: Line 1:
 +====== On Screen Display with XOSD ======
  
 +You can use XOSD to create on screen display text.  The text appears at a specific location for a specific amount of time.  It has several useful applications,​ such as displaying a notice about new messages on the screen.
 +
 +I'm using it to display uptime at the top of my screen every 15 minutes. ​ Here's what that looks like.
 +
 +{{ :​linux:​uptime_osd.gif|{{:​linux:​uptime_osd.gif| }}
 +
 +.\\
 +Here's the command that displays that information for 15 seconds.
 +
 +  uptime | osd_cat -A center -p top -o 5 -c black -d 15
 +
 +I wrote a quick PHP script to re-run that command repeatedly. ​ This script is then loaded in my Gnome Sessions and runs all day.
 +
 +<​code>​
 +#​!/​usr/​bin/​php
 +<?php
 +
 +  // Loop forever
 +  while (1 == 1) {
 +    exec('​uptime | osd_cat -A center -p top -o 5 -c black -d 15');
 +  }
 +
 +?>
 +</​code>​
 +
 +And, here's another quick PHP script that plays a series of sounds while it flashes text on the screen. ​ This is what I use to notify me when I get new IM'​s. ​ Has a visual and audio hint which is useful when I have headphones connected but not in my ears.
 +
 +<​code>​
 +#​!/​usr/​bin/​php
 +<?php
 +
 +  // Execute a beep, pass output to /dev/null, and background it
 +  exec('​beep -f 2000 -l 250 -d 250 -n -f 1000 -l 250 -d 250 -n -f 2000 -l 250 -n -f 1500 -l 100 -d 250 -r 3 > /dev/null &'​);​
 +  // Loop three times
 +  for ($i==1; $i<3; $i++) {
 +    // Display a message on the screen
 +    exec('​echo \'New Instant Message ​  ​\'​ | osd_cat -A right -p bottom -o -100 -c red -s 2 -d 1 -f -adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*'​);​
 +    // Pause one second
 +    sleep(1);
 +  }
 +
 +?>
 +</​code>​
comments powered by Disqus
linux/on_screen_display_with_xosd.txt · Last modified: 2020/06/01 22:53 (external edit)