Streaming KDE Desktop to Trimui Smart Pro with Sunshine: A Quick Setup Guide
By daft_dutch
Streaming KDE Desktop to Trimui Smart Pro with Sunshine
As a Linux enthusiast, and owner of a Trimu Smart Pro I wanted to stream my KDE desktop to my Trimui Smart Pro for remote play. I found out im totally alone in getting it done because of lacking documentation Here’s my complete setup using Sunshine as the streaming server to a kde desktop.
The Setup
The goal was simple: stream my KDE desktop to the Trimui Smart Pro, but with proper controller support, an on-screen keyboard for text input, and a clean way to exit applications.
You have KDE Linux a Trimui Smart pro or comparable. and a connection to your desktop using moonlight.
setup sunshine to be a user systemd service systemctl --user restart sunshine is used.
- Create the following scripts in the right place
- make short keys for the onboard script. and close sunshine.
- map antimicrox to your mouse your keyboard and the onboard and sunsine close button
- set kde-unlock-listener.sh as a auto starting script when starting kde.
start using app. Home assistant or kodi or what ever.
The Script Arsenal
I created several Bash scripts to manage different aspects of the experience:
1. Sunshine Lifecycle Management
sunshine_start.sh - Starts applications and watches for the stop signal:
Detached Command
#!/bin/bash
# sunshine_start.sh [optional_command [args...]]
# Starts an optional app, or only watcher.
PID_FILE="/tmp/start_script.pid"
if [ "$#" -ge 1 ]; then
COMMAND="$1"
shift
ARGS=("$@")
"$COMMAND" "${ARGS[@]}" &
CMD_PID=$!
echo $CMD_PID > "$PID_FILE"
wait $CMD_PID
else
echo stopsunshine > "$PID_FILE"
fi
**sunshine_stop.sh ** - Stops applications and restarts Sunshine when needed:
short cut
PID_FILE="/tmp/start_script.pid"
if [ ! -f "$PID_FILE" ]; then
echo "No PID Found, Restart Sunshine..."
else
CONTENT=$(cat "$PID_FILE")
if [ "$CONTENT" = "stopsunshine" ]; then
systemctl --user restart sunshine
else
kill "$CONTENT" 2>/dev/null
fi
rm -f "$PID_FILE"
fi
2. On-Screen Keyboard Toggle
onboard.sh - Toggles Onboard keyboard with custom sizing:
short cut
# toggle_onboard.sh
# Toggles Onboard on or off, with larger size
if pgrep -x "onboard" > /dev/null; then
# If running, kill it
pkill -x "onboard"
else
# If not running, start it with custom size
onboard&
fi
3. Controller Management
joystick_on.sh - Starts antimicrox for controller mapping:
Do Command
# Check if antimicrox is running, and start it if not
if ! pgrep -x "antimicrox" > /dev/null; then
/usr/bin/antimicrox --hidden &
fi
joystick_off.sh - Stops antimicrox:
Undo Command
# Stop antimicrox if running
if pgrep -x "antimicrox" > /dev/null; then
pkill -x "antimicrox"
fi
4. KDE Session Unlocking
unlock-kde.sh - Triggers KDE session unlock:
Detached process
/bin/echo 1 > /tmp/kde-unlock.trigger
kde-unlock-listener.sh - Listens for unlock triggers:
auto started kde script
# Path to trigger file
FLAG="/tmp/kde-unlock.trigger"
# Make sure trigger file exists and has proper permissions
touch "$FLAG"
chmod 660 "$FLAG"
while true; do
# Check if trigger file contains "1"
if [ -f "$FLAG" ] && [ "$(cat "$FLAG")" == "1" ]; then
loginctl unlock-session
# Reset trigger
echo "0" > "$FLAG"
fi
sleep 1
done