Make the Most of Your Presentation

Note: In the meantime, there is a new program called pympress which does everything (and more) which these scripts are doing… Check it out!

I worked there scripts out for my MacBook2,1 running Ubuntu 8.04. I had presentations made with the great beamer package for LaTeX which result in a pdf-file and my aim was to see the next slide on my notebook screen during the presentation so that it is easier to remember the right transitions…

The first script will actually only turn on the external video output. I configured the xorg.conf such that it is above my notebook screen, but that doesn’t really matter. It also turns on the IR deamon so that it is possible to use the infrared remote control to switch pages. I assigned all buttons on the remote to “next”, only the “back”-button to “back” to avoid miostakes.

# get rid of spurious outputs
xrandr --output TV --off --output TMDS-1 --off
# ensure that there is (only one) irxdaemon running
irdaemon=$( ps ax | grep "irxevent" | awk '{ print $5 }' | grep "irxevent" )
if [ -z "$irdaemon" ]	# if irxevent is not running
	irxevent -d
# toggle the projector
if [ "$(xrandr -q | grep "VGA" | awk '{ print $3 }')" = "(normal" ]	# if the projector is off
	xrandr --output LVDS --auto --pos 0x0 --output VGA --auto --mode 1024x768 --pos 0x-800
	gconftool-2 --set /apps/panel/toplevels/top_panel_screen0/monitor --type integer 1
	gconftool-2 --set /apps/panel/toplevels/bottom_panel_screen0/monitor --type integer 1
	xrandr --output LVDS --auto --output VGA --off

Now this script handles the opening of the pdf-file. Due to a bug, one has to play around a bit until the right version appears on the right screen. However, this version works for me; you have to switch the main presentation into fullscreen mode by pressiong Alt+f in the xpdf window.

In the end, you have to Ctrl+c the script — I decided to not test if the xpdf sessions are still alive to keep the computer as responsive as possible (although it would most probably not matter)

#!/usr/bin/env bash
# open the master
xpdf -title sbusch_presentation_main -cmd ${DIR}/main.pdf > $FILE&
# let it gather itself
sleep 1
while true
	currentpage=`grep "page" $FILE | tail -n 1 | awk '{ print $3 }'`
	if [ "$currentpage" != "$lastpage" ]
		let previewpage=$currentpage+1
		# open or update the preview
		xpdf -fullscreen -title sbusch_presentation_preview -remote presentation ${DIR}/main.pdf $previewpage&

Leave a Reply