Skip to content

Commit

Permalink
Add remux-api script
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Dec 20, 2023
1 parent 7ed8e6c commit 0b1ba79
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/remux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ FILES=launcher.cpy
CPP_FLAGS+=-Wno-psabi
install:
make copy
make install_api
make install_service

install_service:
scp ./remux.service root@${HOST}:/etc/systemd/system/

install_api:
scp ./remux-api root@${HOST}:${DEST}/

start_service:
ssh root@${HOST} systemctl enable --now remux
66 changes: 66 additions & 0 deletions src/remux/remux-api
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

help() {
echo "Usage: remux-api <command>"
echo ""
echo " Commands:"
echo " --help | help: Show this message and exit"
echo " list-paused: List all paused apps"
echo " list-apps: List all installed apps"
echo " current-app: Output name of current app"
echo " show: Show the remux UI"
echo " hide: Hide the remux UI"
echo " suspend: Suspend the device"
echo " launch [name]: Launch an app"
echo " pause [name]: Pause an app if it's the current app"
echo " stop [name]: Stop an app"
}

case "$1" in
list-paused | list-apps | current-app | show | hide | suspend)
if [ $# -ne 1 ]; then
help
exit 1
fi
case "$1" in
list-paused)
remux --paused-apps 2>/dev/null
;;
list-apps)
remux --all-apps 2>/dev/null
;;
current-app)
remux --current-app 2>/dev/null
;;
show)
echo "show" > /run/remux.api
;;
hide)
echo "hide" > /run/remux.api
;;
suspend)
echo "suspend" > /run/remux.api
;;
esac
;;
launch | pause | stop)
if [ $# -ne 2 ]; then
help
exit 1
fi
case "$1" in
launch)
echo "launch $2" > /run/remux.api
;;
pause)
echo "pause $2" > /run/remux.api
;;
stop)
echo "stop $2" > /run/remux.api
;;
esac
;;
* | help | --help)
help
;;
esac

0 comments on commit 0b1ba79

Please sign in to comment.