# LT_Presentation

As a teacher and lecturer, I need to give talks and presentations quite often. Usually, I write my presentations in LaTeX and use a PDF viewer like Atril (Mate Document Viewer) to display the slides.

A few months ago, I also bought a Logitech R400 wireless presenter as well as a Genius Ring Presenter and an ISY Presenter to control the presentation. This works quite well if the document viewer is the active window. However, I tend to have either a script or different other things on my Laptop's window and often lose focus. Furthermore, the power manager is not automatically set to Presentation Mode.

### The Solution

The solution is a small Python application I called lt_presentation. It offers the following features, but is very closely tied to my environment. You can, however, change a few things in the configuration file. The location is ~/.lt_presentation/config.ini and it will be created during the first start of the program.

You need the following (checked during startup):

• Logitech R400 OR Genius Ring Presenter OR ISY Presenter (device name can be changed in [devices] → presenter)
• [optional] xfce4-power-manager (can be disabled in [general] → xfce_pm_presentation_mode
• [optional] xdg-compliant power manager, such as xfce4-power-manager (can be disabled in [general] → inhibit_xdg_pm)
• [optional] Workrave (can be disabled in [general] → inhibit_workrave)
• Atril (can be changed in [programs] → pdfviewer)
• xdotool
• wmctrl
• python-evdev

The program works the following way: It sits in the system tray and presents a right-click menu with the option to start a new presentation. After selecting it, you need to select the PDF presentation to use. Then, the following happens:

• PDF Viewer is started
• The Power Manager is set to “Inhibit”
• Xfce Power Manager is set to Presentation Mode
• Workrave is suspsended
• The presenter is grabbed for exclusive access
• All button events are read from the presenter and sent directly to this, and only this, Atril window
• When Atril is closed, the presenter is released and the power management settings are restored.

This works through a series of “hacks” using wmctrl and xdotool magic. Fortunately, Atril accepts key events this way, not all applications support that. As a hack, focus is quickly switched to the presentation window, the key is sent and the focus is immediately switched back to the original application. The result is that no matter where the keyboard focus is, Atril is always able to receive the remote control messages.

It requires a udev rule to have access to the input device as a regular user. If you use a different presenter than mine, you need to change the device IDs in the udev rule file.

Feel free to hack around the code at http://www.aboehler.at/hg/lt_presentation/. A very basic Arch Linux PKGBUILD is also included which is everything you need to get it running on Arch (builds directly from the latest Mercurial version).