shell

package
v1.0.31-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package shell opens files, folders and URLs in the system's apps.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoShareSheet = errors.New("giode: no share sheet")

ErrNoShareSheet is ShareText's answer on a desktop without a share sheet: the caller copies the text to the clipboard instead.

Functions

func OpenDownloads

func OpenDownloads(ctx context.Context, h platform.Host, folder string) error

OpenDownloads opens Downloads/<folder>, or Downloads.

func OpenFolder

func OpenFolder(ctx context.Context, h platform.Host, path string) error

OpenFolder opens a folder in Explorer, Finder or the file manager.

func OpenURL

func OpenURL(ctx context.Context, h platform.Host, u string) error

OpenURL opens u with open (NSWorkspace), xdg-open or the URL handler.

func OpenWith

func OpenWith(ctx context.Context, h platform.Host, path, mime string) error

OpenWith asks the XDG desktop portal's OpenURI to open the file, as Flatpak and Snap apps must and desktops otherwise do: its default app, or the portal's app chooser. Without a portal it runs xdg-open.

func Reveal

func Reveal(path string) error

Reveal asks the file manager to show path selected, through the freedesktop FileManager1 D-Bus interface, and falls back to opening its folder with xdg-open.

func SaveToDownloads

func SaveToDownloads(ctx context.Context, path, mime, folder string) (string, error)

SaveToDownloads copies the file into Downloads/<folder>.

func ShareFiles

func ShareFiles(ctx context.Context, h platform.Host, files []File, mime, title string) error

ShareFiles opens the share sheet for the first file, else shows it in the file manager.

func ShareText

func ShareText(ctx context.Context, h platform.Host, text, subject, title string) error

ShareText opens the share sheet, or returns ErrNoShareSheet.

Types

type File

type File struct {
	Path, MIME string
}

File is a file to share and its MIME type.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL