From 1bc08bcfe408c28627d5899be0ef6c0c01ce6b97 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 6 Jun 2024 22:38:51 -0400 Subject: [PATCH] Add ApplicationURLOpener interface Eventually we can have nasin parse cli args and figure out what files to open, instructing the application to open those files. We will also be able to have nasin connect to dbus using the application ID and open files in an already running instance of the application. --- application.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/application.go b/application.go index b8f9322..a7367b0 100644 --- a/application.go +++ b/application.go @@ -3,6 +3,7 @@ package nasin import "log" import "image" import "strings" +import "net/url" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/nasin/internal/registrar" @@ -15,6 +16,20 @@ type Application interface { Init () error } +// ApplicationURLOpener is an application that can open a URL. +type ApplicationURLOpener interface { + Application + + // OpenURL opens a new window with the contents of the given URL. If the + // given URL is unsupported, it returns an error (for example, an image + // viewer is not expected to open a text file). If the URL scheme is + // empty, file:// is assumed. + // + // Applications should support the file:// scheme at the very least, and + // should also support others like http:// and https:// if possible. + OpenURL (*url.URL) error +} + // ApplicationDescription describes the name and type of an application. type ApplicationDescription struct { // The name of the application.