Make sure we setup autostart as well

This commit is contained in:
David Heinemeier Hansson
2026-05-15 17:03:39 +02:00
parent 2d5e3cefe0
commit 612dead716
2 changed files with 23 additions and 0 deletions
+14
View File
@@ -14,6 +14,8 @@ SUNSHINE_ADMIN_URL="https://localhost:47990"
SUNSHINE_ICON_SOURCE="/usr/share/sunshine/web/images/logo-sunshine-45.png" SUNSHINE_ICON_SOURCE="/usr/share/sunshine/web/images/logo-sunshine-45.png"
SUNSHINE_ICON_NAME="Sunshine Admin.png" SUNSHINE_ICON_NAME="Sunshine Admin.png"
WEBAPP_ICON_DIR="$HOME/.local/share/applications/icons" WEBAPP_ICON_DIR="$HOME/.local/share/applications/icons"
HYPR_AUTOSTART_FILE="$HOME/.config/hypr/autostart.lua"
HYPR_AUTOSTART_ENTRY='o.launch_on_start("sunshine")'
open_ufw_port_for_private_lans() { open_ufw_port_for_private_lans() {
local proto="$1" local proto="$1"
@@ -62,6 +64,15 @@ install_admin_webapp() {
omarchy-restart-walker omarchy-restart-walker
} }
enable_hyprland_autostart() {
mkdir -p "$(dirname "$HYPR_AUTOSTART_FILE")"
touch "$HYPR_AUTOSTART_FILE"
if ! grep -Fxq "$HYPR_AUTOSTART_ENTRY" "$HYPR_AUTOSTART_FILE"; then
printf '\n%s\n' "$HYPR_AUTOSTART_ENTRY" >>"$HYPR_AUTOSTART_FILE"
fi
}
echo "Installing Sunshine..." echo "Installing Sunshine..."
omarchy-pkg-add sunshine omarchy-pkg-add sunshine
systemctl --user enable --now sunshine systemctl --user enable --now sunshine
@@ -73,5 +84,8 @@ echo "Installing Sunshine admin web app..."
install_admin_webapp install_admin_webapp
omarchy-launch-webapp "$SUNSHINE_ADMIN_URL" >/dev/null 2>&1 & omarchy-launch-webapp "$SUNSHINE_ADMIN_URL" >/dev/null 2>&1 &
echo "Enabling Sunshine autostart..."
enable_hyprland_autostart
echo "" echo ""
echo "Sunshine has been installed and its Moonlight streaming ports are open for private LANs and Tailscale." echo "Sunshine has been installed and its Moonlight streaming ports are open for private LANs and Tailscale."
+9
View File
@@ -9,6 +9,8 @@ TCP_PORTS=(47984 47989 48010)
UDP_PORTS=(5353 47998 47999 48000 48002 48010) UDP_PORTS=(5353 47998 47999 48000 48002 48010)
PRIVATE_CIDRS=(10.0.0.0/8 172.16.0.0/12 192.168.0.0/16) PRIVATE_CIDRS=(10.0.0.0/8 172.16.0.0/12 192.168.0.0/16)
SUNSHINE_ADMIN_APP="Sunshine Admin" SUNSHINE_ADMIN_APP="Sunshine Admin"
HYPR_AUTOSTART_FILE="$HOME/.config/hypr/autostart.lua"
HYPR_AUTOSTART_ENTRY='o.launch_on_start("sunshine")'
delete_ufw_rule() { delete_ufw_rule() {
sudo ufw --force delete "$@" 2>/dev/null || true sudo ufw --force delete "$@" 2>/dev/null || true
@@ -51,9 +53,16 @@ close_ufw_ports() {
sudo ufw reload sudo ufw reload
} }
disable_hyprland_autostart() {
if [[ -f $HYPR_AUTOSTART_FILE ]]; then
sed -i "\|^$HYPR_AUTOSTART_ENTRY$|d" "$HYPR_AUTOSTART_FILE"
fi
}
systemctl --user disable --now sunshine 2>/dev/null || true systemctl --user disable --now sunshine 2>/dev/null || true
omarchy-pkg-drop sunshine omarchy-pkg-drop sunshine
omarchy-webapp-remove "$SUNSHINE_ADMIN_APP" 2>/dev/null || true omarchy-webapp-remove "$SUNSHINE_ADMIN_APP" 2>/dev/null || true
disable_hyprland_autostart
close_ufw_ports close_ufw_ports
echo "" echo ""