Skip to content

Commit 92bc9b6

Browse files
committed
fix detection of dark mode on MacOS
1 parent 9a65d06 commit 92bc9b6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

icon/icondarwin.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ import (
99
)
1010

1111
// IsDarkMode will return if the system is in darkmode
12+
// see https://gist.github.com/jerblack/869a303d1a604171bf8f00bbbefa59c2
1213
func IsDarkMode() bool {
1314
cmd := exec.Command("defaults", "read", "-g", "AppleInterfaceStyle")
14-
output, _ := cmd.Output()
15-
return strings.Contains(string(output), "Dark")
15+
if err := cmd.Run(); err != nil {
16+
if _, ok := err.(*exec.ExitError); ok {
17+
return false
18+
}
19+
}
20+
return true
1621
}
1722

1823
// GetIcon will return the icon

0 commit comments

Comments
 (0)