Skip to content

Commit 621a403

Browse files
committed
feat: allow custom theme and refresh indicator
1 parent 0cac46a commit 621a403

6 files changed

Lines changed: 91 additions & 33 deletions

File tree

go.mod

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ require (
66
github.com/JohannesKaufmann/html-to-markdown v1.6.0
77
github.com/charmbracelet/bubbles v0.18.0
88
github.com/charmbracelet/bubbletea v1.2.4
9-
github.com/charmbracelet/glamour v0.7.0
10-
github.com/charmbracelet/lipgloss v1.0.0
9+
github.com/charmbracelet/glamour v0.10.0
10+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834
1111
github.com/jessevdk/go-flags v1.5.0
1212
github.com/mattn/go-sqlite3 v1.14.22
1313
github.com/mmcdole/gofeed v1.3.0
@@ -24,7 +24,10 @@ require (
2424
github.com/atotto/clipboard v0.1.4 // indirect
2525
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
2626
github.com/aymerick/douceur v0.2.0 // indirect
27-
github.com/charmbracelet/x/ansi v0.6.0 // indirect
27+
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
28+
github.com/charmbracelet/x/ansi v0.8.0 // indirect
29+
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
30+
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect
2831
github.com/charmbracelet/x/term v0.2.1 // indirect
2932
github.com/dlclark/regexp2 v1.11.0 // indirect
3033
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
@@ -34,18 +37,18 @@ require (
3437
github.com/mattn/go-isatty v0.0.20 // indirect
3538
github.com/mattn/go-localereader v0.0.1 // indirect
3639
github.com/mattn/go-runewidth v0.0.16 // indirect
37-
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
40+
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
3841
github.com/mmcdole/goxpp v1.1.1 // indirect
3942
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4043
github.com/modern-go/reflect2 v1.0.2 // indirect
4144
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
4245
github.com/muesli/cancelreader v0.2.2 // indirect
4346
github.com/muesli/reflow v0.3.0 // indirect
44-
github.com/muesli/termenv v0.15.2 // indirect
45-
github.com/olekukonko/tablewriter v0.0.5 // indirect
47+
github.com/muesli/termenv v0.16.0 // indirect
4648
github.com/rivo/uniseg v0.4.7 // indirect
47-
github.com/yuin/goldmark v1.7.1 // indirect
48-
github.com/yuin/goldmark-emoji v1.0.2 // indirect
49+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
50+
github.com/yuin/goldmark v1.7.8 // indirect
51+
github.com/yuin/goldmark-emoji v1.0.5 // indirect
4952
golang.org/x/net v0.50.0 // indirect
5053
golang.org/x/sync v0.19.0 // indirect
5154
golang.org/x/sys v0.41.0 // indirect

go.sum

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,28 @@ github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z
1616
github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
1717
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
1818
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
19+
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
20+
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
1921
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
2022
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
2123
github.com/charmbracelet/bubbles v0.18.0 h1:PYv1A036luoBGroX6VWjQIE9Syf2Wby2oOl/39KLfy0=
2224
github.com/charmbracelet/bubbles v0.18.0/go.mod h1:08qhZhtIwzgrtBjAcJnij1t1H0ZRjwHyGsy6AL11PSw=
2325
github.com/charmbracelet/bubbletea v1.2.4 h1:KN8aCViA0eps9SCOThb2/XPIlea3ANJLUkv3KnQRNCE=
2426
github.com/charmbracelet/bubbletea v1.2.4/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM=
25-
github.com/charmbracelet/glamour v0.7.0 h1:2BtKGZ4iVJCDfMF229EzbeR1QRKLWztO9dMtjmqZSng=
26-
github.com/charmbracelet/glamour v0.7.0/go.mod h1:jUMh5MeihljJPQbJ/wf4ldw2+yBP59+ctV36jASy7ps=
27-
github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg=
28-
github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo=
29-
github.com/charmbracelet/x/ansi v0.6.0 h1:qOznutrb93gx9oMiGf7caF7bqqubh6YIM0SWKyA08pA=
30-
github.com/charmbracelet/x/ansi v0.6.0/go.mod h1:KBUFw1la39nl0dLl10l5ORDAqGXaeurTQmwyyVKse/Q=
27+
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
28+
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
29+
github.com/charmbracelet/glamour v0.10.0 h1:MtZvfwsYCx8jEPFJm3rIBFIMZUfUJ765oX8V6kXldcY=
30+
github.com/charmbracelet/glamour v0.10.0/go.mod h1:f+uf+I/ChNmqo087elLnVdCiVgjSKWuXa/l6NU2ndYk=
31+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 h1:ZR7e0ro+SZZiIZD7msJyA+NjkCNNavuiPBLgerbOziE=
32+
github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834/go.mod h1:aKC/t2arECF6rNOnaKaVU6y4t4ZeHQzqfxedE/VkVhA=
33+
github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE=
34+
github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q=
35+
github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k=
36+
github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
37+
github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a h1:G99klV19u0QnhiizODirwVksQB91TJKV/UaTnACcG30=
38+
github.com/charmbracelet/x/exp/golden v0.0.0-20240806155701-69247e0abc2a/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
39+
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf h1:rLG0Yb6MQSDKdB52aGX55JT1oi0P0Kuaj7wi1bLUpnI=
40+
github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf/go.mod h1:B3UgsnsBZS/eX42BlaNiJkD1pPOUa+oF1IYC6Yd2CEU=
3141
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
3242
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
3343
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -61,14 +71,13 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
6171
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
6272
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
6373
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
64-
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
6574
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
6675
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
6776
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
6877
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
6978
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
70-
github.com/microcosm-cc/bluemonday v1.0.26 h1:xbqSvqzQMeEHCqMi64VAs4d8uy6Mequs3rQ0k/Khz58=
71-
github.com/microcosm-cc/bluemonday v1.0.26/go.mod h1:JyzOCs9gkyQyjs+6h10UEVSe02CGwkhd72Xdqh78TWs=
79+
github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk=
80+
github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA=
7281
github.com/mmcdole/gofeed v1.3.0 h1:5yn+HeqlcvjMeAI4gu6T+crm7d0anY85+M+v6fIFNG4=
7382
github.com/mmcdole/gofeed v1.3.0/go.mod h1:9TGv2LcJhdXePDzxiuMnukhV2/zb6VtnZt1mS+SjkLE=
7483
github.com/mmcdole/goxpp v1.1.1 h1:RGIX+D6iQRIunGHrKqnA2+700XMCnNv0bAOOv5MUhx8=
@@ -84,10 +93,8 @@ github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELU
8493
github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
8594
github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s=
8695
github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8=
87-
github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo=
88-
github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8=
89-
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
90-
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
96+
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
97+
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
9198
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
9299
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
93100
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
@@ -107,19 +114,23 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
107114
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
108115
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
109116
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
110-
github.com/yuin/goldmark v1.3.7/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
117+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
118+
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
111119
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
112-
github.com/yuin/goldmark v1.7.1 h1:3bajkSilaCbjdKVsKdZjZCLBNPL9pYzrCakKaf4U49U=
113120
github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
114-
github.com/yuin/goldmark-emoji v1.0.2 h1:c/RgTShNgHTtc6xdz2KKI74jJr6rWi7FPgnP9GAsO5s=
115-
github.com/yuin/goldmark-emoji v1.0.2/go.mod h1:RhP/RWpexdp+KHs7ghKnifRoIs/Bq4nDS7tRbCkOwKY=
121+
github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic=
122+
github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E=
123+
github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk=
124+
github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
116125
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
117126
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
118127
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
119128
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
120129
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
121130
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
122131
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
132+
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
133+
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
123134
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
124135
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
125136
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=

internal/commands/commands.go

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package commands
22

33
import (
4+
"encoding/json"
45
"fmt"
56
"io"
67
"log"
@@ -19,6 +20,7 @@ import (
1920
tea "github.com/charmbracelet/bubbletea"
2021
"github.com/charmbracelet/glamour"
2122
"github.com/charmbracelet/glamour/ansi"
23+
"github.com/charmbracelet/glamour/styles"
2224
"gopkg.in/yaml.v3"
2325

2426
"github.com/guyfedwards/nom/v2/internal/config"
@@ -325,17 +327,28 @@ func (c Commands) GetGlamourisedArticle(ID int) (string, error) {
325327
func getStyleConfigWithOverrides(theme config.Theme) (sc ansi.StyleConfig) {
326328
switch theme.Glamour {
327329
case "light":
328-
sc = glamour.LightStyleConfig
330+
sc = styles.LightStyleConfig
329331
case "dracula":
330-
sc = glamour.DraculaStyleConfig
332+
sc = styles.DraculaStyleConfig
331333
case "pink":
332-
sc = glamour.PinkStyleConfig
334+
sc = styles.PinkStyleConfig
333335
case "ascii":
334-
sc = glamour.ASCIIStyleConfig
336+
sc = styles.ASCIIStyleConfig
335337
case "notty":
336-
sc = glamour.NoTTYStyleConfig
338+
sc = styles.NoTTYStyleConfig
339+
case "custom":
340+
sc = styles.DarkStyleConfig
341+
data, err := os.ReadFile(theme.CustomPath)
342+
if err != nil {
343+
log.Println(err)
344+
sc = styles.DarkStyleConfig
345+
}
346+
if err := json.Unmarshal(data, &sc); err != nil {
347+
log.Println(err)
348+
sc = styles.DarkStyleConfig
349+
}
337350
default:
338-
sc = glamour.DarkStyleConfig
351+
sc = styles.DarkStyleConfig
339352
}
340353

341354
sc.H1.BackgroundColor = &theme.TitleColor

internal/commands/list.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ func updateList(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
168168
case statusUpdate:
169169
cmds = append(cmds, m.list.NewStatusMessage(msg.status))
170170
case listUpdate:
171+
if m.isRefreshing == true {
172+
m.isRefreshing = false
173+
}
171174
if m.list.SettingFilter() {
172175
break
173176
}
@@ -176,6 +179,18 @@ func updateList(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
176179

177180
case tea.ResumeMsg:
178181
return m, nil
182+
case tickLoadMsg:
183+
if m.isRefreshing {
184+
loadchar := []rune{'⏐', '/', 'ー', '\\'}
185+
frame := int(msg)
186+
nextFrame := (frame + 1) % len(loadchar)
187+
status := fmt.Sprintf("Refreshing... %c", loadchar[frame])
188+
189+
cmds = append(cmds,
190+
m.list.NewStatusMessage(status),
191+
m.TickLoad(nextFrame),
192+
)
193+
}
179194
case tea.KeyMsg:
180195
switch {
181196
case key.Matches(msg, ListKeyMap.oQuit):
@@ -188,11 +203,12 @@ func updateList(msg tea.Msg, m model) (tea.Model, tea.Cmd) {
188203
case key.Matches(msg, ListKeyMap.Suspend):
189204
return m, tea.Suspend
190205
case key.Matches(msg, ListKeyMap.Refresh):
191-
if m.list.SettingFilter() || m.list.IsFiltered() {
206+
if m.isRefreshing || m.list.SettingFilter() || m.list.IsFiltered() {
192207
break
193208
}
194209

195-
cmds = append(cmds, refreshList(m))
210+
m.isRefreshing = true
211+
cmds = append(cmds, refreshList(m), m.TickLoad(0))
196212

197213
case key.Matches(msg, ListKeyMap.Read):
198214
if cmd := markReadList(&m, &cmds); cmd != nil {

internal/commands/tui.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"regexp"
99
"runtime"
1010
"strings"
11+
"time"
1112

1213
"github.com/charmbracelet/bubbles/help"
1314
"github.com/charmbracelet/bubbles/list"
@@ -52,6 +53,7 @@ type model struct {
5253
viewport viewport.Model
5354
lastRead *list.Item
5455
lastReadIndex int
56+
isRefreshing bool
5557
}
5658

5759
func (m model) Init() tea.Cmd {
@@ -166,6 +168,14 @@ func (m model) OpenInBrowser(url string) error {
166168
return nil
167169
}
168170

171+
type tickLoadMsg int
172+
173+
func (m model) TickLoad(frame int) tea.Cmd {
174+
return tea.Tick(time.Millisecond*150, func(t time.Time) tea.Msg {
175+
return tickLoadMsg(frame)
176+
})
177+
}
178+
169179
func ItemToTUIItem(i store.Item) TUIItem {
170180
return TUIItem{
171181
ID: i.ID,

internal/config/config.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ type Opener struct {
3535

3636
type Theme struct {
3737
Glamour string `yaml:"glamour,omitempty"`
38+
CustomPath string `yaml:"custom_path,omitempty"`
3839
TitleColor string `yaml:"titleColor,omitempty"`
3940
TitleColorFg string `yaml:"titleColorFg,omitempty"`
4041
FilterColor string `yaml:"filterColor,omitempty"`
@@ -200,6 +201,10 @@ func (c *Config) Load() error {
200201
c.Theme.Glamour = fileConfig.Theme.Glamour
201202
}
202203

204+
if fileConfig.Theme.CustomPath != "" {
205+
c.Theme.CustomPath = fileConfig.Theme.CustomPath
206+
}
207+
203208
if fileConfig.Theme.SelectedItemColor != "" {
204209
c.Theme.SelectedItemColor = fileConfig.Theme.SelectedItemColor
205210
}

0 commit comments

Comments
 (0)