This project is designed to control a home theater PC (HTPC) with a pepper jobs remote control.
Find a file
2025-07-02 09:02:46 -07:00
apps add freetube 2025-06-18 10:10:22 -07:00
xml refactor 2025-06-13 16:09:14 -07:00
.gitignore better log handling 2025-06-13 16:25:23 -07:00
buttons.sh more shellcheck 2025-06-18 09:54:29 -07:00
cec.sh README 2025-06-18 13:26:52 -07:00
find_or_open.sh dont run find_or_open when sourcing 2025-07-02 09:02:46 -07:00
get_active_window.sh refactor 2025-06-13 16:09:14 -07:00
init.sh more shellcheck 2025-06-18 09:54:29 -07:00
README.md update readme 2025-06-18 19:38:40 -07:00

Overview:

This project is designed to control a home theater PC (HTPC) with a pepper jobs remote control.

The buttons on the remote control are hard coded to common windows shortcuts, depending on the desktop environment some of these will work as generic shortcuts in linux out of the box, but this project aims to expand their functionality and provide custom commands based on the application that has focus.

For example: when firefox is open to the site youtube.com, pressing the search button will type "/" to move focus to the search bar at the top of the screen and type "control+a" to select all then type "BackSpace" to clear any text in it so you can flip the remote and start typing; In kodi the same button will open a kodi search menu by executing: kodi-send --action="VideoLibrary.Search".

Another goal of this project is to simplify modifications by allowing easy customization of button actions within applications. To add a new program, simply create a new .sh file in /apps with the name returned by get_active_window.sh and define methods within this file with the commands to run when the buttons are pressed.

Parts list:

Beelink Ser5 Mini PC

Pepper Jobs Remote

Pulse eight usb-hdmi-cec-adapter



The computer could be anything, the hardware requirements are what you want to do with it.

The cec adapter is optional, but allows the computer to turn the tv on and off via software which is mapped to the power button on the remote. It is also not necessary if running on a raspberry pi since cec is built into the hardware.

OS:

I am running EndeavourOS on the computer, but this could be any linux distro with the following software installed.

Software:

required:

Xorg
xfce4
xdotool
wmctrl

optional:

libcec # for cec controls
kodi
freetube
spotify
# other apps etc...

How it works:

  1. The button combos that are hardcoded on the remote are mapped as keyboard shortcuts in xfce to run the buttons.sh script with the button name as $1 when pressed
  2. buttons.sh runs get_active_window.sh to find what program is active
  3. It then looks for this program in the scripts in the app folder and initializes it if it finds it
  4. next it will execute the method with the pressed button name if it finds it in the file it just sourced and exit
  5. If it does not find the button it will look for the button in apps/default_commands.sh and run it if it finds it

Notes:

find_or_open.sh will check running programs, if what it is looking for is running already it will give it focus, if it is not it will launch the program.

When possible I am using commands that will preform the desired actions in the specified software. If that is not possible instead I simulate key presses using xdotool to use keyboard shortcuts provided by the application.

For an example of further segementing button presses in an app, ie firefox has different methods when on youtube.com vs pbs.org, see: get_active_window.sh and apps/firefox.sh

Debug output goes to both the debug file and stdout when the buttons.sh script is run. This way troubleshooting can happen both on the command line when manually running buttons.sh and also in the debug file when testing buttons on the remote.

There is an init.sh script that will copy the xfce4 shortcuts to the .config folder as well as a kodi config file. It also disables the XF86PowerOff button in Xorg. Without this the power button caused the remote to lock up until the system was rebooted even if XF86PowerOff was set to do nothing in xfce. After this the power button can be repurposed to run the cec.sh script to turn the tv on and off.

Some buttons are left as globals:
close is alt+f4,>br? tab is tab. Additionally, in xfce config, cycle_windows_key is remapped to just tab instead of standard alt + tab, so this button can be used to cycle through open programs.

Button Names:

# if no comment the name matches the word(s) on the remote
sleep, # power
main,
notification,
search,
settings,
action_center,
file_explorer,
desktop,
refresh,
browser,
task_manager,
move_up,
play,
forward,
back,
fast_forward,
rewind,
split_up, # bottom row left
split_down, # bottom row left middle
split_left, # bottom row right middle
split_right, # bottom row right

Future Plans:

In the future I plan to migrate this project to Nixos