fix setting data dir #69
This commit is contained in:
11
main.go
11
main.go
@@ -243,7 +243,10 @@ func main() {
|
|||||||
|
|
||||||
// Copy default style sheet if not found
|
// Copy default style sheet if not found
|
||||||
if !pathExists(filepath.Join(configDirectory, "drawer.css")) {
|
if !pathExists(filepath.Join(configDirectory, "drawer.css")) {
|
||||||
copyFile(filepath.Join(getDataHome(), "nwg-drawer/drawer.css"), filepath.Join(configDirectory, "drawer.css"))
|
err := copyFile("/usr/share/nwg-drawer/drawer.css", filepath.Join(configDirectory, "drawer.css"))
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("Failed copying 'drawer.css' file: %s", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cacheDirectory := cacheDir()
|
cacheDirectory := cacheDir()
|
||||||
@@ -312,7 +315,11 @@ func main() {
|
|||||||
log.Infof("User demanded theme: %s", *gtkTheme)
|
log.Infof("User demanded theme: %s", *gtkTheme)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
settings.SetProperty("gtk-application-prefer-dark-theme", true)
|
err := settings.SetProperty("gtk-application-prefer-dark-theme", true)
|
||||||
|
if err != nil {
|
||||||
|
log.Error("Error setting 'gtk-application-prefer-dark-theme' property")
|
||||||
|
return
|
||||||
|
}
|
||||||
log.Info("Preferring dark theme variants")
|
log.Info("Preferring dark theme variants")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
12
tools.go
12
tools.go
@@ -213,13 +213,6 @@ func copyFile(src, dst string) error {
|
|||||||
return os.Chmod(dst, srcinfo.Mode())
|
return os.Chmod(dst, srcinfo.Mode())
|
||||||
}
|
}
|
||||||
|
|
||||||
func getDataHome() string {
|
|
||||||
if os.Getenv("XDG_DATA_HOME") != "" {
|
|
||||||
return os.Getenv("XDG_DATA_HOME")
|
|
||||||
}
|
|
||||||
return "/usr/share/"
|
|
||||||
}
|
|
||||||
|
|
||||||
func getAppDirs() []string {
|
func getAppDirs() []string {
|
||||||
var dirs []string
|
var dirs []string
|
||||||
xdgDataDirs := ""
|
xdgDataDirs := ""
|
||||||
@@ -300,16 +293,13 @@ func listDesktopFiles() []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setUpCategories() {
|
func setUpCategories() {
|
||||||
p := filepath.Join(getDataHome(), "nwg-drawer/desktop-directories")
|
|
||||||
log.Debugf("Desktop dirs location: %s", p)
|
|
||||||
var other category
|
var other category
|
||||||
|
|
||||||
for _, cName := range categoryNames {
|
for _, cName := range categoryNames {
|
||||||
fileName := fmt.Sprintf("%s.directory", cName)
|
fileName := fmt.Sprintf("%s.directory", cName)
|
||||||
fp := filepath.Join(p, fileName)
|
fp := filepath.Join("/usr/share/nwg-drawer/desktop-directories", fileName)
|
||||||
lines, err := loadTextFile(fp)
|
lines, err := loadTextFile(fp)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Debugf("Opened file '%s'", fp)
|
|
||||||
var cat category
|
var cat category
|
||||||
cat.Name = cName
|
cat.Name = cName
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user