diff --git a/docs/source/about/installation.rst b/docs/source/about/installation.rst
index 9f65ba59..c661af3e 100644
--- a/docs/source/about/installation.rst
+++ b/docs/source/about/installation.rst
@@ -104,17 +104,24 @@ Flatpak Package
:alt: GitHub issues by-label
#. Install `Flatpak `_ as required.
-#. Download ``sunshine.flatpak`` and run the following code.
+#. Download ``sunshine_{arch}.flatpak`` and run the following code.
+
+ .. Note:: Be sure to replace ``{arch}`` with the architecture for your operating system.
System level (recommended)
.. code-block:: bash
- flatpak install --system sunshine.flatpak
+ flatpak install --system ./sunshine_{arch}.flatpak
User level
.. code-block:: bash
- flatpak install --user sunshine.flatpak
+ flatpak install --user ./sunshine_{arch}.flatpak
+
+ Additional installation (required)
+ .. code-block:: bash
+
+ flatpak run --command=additional-install.sh dev.lizardbyte.sunshine
Start:
X11 and NVFBC capture (X11 Only)
@@ -130,7 +137,8 @@ Start:
Uninstall:
.. code-block:: bash
- flatpak uninstall --delete-data sunshine.flatpak
+ flatpak run --command=remove-additional-install.sh dev.lizardbyte.sunshine
+ flatpak uninstall --delete-data dev.lizardbyte.sunshine
RPM Package
^^^^^^^^^^^
diff --git a/docs/source/about/usage.rst b/docs/source/about/usage.rst
index 81cfcdcd..7d59b715 100644
--- a/docs/source/about/usage.rst
+++ b/docs/source/about/usage.rst
@@ -54,8 +54,7 @@ Setup
Linux
^^^^^
-The `deb`, `rpm`, and `AppImage` packages handle these steps automatically. The flatpak does not, third party packages
-also may not.
+The `deb`, `rpm`, `Flatpak` and `AppImage` packages handle these steps automatically. Third party packages may not.
Sunshine needs access to `uinput` to create mouse and gamepad events.
@@ -81,6 +80,8 @@ Sunshine needs access to `uinput` to create mouse and gamepad events.
[Service]
ExecStart=
+ #Flatpak Only
+ #ExecStop=flatpak kill dev.lizardbyte.sunshine
[Install]
WantedBy=graphical-session.target
@@ -95,7 +96,7 @@ Sunshine needs access to `uinput` to create mouse and gamepad events.
deb /usr/bin/sunshine ✔
rpm /usr/bin/sunshine ✔
AppImage ~/sunshine.AppImage ✔
- Flatpak flatpak run dev.lizardbyte.sunshine ✖
+ Flatpak flatpak run dev.lizardbyte.sunshine ✔
======== ============================================== ===============
**Start once**
diff --git a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml
index 7bb4cd1b..675fde24 100644
--- a/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml
+++ b/packaging/linux/flatpak/dev.lizardbyte.sunshine.yml
@@ -208,3 +208,7 @@ modules:
- sed -r -z -i -e
's/("((do)|(undo)|(cmd)|(detached))"\s*:\s*\[?\n*\s*")(.*")/\1flatpak-spawn --host \7/gm'
/app/share/sunshine/apps.json
+ - sed -i
+ 's%/app/bin/sunshine%flatpak run dev.lizardbyte.sunshine\nExecStop=flatpak kill dev.lizardbyte.sunshine%g'
+ /app/share/sunshine/systemd/user/sunshine.service
+ - install -D $FLATPAK_BUILDER_BUILDDIR/packaging/linux/flatpak/scripts/* /app/bin
diff --git a/packaging/linux/flatpak/scripts/additional-install.sh b/packaging/linux/flatpak/scripts/additional-install.sh
new file mode 100644
index 00000000..43615144
--- /dev/null
+++ b/packaging/linux/flatpak/scripts/additional-install.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# User Service
+mkdir -p ~/.config/systemd/user
+cp /app/share/sunshine/systemd/user/sunshine.service $HOME/.config/systemd/user/sunshine.service
+echo Sunshine User Service has been installed.
+echo Use [systemctl --user enable sunshine] once to autostart Sunshine on login.
+
+# Udev rule and input group
+UDEV=$(cat /app/share/sunshine/udev/rules.d/85-sunshine.rules)
+echo Configuring mouse permission.
+flatpak-spawn --host pkexec sh -c "usermod -a -G input $USER && echo '$UDEV' > /etc/udev/rules.d/85-sunshine.rules"
+echo Restart computer for mouse permission to take effect.
diff --git a/packaging/linux/flatpak/scripts/remove-additional-install.sh b/packaging/linux/flatpak/scripts/remove-additional-install.sh
new file mode 100644
index 00000000..74cb9505
--- /dev/null
+++ b/packaging/linux/flatpak/scripts/remove-additional-install.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# User Service
+systemctl --user stop sunshine
+rm $HOME/.config/systemd/user/sunshine.service
+systemctl --user daemon-reload
+echo Sunshine User Service has been removed.
+
+# Udev rule and input group
+flatpak-spawn --host pkexec sh -c "gpasswd -d $USER input && rm /etc/udev/rules.d/85-sunshine.rules"
+echo Mouse permission removed. Restart computer to take effect.