Documentation
¶
Overview ¶
Package platform holds what giode's platform packages share: the errors the root package re-exports. Each feature's per-platform code lives in a package under it (internal/platform/sound, .../tray...), and the root package keeps the public API.
Index ¶
- Variables
- func CopyFile(src, dst string) error
- func MIMEType(ext string) string
- func NotLinked(pkg string) error
- func OnAndroidMain(ctx context.Context, h Host, fn func(view uintptr) error) error
- func OnMainThread() bool
- func PortalParent(h Host) string
- func SanitizeFileName(s string) string
- func UniquePath(path string) string
- type Host
- type Level
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotSupported is giode.ErrNotSupported. ErrNotSupported = host.ErrNotSupported // ErrCanceled is giode.ErrCanceled. ErrCanceled = errors.New("giode: canceled by the user") // ErrDeclined is giode.ErrDeclined. ErrDeclined = errors.New("giode: the user declined") // ErrNotificationsOff is giode.ErrNotificationsOff. ErrNotificationsOff = errors.New("giode: notifications are turned off for this app") // ErrNotFound is giode.ErrNotFound. ErrNotFound = errors.New("giode: not found") )
var KnownTypes = map[string]string{
".md": "text/markdown; charset=utf-8",
".markdown": "text/markdown; charset=utf-8",
".txt": "text/plain; charset=utf-8",
".csv": "text/csv; charset=utf-8",
".heic": "image/heic",
".heif": "image/heif",
".mp3": "audio/mpeg",
".wav": "audio/wav",
".m4a": "audio/mp4",
".ogg": "audio/ogg",
".flac": "audio/flac",
".mp4": "video/mp4",
".mov": "video/quicktime",
".zip": "application/zip",
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
".xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
".pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
}
KnownTypes covers common files Go's built-in MIME table lacks; the system table that fills the gap on Linux isn't there on Windows or the phones.
Functions ¶
func NotLinked ¶
NotLinked is the error of a feature whose opt-in package (see internal/optin) the app doesn't import.
func OnAndroidMain ¶
OnAndroidMain runs fn with the GioView on the Android main thread and waits for it, or for ctx.
func OnMainThread ¶
func OnMainThread() bool
OnMainThread reports false: only Apple platforms need the hops.
func PortalParent ¶
PortalParent is the window the XDG desktop portal's dialogs belong to: "x11:<id>" for an X11 window, "" otherwise (or without a host).
func SanitizeFileName ¶
SanitizeFileName replaces the characters file systems reject.
func UniquePath ¶
UniquePath adds " (2)", " (3)" ... before the extension until path is free.
Types ¶
type Host ¶
type Host interface {
// NativeHandle is the window's native handle (giode.App.NativeHandle):
// an HWND, an NSView, a GioView..., or 0 before the window exists.
NativeHandle() uintptr
// NativeView is the window's view event (giode.App.NativeView), or
// nil.
NativeView() app.ViewEvent
// Window is the app's Gio window.
Window() *app.Window
// Post runs f on the UI goroutine.
Post(f func())
// RunOnWindow runs f on the window's own thread (Gio's Window.Run)
// and waits for it.
RunOnWindow(f func())
// Logf logs through the app's Logger.
Logf(level Level, format string, args ...any)
// Title is the app's title.
Title() string
}
Host is what platform code needs of the app: its window and its UI goroutine. The root package implements it for giode.App.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package a11y exposes the UI's semantic tree to the platform's accessibility services: UI Automation, AT-SPI, NSAccessibility and UIAccessibility, and Android's AccessibilityNodeProvider.
|
Package a11y exposes the UI's semantic tree to the platform's accessibility services: UI Automation, AT-SPI, NSAccessibility and UIAccessibility, and Android's AccessibilityNodeProvider. |
|
Package clipimage reads images from the system clipboard.
|
Package clipimage reads images from the system clipboard. |
|
Package ctxmenu installs the app's actions in file managers' context menus: Explorer, Finder's Services, Nautilus, Dolphin, Caja and Nemo.
|
Package ctxmenu installs the app's actions in file managers' context menus: Explorer, Finder's Services, Nautilus, Dolphin, Caja and Nemo. |
|
Package dirs finds the user's folders: Downloads, Pictures.
|
Package dirs finds the user's folders: Downloads, Pictures. |
|
Package filedrag carries file drags between the app's window and the system: files dragged in from the file manager, and Draggable.Export dragging out.
|
Package filedrag carries file drags between the app's window and the system: files dragged in from the file manager, and Draggable.Export dragging out. |
|
Package giopatch connects giode to the Gio patches the giode CLI builds with (the giode_gio* build tags): the window's first color, the keyboard's return key, AutoFill hints.
|
Package giopatch connects giode to the Gio patches the giode CLI builds with (the giode_gio* build tags): the window's first color, the keyboard's return key, AutoFill hints. |
|
Package gl finds OpenGL functions and reads framebuffers, for Config.Underlay.
|
Package gl finds OpenGL functions and reads framebuffers, for Config.Underlay. |
|
Package lifecycle reports the app going to the background and coming back, where the system rather than the window says so.
|
Package lifecycle reports the app going to the background and coming back, where the system rather than the window says so. |
|
Package login registers the app to start when the user signs in.
|
Package login registers the app to start when the user signs in. |
|
Package menubar installs the macOS menu bar.
|
Package menubar installs the macOS menu bar. |
|
Package notify shows simple notifications.
|
Package notify shows simple notifications. |
|
Package picker shows the system's pickers: files, folders, photos and media.
|
Package picker shows the system's pickers: files, folders, photos and media. |
|
Package power reports the computer going to sleep and waking.
|
Package power reports the computer going to sleep and waking. |
|
Package prefs reads the user's system preferences: dark mode, reduced motion, contrast, bold text and text size.
|
Package prefs reads the user's system preferences: dark mode, reduced motion, contrast, bold text and text size. |
|
Package sandbox has what the macOS App Sandbox needs: the APIs it allows for opening files and URLs and for login items, and bookmarks keeping access to folders the user chose.
|
Package sandbox has what the macOS App Sandbox needs: the APIs it allows for opening files and URLs and for login items, and bookmarks keeping access to folders the user chose. |
|
Package sharetarget receives what other apps share with this one.
|
Package sharetarget receives what other apps share with this one. |
|
Package shell opens files, folders and URLs in the system's apps.
|
Package shell opens files, folders and URLs in the system's apps. |
|
Package signin runs the platform's sign-in sheets and passkey prompts.
|
Package signin runs the platform's sign-in sheets and passkey prompts. |
|
Package sound plays short WAV sounds on each platform, for giode.App.PlaySound.
|
Package sound plays short WAV sounds on each platform, for giode.App.PlaySound. |
|
Package speech transcribes the microphone with the platform's speech recognizer.
|
Package speech transcribes the microphone with the platform's speech recognizer. |
|
Package systray shows the app's icon and menu in the system tray (the notification area, the macOS menu bar, a StatusNotifierItem).
|
Package systray shows the app's icon and menu in the system tray (the notification area, the macOS menu bar, a StatusNotifierItem). |
|
Package window places the app's window and sets its native chrome: position and screen, always on top, transparency and title bar buttons.
|
Package window places the app's window and sets its native chrome: position and screen, always on top, transparency and title bar buttons. |