diff --git a/internal/config/config.go b/internal/config/config.go index 00ea6a1..57c26c3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -34,6 +34,10 @@ func NewConfig() *Config { } } +func (c *Config) ToggleEnableDisable() { + c.Enabled = !c.Enabled +} + func (c *Config) SetWorkingHoursInterval(interval string) { c.WorkingHoursInterval = interval } diff --git a/internal/tray/tray.go b/internal/tray/tray.go index 1ffb51e..bfb585c 100644 --- a/internal/tray/tray.go +++ b/internal/tray/tray.go @@ -86,13 +86,13 @@ func (t *Tray) onReady() { for { select { case <-mEnable.ClickedCh: - t.conf.Enabled = true + t.conf.ToggleEnableDisable() mEnable.Hide() mDisable.Show() mWorkingHours.Enable() go t.mouseController.MoveMouse() case <-mDisable.ClickedCh: - t.conf.Enabled = false + t.conf.ToggleEnableDisable() mDisable.Hide() mEnable.Show() mWorkingHours.Disable()