Skip to content

Commit

Permalink
refactor: don't change activity state directly
Browse files Browse the repository at this point in the history
  • Loading branch information
xanderxfz committed Apr 9, 2024
1 parent 63fea9b commit 652505f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ func NewConfig() *Config {
}
}

func (c *Config) Toggle() {
c.Enabled = !c.Enabled
}

func (c *Config) SetWorkingHoursInterval(interval string) {
c.WorkingHoursInterval = interval
}
4 changes: 2 additions & 2 deletions internal/tray/tray.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ func (t *Tray) onReady() {
for {
select {
case <-mEnable.ClickedCh:
t.conf.Enabled = true
t.conf.Toggle()
mEnable.Hide()
mDisable.Show()
mWorkingHours.Enable()
go t.mouseController.MoveMouse()
case <-mDisable.ClickedCh:
t.conf.Enabled = false
t.conf.Toggle()
mDisable.Hide()
mEnable.Show()
mWorkingHours.Disable()
Expand Down

0 comments on commit 652505f

Please sign in to comment.