Introduction: Reuse Unwanted Infrared Remote Control to Launch Graphical Application in Raspberry Pi

About: Systems Administrator and Software Programmer.

Introduction

This is an extension to my instructable "Shutting down and Restarting" Raspberry Pi using a remote control unit. This time, I want to launch graphical (GUI) applications such a a terminal emulator and a browser in addition to shutting down and restarting the RPI. A browser is a GUI application which means that init scripts which was used in the "Shutting down and Restarting" instructable cannot be used. Instead, we must make use of the X Session Manager of the the Desktop environment to implement our goals.

Scope

Launch Epiphany Web Browser when I press a button on a remote control unit.

Launch LXTerminal when I press a button on a remote control unit

Shutdown RPI when I press a button on a remote control unit

Restart RPI when I press a button on a remote control unit

Audience

Anyone with Raspberry Pi and Remote Control

Step 1: Add Infrared Interface and Configure Remote Control Software

Step 2: Disable the Previous Lircrc Configuration

Open terminial emulator in Raspberry Pi

$cd /etc/lirc
$mv lircrc lircrc.backup

Step 3: Create a New Lircrc Configuration File in Home Directory

Create a new lircrc configuration and save it as .lircrc in home directory

vim <strong>/home/pi/.lircrc</strong>

Enter the data like what is show in the screenshot.

Save the file.

Step 4: Configure X Session Manager to Autostart Irexec Program

Now that /etc/lirc/lircrc configuration file is disabled, the LIRC daemon will not start irexec automatically.

irexec has to be started manually after every X session login. However, we can configure X Session Manager to autostart irexec.

Open terminal emulator in Raspberry Pi.

Create a file named autostart

$vi /home/pi/.config/lxsession/LXDE/autostart

Type as shown in screenshot

Save the file

Step 5: Test

Open terminal emulator in Raspberry Pi

$sudo reboot

Once the OS is loaded, press the necessary button on the remote control unit to launch the application that you specified in .lircrc file to launch.

If results are not what we expect, it's time to debug.