config

package
v0.0.0-...-d2d4a4d Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoCommand          = errors.New("no command defined")
	ErrInvalidCommandType = errors.New("invalid command type")
)
View Source
var Default = &Config{
	Backlight: DefaultBacklight,
	Player:    DefaultPlayer,
	Volume:    DefaultVolume,
	SwayNodes: DefaultSwayNodes,
	CoreMessages: NotificationSectionMessage{
		Enabled: &trueValue,
		Timeout: 3 * time.Second,
	},
}
View Source
var DefaultBacklight = &Backlight{
	DeviceName:      "",
	MinimumPercent:  0.5,
	StepSizePercent: 5,
	PollInterval:    500 * time.Millisecond,
	Notification: NotificationSectionPercent{
		Enabled: &trueValue,
		Timeout: 2 * time.Second,
		Format0: " -",
		Formats: []string{
			"  {value} %",
			"  {value} %",
			"  {value} %",
		},
	},
}
View Source
var DefaultPlayer = &Player{
	PlayerName: "spotify",
	Start: Command{
		Type:    CommandTypeShell,
		Command: "/usr/bin/spotify",
	},
	Show: Command{
		Type:    CommandTypeSway,
		Command: "[instance=spotify] move workspace current, focus",
	},
}
View Source
var DefaultSwayNodes = &SwayNodes{
	EmptyWorkspaceName: " ",
	HideInsteadOfClose: []WindowIdentification{
		{
			Type:    WindowMatchInstance,
			Partial: false,
			Match:   "spotify",
		},
	},
}
View Source
var DefaultVolume = &Volume{
	Server:   "",
	SinkName: "@DEFAULT_SINK@",
	StepSize: 5,
	Notification: NotificationSectionPercent{
		Enabled:        &trueValue,
		Timeout:        2 * time.Second,
		FormatDisabled: "",
		Format0:        " {value} %",
		Formats: []string{
			" {value} %",
			" {value} %",
		},
	},
}

Functions

This section is empty.

Types

type Backlight

type Backlight struct {
	DeviceName      string                     `yaml:"device_name"`
	MinimumPercent  float64                    `yaml:"minimum"`
	StepSizePercent float64                    `yaml:"step_size"`
	PollInterval    time.Duration              `yaml:"poll_interval"`
	Notification    NotificationSectionPercent `yaml:"notification"`
	// contains filtered or unexported fields
}

func (*Backlight) ListenReload

func (c *Backlight) ListenReload(cb func(T)) func()

func (*Backlight) UnlistenReload

func (c *Backlight) UnlistenReload(ch chan T)

type Command

type Command struct {
	Type    CommandType `yaml:"cmd_type"`
	Command string      `yaml:"command"`
}

func (Command) Run

func (c Command) Run(s *sway.Client) error

type CommandType

type CommandType string
const (
	CommandTypeShell CommandType = "shell"
	CommandTypeSway  CommandType = "sway"
)

type Config

type Config struct {
	Backlight *Backlight `yaml:"backlight"`
	Player    *Player    `yaml:"player"`
	Volume    *Volume    `yaml:"volume"`
	SwayNodes *SwayNodes `yaml:"sway"`

	CoreMessages NotificationSectionMessage `yaml:"core_messages"`
	// contains filtered or unexported fields
}

func New

func New(notif notifier) (*Config, error)

func (*Config) Close

func (c *Config) Close() error

func (*Config) ListenReload

func (c *Config) ListenReload(cb func(T)) func()

func (*Config) SocketCommands

func (c *Config) SocketCommands() socketserver.Commands

func (*Config) UnlistenReload

func (c *Config) UnlistenReload(ch chan T)

type NotificationSectionMessage

type NotificationSectionMessage struct {
	Enabled *bool         `yaml:"enabled"`
	Timeout time.Duration `yaml:"timeout"`
}

type NotificationSectionPercent

type NotificationSectionPercent struct {
	Enabled        *bool         `yaml:"enabled"`
	Timeout        time.Duration `yaml:"timeout"`
	FormatDisabled string        `yaml:"format_disabled"`
	Format0        string        `yaml:"format0"`
	Formats        []string      `yaml:"formats"`
}

type Player

type Player struct {
	PlayerName string  `yaml:"player_name"`
	Start      Command `yaml:"start"`
	Show       Command `yaml:"show"`
	// contains filtered or unexported fields
}

func (*Player) ListenReload

func (c *Player) ListenReload(cb func(T)) func()

func (*Player) UnlistenReload

func (c *Player) UnlistenReload(ch chan T)

type SwayNodes

type SwayNodes struct {
	EmptyWorkspaceName string                 `yaml:"empty_workspace_name"`
	HideInsteadOfClose []WindowIdentification `yaml:"hide_instead_of_close"`
	// contains filtered or unexported fields
}

func (*SwayNodes) ListenReload

func (c *SwayNodes) ListenReload(cb func(T)) func()

func (*SwayNodes) UnlistenReload

func (c *SwayNodes) UnlistenReload(ch chan T)

type Volume

type Volume struct {
	Server       string                     `yaml:"pulseaudio_server"`
	SinkName     string                     `yaml:"pulseaudio_sink_name"`
	StepSize     int                        `yaml:"pulseaudio_step_size"`
	Notification NotificationSectionPercent `yaml:"notification"`
	// contains filtered or unexported fields
}

func (*Volume) ListenReload

func (c *Volume) ListenReload(cb func(T)) func()

func (*Volume) UnlistenReload

func (c *Volume) UnlistenReload(ch chan T)

type WindowIdentification

type WindowIdentification struct {
	Type    WindowMatchType `yaml:"type"`
	Partial bool            `yaml:"partial"`
	Match   string          `yaml:"match"`
}

func (WindowIdentification) MatchWindow

func (w WindowIdentification) MatchWindow(win *sway.Node) bool

type WindowMatchType

type WindowMatchType string
const (
	WindowMatchAppID      WindowMatchType = "app_id"
	WindowMatchPID        WindowMatchType = "pid"
	WindowMatchShell      WindowMatchType = "shell"
	WindowMatchWindowID   WindowMatchType = "window_id"
	WindowMatchTitle      WindowMatchType = "title"
	WindowMatchClass      WindowMatchType = "class"
	WindowMatchInstance   WindowMatchType = "instance"
	WindowMatchWindowRole WindowMatchType = "window_role"
	WindowMatchWindowType WindowMatchType = "window_type"
)

Jump to

Keyboard shortcuts

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