Documentation
¶
Overview ¶
Command macos-open shows what the system asks the app to open (step 56.1): the links of a URL scheme the app handles and the files of a type it opens, which macOS sends to the app as events and not as arguments (ui.OpenRequest, PlatformDispatcher.AddOpenRequestListener). The window lists them, with the arguments of the program, which is where the other systems put them.
The app must be a bundle whose Info.plist names the scheme and the file type, so build it with glutter-macos:
go run ./cmd/glutter-macos build -o /tmp/Open.app -name Open -url-scheme glutter-open \
-doc-type "Glutter open test=glutteropen" ./examples/dev/macos-open
open /tmp/Open.app # registers the bundle with Launch Services and starts it
open "glutter-open://hello?x=1" # the link reaches the running app
touch /tmp/a.glutteropen && open /tmp/a.glutteropen # so does the file, also when the app is not running
Environment, in debug builds (-debug): GLUTTER_DEV_OPEN_LOG=<file> appends a line to the file for the start ("ready <pid>"), for each URL ("url <url>") and for each file ("file <path>"), which the test of the step reads.