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() {
178
178
return
179
179
}
180
180
param := commands [0 ]
181
- if param == "block" {
181
+ switch param {
182
+ case "block" :
182
183
cmd .BlockSpotifyUpdates (true )
183
- } else if param == "unblock" {
184
+ case "unblock" :
184
185
cmd .BlockSpotifyUpdates (false )
185
- } else {
186
+ default :
186
187
utils .PrintError ("Invalid parameter. It has to be \" block\" or \" unblock\" ." )
187
188
}
188
189
return
Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ func InitSetting() {
193
193
194
194
schemeSection , err := colorCfg .GetSection (schemeName )
195
195
if err != nil {
196
- println ( "Err " )
196
+ utils . PrintWarning ( "Color scheme '" + schemeName + "' not found; using first scheme " )
197
197
colorSection = sections [1 ]
198
198
return
199
199
}
Original file line number Diff line number Diff line change 4
4
"encoding/json"
5
5
"os"
6
6
"path/filepath"
7
+ "sync"
7
8
"time"
8
9
9
10
spotifystatus "github.com/spicetify/cli/src/status/spotify"
@@ -13,6 +14,8 @@ import (
13
14
var (
14
15
debuggerURL string
15
16
autoReloadFunc func ()
17
+ watchQueue chan func ()
18
+ watchQueueOnce sync.Once
16
19
)
17
20
18
21
// Watch .
@@ -54,8 +57,13 @@ func Watch(liveUpdate bool) {
54
57
utils .Fatal (err )
55
58
}
56
59
57
- refreshThemeJS ()
58
- }, autoReloadFunc )
60
+ enqueueWatchJob (func () {
61
+ refreshThemeJS ()
62
+ if autoReloadFunc != nil {
63
+ autoReloadFunc ()
64
+ }
65
+ })
66
+ }, nil )
59
67
}
60
68
}
61
69
@@ -68,8 +76,13 @@ func Watch(liveUpdate bool) {
68
76
utils .Fatal (err )
69
77
}
70
78
71
- refreshThemeAssets ()
72
- }, autoReloadFunc )
79
+ enqueueWatchJob (func () {
80
+ refreshThemeAssets ()
81
+ if autoReloadFunc != nil {
82
+ autoReloadFunc ()
83
+ }
84
+ })
85
+ }, nil )
73
86
}
74
87
}
75
88
@@ -78,9 +91,14 @@ func Watch(liveUpdate bool) {
78
91
utils .Fatal (err )
79
92
}
80
93
81
- InitSetting ()
82
- refreshThemeCSS ()
83
- }, autoReloadFunc )
94
+ enqueueWatchJob (func () {
95
+ InitSetting ()
96
+ refreshThemeCSS ()
97
+ if autoReloadFunc != nil {
98
+ autoReloadFunc ()
99
+ }
100
+ })
101
+ }, nil )
84
102
}
85
103
86
104
// WatchExtensions .
@@ -233,3 +251,15 @@ func startDebugger() {
233
251
}
234
252
}
235
253
}
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