config

package
v0.0.0-...-022baea Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REMINDER_NOTIFICATION    = "nudge.reminder"
	REMINDER_BEEP            = "nudge.reminder.beep"
	REMINDER_ADVANCE         = "nudge.reminder.advance"
	NUDGE_WINDOW_SHOW        = "nudge.window.show"
	NUDGE_WINDOW_FULLSCREEN  = "nudge.window.fullscreen"
	NUDGE_WINDOW_ALL_SCREENS = "nudge.window.allscreens"
	AUTO_START               = "app.autostart"
	HIDE_TO_SYSTRAY          = "app.systray"
	ENABLE_LOGS              = "app.logs.enable"
	MAX_IMAGE_WIDTH          = "nudge.image.width"
	MAX_IMAGE_HEIGHT         = "nudge.image.height"

	NUM_EXCEPTIONS = "except.num"
	FMT_EXCEPTION  = "except.%d"

	NUM_NUDGES = "nudge.num"
	FMT_NUDGE  = "nudge.%d"
)

Variables

View Source
var (
	ExceptionOptions = []string{"Window Title", "OS Process", "User Idle", "Times (cron format)"}
	HowOptions       = []string{"Pause all nudges", "Stop all nudges", "Ignore this exception"}
	NudgeOptions     = []string{"Rest regularly", "Reminder (cron format)"}
)

Functions

func OptionsToIdx

func OptionsToIdx(options []string, t string, def int) int

Types

type Config

type Config struct {

	// General config
	AutoStart  binding.Bool
	Systray    binding.Bool
	EnableLogs binding.Bool

	// UI config
	ReminderNotification binding.Bool
	ReminderBeep         binding.Bool
	BeepSound            binding.String
	ShowWindow           binding.Bool
	FullScreenWindow     binding.Bool
	AllScreens           binding.Bool
	ReminderAdvance      binding.Float
	MaxImageWidth        binding.Float
	MaxImageHeight       binding.Float

	// Exceptions config
	Exceptions binding.UntypedList

	// Nudges config
	Nudges binding.UntypedList

	// Statistics
	Statistics binding.UntypedMap
	// contains filtered or unexported fields
}

func New

func New(app fyne.App) *Config

func (*Config) GetException

func (c *Config) GetException(id int) (*Exception, bool)

func (*Config) GetMaxImageSize

func (c *Config) GetMaxImageSize() fyne.Size

func (*Config) GetNudge

func (c *Config) GetNudge(id int) (*Nudge, bool)

func (*Config) NotificationRollDur

func (c *Config) NotificationRollDur() time.Duration

func (*Config) Read

func (c *Config) Read()

func (*Config) ReadExceptions

func (c *Config) ReadExceptions()

func (*Config) ReadGeneral

func (c *Config) ReadGeneral()

func (*Config) ReadNudges

func (c *Config) ReadNudges()

func (*Config) Write

func (c *Config) Write()

func (*Config) WriteExceptions

func (c *Config) WriteExceptions()

func (*Config) WriteGeneral

func (c *Config) WriteGeneral()

func (*Config) WriteNudges

func (c *Config) WriteNudges()

type Exception

type Exception struct {
	Name       string        `json:"name"`
	Active     bool          `json:"active"`
	ExactMatch bool          `json:"exact_match"`
	Type       ExceptionType `json:"type"`
	How        ExceptionHow  `json:"how"`
}

type ExceptionHow

type ExceptionHow int
const (
	Run ExceptionHow = iota - 1
	Pause
	Stop
	Ignore
)

func HowToType

func HowToType(t string) ExceptionHow

type ExceptionType

type ExceptionType int
const (
	WindowTitle ExceptionType = iota
	Process
	UserIdle
	Times
)

func ExceptionToType

func ExceptionToType(t string) ExceptionType

type Nudge

type Nudge struct {
	Name         string    `json:"name"`
	Description  string    `json:"description"`
	Type         NudgeType `json:"type"`
	Notification bool      `json:"notification"`
	Window       bool      `json:"window"`
	Schedule     string    `json:"schedule"`
	Work         float64   `json:"work_duration"`
	ShortRest    float64   `json:"short_rest_duration"`
	LongRest     float64   `json:"long_rest_duration"`
	WorkPeriods  int       `json:"periods_before_long_rest"`

	Runtime interface{}
}

type NudgeType

type NudgeType int
const (
	NudgeRest NudgeType = iota
	NudgeReminder
)

func NudgeToType

func NudgeToType(t string) NudgeType

Jump to

Keyboard shortcuts

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