ui

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package ui wraps some OS-specific methods so they can be used on any architecture/OS without compile-time errors. The packages wrapped are github.com/gen2brain/dlgs and github.com/getlantern/systray. The notifiarr client application only uses these on Windows and macOS, so they are wrapped to ignore them on macOS, linux and freeBSD.

Index

Constants

View Source
const SystrayIcon = "files/favicon.png"

SystrayIcon is the icon in the system tray or task bar.

Variables

View Source
var ErrUnsupported = fmt.Errorf("unsupported OS")

ErrUnsupported is just an error.

Functions

func Entry

func Entry(title, msg, val string) (string, bool, error)

Entry wraps dlgs.Entry.

func Error

func Error(title, msg string) (bool, error)

Error wraps dlgs.Error.

func HasGUI

func HasGUI() bool

HasGUI returns false on Linux, true on Windows and optional on macOS.

func HideConsoleWindow

func HideConsoleWindow()

HideConsoleWindow doesn't work on most OSes.

func Info

func Info(title, msg string) (bool, error)

Info wraps dlgs.Info.

func Notify added in v0.1.16

func Notify(_ string, _ ...interface{}) error

func OpenCmd

func OpenCmd(cmd ...string) error

OpenCmd opens anything.

func OpenFile

func OpenFile(filePath string) error

OpenFile open Config Files.

func OpenLog

func OpenLog(logFile string) error

OpenLog opens Log Files.

func OpenURL

func OpenURL(url string) error

OpenURL opens URL Links.

func Question

func Question(title, text string, defaultCancel bool) (bool, error)

Question wraps dlgs.Question.

func ShowConsoleWindow added in v0.1.15

func ShowConsoleWindow()

ShowConsoleWindow does nothing on OSes besides Windows.

func StartCmd

func StartCmd(c string, v ...string) error

StartCmd starts a command.

func Warning

func Warning(title, msg string) (bool, error)

Warning wraps dlgs.Warning.

Types

type MenuItem interface {
	Check()
	Checked() bool
	Disable()
	Disabled() bool
	Enable()
	Hide()
	SetIcon(iconBytes []byte)
	SetTemplateIcon(templateIconBytes []byte, regularIconBytes []byte)
	SetTitle(title string)
	SetTooltip(tooltip string)
	Show()
	String() string
	Uncheck()
	Clicked() chan struct{}
}

MenuItem is an interface to allow exposing menu items to operating systems that do not have a menu or a GUI.

Jump to

Keyboard shortcuts

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