update readme
This commit is contained in:
parent
cfbdca17d8
commit
61b06082d0
1 changed files with 59 additions and 56 deletions
115
README.md
115
README.md
|
@ -1,91 +1,94 @@
|
|||
|
||||
## Overview:
|
||||
This is a project I made to control a home theater PC (HTPC) with a pepper jobs remote control with customized commands on the buttons on a per-app basis using bash scripts.
|
||||
This project is designed to control a home theater PC (HTPC) with a pepper jobs remote control.
|
||||
|
||||
The pepper jobs remote buttons are mapped to common windows shortcuts. Depending on your desktop environment some of these will work as generic shortcuts in linux out of the box, but my goal was to make the buttons behave differently depending on which app is active.
|
||||
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".
|
||||
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:
|
||||

|
||||
Beelink Ser5 Mini PC
|
||||
|
||||
[Pepper Jobs Remote](https://www.pepper-jobs.com/products/w10-gyro-smart-remote)
|
||||

|
||||
<img src="https://kagi.com/proxy/Beelink-SER5.jpg?c=Sry64v3AQdbrqAk1MK4X_IpvYWn_9QPQIHyBL3hdg54PbzBSdWDk3bhAaEiq5NccxPtgmHKAh0Wl7bXyQ9OoBWb-qtRbj6TyTVJ4gtlogBgnigcspYPiYT6yA6ZJZ8PdXo3RkxoGm4TmahnNk3LK8w%3D%3D" width="500px">
|
||||
|
||||
[Pulse eight usb-hdmi-cec-adapter](https://www.pulse-eight.com/p/104/usb-hdmi-cec-adapter)
|
||||

|
||||
<a target="_blank" rel="noopener noreferrer" href="https://www.pepper-jobs.com/products/w10-gyro-smart-remote">Pepper Jobs Remote</a>
|
||||
|
||||
<img src="https://www.pepper-jobs.com/cdn/shop/files/img_01_03ca82de-33a6-4ec7-b523-a32e7a952a0e_540x.jpg?v=1614291123" width="500px">
|
||||
|
||||
<a target="_blank" rel="noopener noreferrer" href="https://www.pulse-eight.com/p/104/usb-hdmi-cec-adapter">Pulse eight usb-hdmi-cec-adapter</a>
|
||||
|
||||
<img src="https://www.pulse-eight.com/generated-assets/products/0000381.jpeg" width="500px"><br><br>
|
||||
|
||||
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.
|
||||
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
|
||||
Xorg<br>
|
||||
xfce4<br>
|
||||
xdotool<br>
|
||||
wmctrl<br>
|
||||
|
||||
#### optional:
|
||||
libcec # for cec controls
|
||||
kodi
|
||||
freetube
|
||||
spotify
|
||||
\# other apps etc...
|
||||
libcec # for cec controls<br>
|
||||
kodi<br>
|
||||
freetube<br>
|
||||
spotify<br>
|
||||
\# other apps etc...<br>
|
||||
|
||||
|
||||
### How it works:
|
||||
1. The button shortcuts are mapped in xfce to run the buttons.sh script 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 inits it if it finds it.
|
||||
4. After that it will look for the button that was pressed in the app script that was just loaded
|
||||
5. If it finds that button in the app script it will run the code in the method
|
||||
6. If it does not find the button in there it will look for the button in apps/default_commands.sh and run it if it finds it.
|
||||
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:
|
||||
My goal with this project was to make it as easy as possible to hop in and modify how any button works in any program. In order to add a new program you make a new sh file file in /apps with the name returned by get_active_window.sh. In that file make a method with the programed name (see list below) of any button that you want to remap with the code you want to run.
|
||||
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
|
||||
|
||||
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 will use 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.
|
||||
|
||||
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.
|
||||
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, ie, close is alt+f4, tab is left and 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.
|
||||
Some buttons are left as globals:<br>
|
||||
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 these name correspond to the words 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
|
||||
\# if no comment the name matches the word(s) on the remote<br>
|
||||
sleep, # power<br>
|
||||
main,<br>
|
||||
notification,<br>
|
||||
search,<br>
|
||||
settings,<br>
|
||||
action_center,<br>
|
||||
file_explorer,<br>
|
||||
desktop,<br>
|
||||
refresh,<br>
|
||||
browser,<br>
|
||||
task_manager,<br>
|
||||
move_up,<br>
|
||||
play,<br>
|
||||
forward,<br>
|
||||
back,<br>
|
||||
fast_forward,<br>
|
||||
rewind,<br>
|
||||
split_up, # bottom row left<br>
|
||||
split_down, # bottom row left middle<br>
|
||||
split_left, # bottom row right middle<br>
|
||||
split_right, # bottom row right<br>
|
||||
|
||||
#### Future Plans:
|
||||
In the future I plan to migrate this project to Nixos
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue