summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPaul Bütow <1224732+snonux@users.noreply.github.com>2025-06-24 23:24:31 +0300
committerGitHub <noreply@github.com>2025-06-24 23:24:31 +0300
commitcfc9e9a45cbf517a833c1fbffda6ed5068d08454 (patch)
treeee013ed633d9431e6211f22ef3894552ea2ae74e /internal
parentdbfba814e68bd6b679b2fd77bf10d34336485238 (diff)
parent60da6c59bcc58605bcc13609c855e32f045e9a1c (diff)
Merge pull request #92 from snonux/codex/add---disco-startup-flag-with-hotkey
Implement disco mode flag
Diffstat (limited to 'internal')
-rw-r--r--internal/ui/table.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/ui/table.go b/internal/ui/table.go
index bac9f0b..d75f350 100644
--- a/internal/ui/table.go
+++ b/internal/ui/table.go
@@ -112,6 +112,7 @@ type Model struct {
theme Theme
defaultTheme Theme
+ disco bool
}
// editDoneMsg is emitted when the external editor process finishes.
@@ -148,6 +149,10 @@ func (m *Model) startBlink(id int, markDone bool) tea.Cmd {
if m.blinkRow == -1 {
return nil
}
+ if m.disco {
+ m.theme = RandomTheme()
+ m.applyTheme()
+ }
m.blinkOn = true
m.blinkCount = 0
m.updateBlinkRow()
@@ -764,6 +769,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.theme = m.defaultTheme
m.applyTheme()
return m, nil
+ case "x":
+ m.disco = !m.disco
+ return m, nil
case " ":
m.reload()
return m, nil
@@ -904,6 +912,7 @@ func (m Model) View() string {
"t: edit tags",
"c: random theme",
"C: reset theme",
+ "x: toggle disco mode",
"space: refresh tasks",
"/, ?: search",
"n/N: next/prev search match",
@@ -1406,6 +1415,11 @@ func (m *Model) applyTheme() {
m.tbl.SetStyles(m.tblStyles)
}
+// SetDisco enables or disables disco mode.
+func (m *Model) SetDisco(d bool) {
+ m.disco = d
+}
+
func centerLines(s string, width int) string {
lines := strings.Split(strings.TrimRight(s, "\n"), "\n")
style := lipgloss.NewStyle().Width(width).Align(lipgloss.Center)