Skip to content

Commit

Permalink
refactor: Don't change activity state directly (#35)
Browse files Browse the repository at this point in the history
Co-authored-by: Yevhen Pavlov <[email protected]>
  • Loading branch information
xanderxfz and sonjek authored Apr 9, 2024
1 parent 63fea9b commit a737a92
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) ToggleEnableDisable() {
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.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()
Expand Down

0 comments on commit a737a92

Please sign in to comment.