File tree Expand file tree Collapse file tree 3 files changed +42
-11
lines changed
Expand file tree Collapse file tree 3 files changed +42
-11
lines changed Original file line number Diff line number Diff line change @@ -178,11 +178,12 @@ func main() {
178178 return
179179 }
180180 param := commands [0 ]
181- if param == "block" {
181+ switch param {
182+ case "block" :
182183 cmd .BlockSpotifyUpdates (true )
183- } else if param == "unblock" {
184+ case "unblock" :
184185 cmd .BlockSpotifyUpdates (false )
185- } else {
186+ default :
186187 utils .PrintError ("Invalid parameter. It has to be \" block\" or \" unblock\" ." )
187188 }
188189 return
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ func InitSetting() {
193193
194194 schemeSection , err := colorCfg .GetSection (schemeName )
195195 if err != nil {
196- println ( "Err " )
196+ utils . PrintWarning ( "Color scheme '" + schemeName + "' not found; using first scheme " )
197197 colorSection = sections [1 ]
198198 return
199199 }
Original file line number Diff line number Diff line change 44 "encoding/json"
55 "os"
66 "path/filepath"
7+ "sync"
78 "time"
89
910 spotifystatus "github.com/spicetify/cli/src/status/spotify"
@@ -13,6 +14,8 @@ import (
1314var (
1415 debuggerURL string
1516 autoReloadFunc func ()
17+ watchQueue chan func ()
18+ watchQueueOnce sync.Once
1619)
1720
1821// Watch .
@@ -54,8 +57,13 @@ func Watch(liveUpdate bool) {
5457 utils .Fatal (err )
5558 }
5659
57- refreshThemeJS ()
58- }, autoReloadFunc )
60+ enqueueWatchJob (func () {
61+ refreshThemeJS ()
62+ if autoReloadFunc != nil {
63+ autoReloadFunc ()
64+ }
65+ })
66+ }, nil )
5967 }
6068 }
6169
@@ -68,8 +76,13 @@ func Watch(liveUpdate bool) {
6876 utils .Fatal (err )
6977 }
7078
71- refreshThemeAssets ()
72- }, autoReloadFunc )
79+ enqueueWatchJob (func () {
80+ refreshThemeAssets ()
81+ if autoReloadFunc != nil {
82+ autoReloadFunc ()
83+ }
84+ })
85+ }, nil )
7386 }
7487 }
7588
@@ -78,9 +91,14 @@ func Watch(liveUpdate bool) {
7891 utils .Fatal (err )
7992 }
8093
81- InitSetting ()
82- refreshThemeCSS ()
83- }, autoReloadFunc )
94+ enqueueWatchJob (func () {
95+ InitSetting ()
96+ refreshThemeCSS ()
97+ if autoReloadFunc != nil {
98+ autoReloadFunc ()
99+ }
100+ })
101+ }, nil )
84102}
85103
86104// WatchExtensions .
@@ -233,3 +251,15 @@ func startDebugger() {
233251 }
234252 }
235253}
254+
255+ func enqueueWatchJob (job func ()) {
256+ watchQueueOnce .Do (func () {
257+ watchQueue = make (chan func (), 64 )
258+ go func () {
259+ for fn := range watchQueue {
260+ fn ()
261+ }
262+ }()
263+ })
264+ watchQueue <- job
265+ }
You can’t perform that action at this time.
0 commit comments