common

package
v0.0.0-...-71090b4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr}).With().Caller().Logger()

Functions

func Alert

func Alert(title string, text string)

func BuildUrl

func BuildUrl(u *url.URL, paths ...string) string

func CopyToClipboard

func CopyToClipboard(text string) error

func GetCache

func GetCache(slug string, name string, maxAge time.Duration) ([]byte, bool, error)

func GetData

func GetData(slug string, name string) string

func GetJson

func GetJson(u string, i interface{}) error

func GetJsonWithHeaders

func GetJsonWithHeaders(u string, i interface{}, headers map[string]string) error

func GetLastRun

func GetLastRun(slug string) string

func GetOutput

func GetOutput(slug string) (string, error)

func GetOutputFollow

func GetOutputFollow(slug string) error

func IsACConnected

func IsACConnected() bool

func ListDirectories

func ListDirectories(opath string) ([]string, error)

func ListFiles

func ListFiles(opath string) ([]string, error)

func ListFilesRecurse

func ListFilesRecurse(opath string) ([]string, error)

func Notify

func Notify(title string, text string)

func OpenEditor

func OpenEditor(fname string) error

func PasteFromClipboard

func PasteFromClipboard() (string, error)

func SaveData

func SaveData(slug string, name string, data string) error

func SaveLastRun

func SaveLastRun(slug string)

func SetCache

func SetCache(slug string, name string, data []byte) error

func Wofi

func Wofi(prompt string, items []string, args ...string) (string, int64, error)

func WofiConfirm

func WofiConfirm(prompt string) bool

func WofiInput

func WofiInput(prompt string, items []string, args ...string) (string, int64, error)

func WriteOutput

func WriteOutput(slug string, data string) error

Types

type Module

type Module interface {
	GetName() string
	GetDescription() string
	GetSlug() string
	GetWaybarOutput() (*WaybarOutput, error)
	SaveLastRun()
	GetLastRun() string
	WriteOutput() error
	Run() error
	GetRunInterval() int64
	GetRunIntervalOnBattery() int64
	RunCommand(name string, args []string) error
	IsEnabled() bool
	SuspendOnBattery() bool
}

type WaybarOutput

type WaybarOutput struct {
	Text    string `json:"text"`
	Alt     string `json:"alt,omitempty"`
	Class   string `json:"class,omitempty"`
	Tooltip string `json:"tooltip,omitempty"`
}

func (*WaybarOutput) ToJSON

func (w *WaybarOutput) ToJSON() string

Jump to

Keyboard shortcuts

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