From 22783c949dc9dda5f84dd5cc1c4beca206222299 Mon Sep 17 00:00:00 2001 From: crschnick Date: Sun, 5 Feb 2023 18:14:25 +0000 Subject: [PATCH] Add macOS scheme handler --- .../java/io/xpipe/app/launcher/LauncherCommand.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java index 8c673cad6..55bac0acf 100644 --- a/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java +++ b/app/src/main/java/io/xpipe/app/launcher/LauncherCommand.java @@ -7,11 +7,13 @@ import io.xpipe.app.issue.BasicErrorHandler; import io.xpipe.beacon.BeaconServer; import io.xpipe.beacon.exchange.FocusExchange; import io.xpipe.beacon.exchange.OpenExchange; +import io.xpipe.core.process.OsType; import io.xpipe.core.util.XPipeDaemonMode; import io.xpipe.extension.event.ErrorEvent; import io.xpipe.extension.event.TrackEvent; import picocli.CommandLine; +import java.awt.*; import java.io.PrintWriter; import java.util.Arrays; import java.util.List; @@ -107,6 +109,14 @@ public class LauncherCommand implements Callable { checkStart(); OperationMode.switchTo(OperationMode.map(getEffectiveMode())); LauncherInput.handle(inputs); + + // URL open operations have to be handled in a special way on macOS! + if (OsType.getLocal().equals(OsType.MAC)) { + Desktop.getDesktop().setOpenURIHandler(e -> { + LauncherInput.handle(List.of(e.getURI().toString())); + }); + } + return 0; } }