diff --git a/README.md b/README.md index 5279371..5f16e58 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,23 @@ Got a question about development or a feature request? [Join our Discord!](https ## Installing -### Stable +### Flatpak via Flathub + +Visit our [Flathub page](https://flathub.org/apps/details/io.github.trigg.discover_overlay) or install via commandline + +```bash +flatpak install io.github.trigg.discover_overlay ``` + + + +### Stable +```bash python3 -m pip install discover-overlay ``` ### Latest Testing -``` +```bash git clone https://github.com/trigg/Discover.git cd Discover python3 -m pip install . @@ -76,6 +86,17 @@ Run `discover-overlay` if this fails it is most likely in `~/.local/bin/discover Comes with sane-enough default but has a configuration screen to tweak to your own use. Configuration can be reached either via System tray or by running `discover-overlay --configure` +## Usage in Flatpak + +Due to a security feature of Flatpak we cannot currently detect an already-running process. Any call to `io.github.trigg.discover_overlay` will start a new overlay unless you also include `--rpc`. + +Examples: +1) Start a new overlay and show configuration window +`io.github.trigg.discover_overlay --configure` + +2) Show configuration window of already running overlay +`io.github.trigg.discover_overlay --rpc --configure` + ### Debugging If you are trying to debug on VS Code you are likely to get the following message: ``` diff --git a/discover_overlay/discover_overlay.py b/discover_overlay/discover_overlay.py index 3103bc3..5abdaed 100755 --- a/discover_overlay/discover_overlay.py +++ b/discover_overlay/discover_overlay.py @@ -88,8 +88,7 @@ class Discover: print(" -h, --help This screen") print(" --hide Hide overlay") print(" --show Show overlay") - print( - " --nolock Do not use Lock or RPC. Helps for running in unpriviledged container") + print(" --rpc Send command, not start new instance. Only needed if running in flatpak") print("") print("For gamescope compatibility ensure ENV has 'GDK_BACKEND=x11'") if normal_close: @@ -262,11 +261,23 @@ def entrypoint(): pid_file = os.path.join(config_dir, "discover_overlay.pid") rpc_file = os.path.join(config_dir, "discover_overlay.rpc") debug_file = os.path.join(config_dir, "output.txt") - if "--nolock" in sys.argv: - logging.getLogger().setLevel(logging.INFO) - logging.info("Nolock mode chosen") - Discover(rpc_file, debug_file, line) + + + # Flatpak compat mode + + if "container" in os.environ and os.environ["container"] == "flatpak": + if "--rpc" in sys.argv: + with open(rpc_file, "w") as tfile: + tfile.write(line) + logging.warning("Sent RPC command") + else: + logging.getLogger().setLevel(logging.INFO) + logging.info("Flatpak compat mode started") + Discover(rpc_file, debug_file, line) return + + # Normal usage + try: with pidfile.PIDFile(pid_file): logging.getLogger().setLevel(logging.INFO)