summaryrefslogtreecommitdiff
path: root/internal/switcher/switcher.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/switcher/switcher.go')
-rw-r--r--internal/switcher/switcher.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/switcher/switcher.go b/internal/switcher/switcher.go
index fce242c..ec5c47a 100644
--- a/internal/switcher/switcher.go
+++ b/internal/switcher/switcher.go
@@ -51,8 +51,29 @@ func (m *Model) Prev() int {
return m.active
}
+func (m *Model) SetActive(i int) {
+ m.active = m.fixSel(i)
+}
+
+func (m *Model) UpdatePicker(i int, c colors.ColorSpace) {
+ m.pickers[i].SetColor(c)
+}
+
+func (m *Model) NewNotice(msg string) tea.Cmd {
+ return m.notices.New(msg)
+}
+
func (m Model) Init() tea.Cmd {
cmds := []tea.Cmd{}
+
+ // Make a backup of notices received before the program starts
+ // then reinitialize them with a proper expiration time.
+ noticeBackup := m.notices.Notices
+ m.notices = notices.New()
+ for _, v := range noticeBackup {
+ cmds = append(cmds, m.NewNotice(v))
+ }
+
for _, p := range m.pickers {
cmds = append(cmds, p.Init())
}