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
Complete the steps in âReuse Unwanted Remote Control to Shutdown and Reboot Raspberry Piâ if you have not.
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.
For more detail: Reuse Unwanted Infrared Remote Control to Launch Graphical Application in Raspberry Pi