# Element14 Pi-Desktop scripts for LibreELEC This gist contains the files needed to make Pi-Desktop's power butoon work in LibreELEC. Due to hardware limitations in the Pi-Desktop this button turns off the Raspberry Pi instead of opening the power menu. ## Setup 1. Install the Raspberry Pi Tools add-on - `System (settings)` -> `Add-ons` -> `Install from repozitory` -> `LibreELEC Add-ons` -> `Program add-ons` -> `Raspberry Pi Tools` -> `Install` 2. Get SSH access - `System (settings)` -> `LibreELEC` -> `Services` -> `Enable SSH` - If you don't setup a password the default is `libreelec` - Keep in mind that the default password should be changed or SSH turned off for better security. - `System (settings)` -> `LibreELEC` -> `Connections` -> `Address: aaa.bbb.c.ddd` - Get the IP address of the device by looking at the connection used 3. SSH to the device: `ssh root@aaa.bbb.c.ddd` 4. Run the install script: `curl -sSL https://opengist.stefka.eu/jiriks74/element14-libreelec/raw/HEAD/install.sh | bash` 5. The light should blink once to indicate that the power button script started successfully - It will blink once/twice on every boot to indicate that the Pi comunicates with the power supply > If the service is already running (you ran the script more than once) the ligt will not blink. > Reboot the device and watch for a blink during the boot process or restart the service using `systemctl restart pidesktop-powerkey`. ## Manual setup If you're uncomfortable running scripts from the internet you can fetch the files yourself and save them like this: ```bash /storage/scripts/pidesktop/powerkey.py /storage/.config/system.d/pidesktop-powerkey.service ``` Then you need to run 1. `systemctl daemon-reload` to load the service file 2. `systemctl enable pidesktop-powerkey` to start the service on boot 3. `systemctl start pidekstop-powerkey` to start the service now The light on the case should blink once to indicate that the script initialized successfully. > If the service is already running (you started a running pidesktop-powerkey service) the ligt will not blink. > Reboot the device and watch for a blink during the boot process or restart the service using `systemctl restart pidesktop-powerkey`. ## Usage of the Pi-Desktop button The power key can do 2 things on the Pi Desktop - When held for 2 seconds it sends a power off signal to the Pi (only once, more keypresses don't do anything) - When held for 5 seconds it cuts off power from the Pi (as if you unplugged if from wall power)