unhardcode data dir again #115
This commit is contained in:
17
main.go
17
main.go
@@ -26,6 +26,7 @@ const version = "0.4.6"
|
|||||||
var (
|
var (
|
||||||
appDirs []string
|
appDirs []string
|
||||||
configDirectory string
|
configDirectory string
|
||||||
|
dataDirectory string
|
||||||
pinnedFile string
|
pinnedFile string
|
||||||
pinned []string
|
pinned []string
|
||||||
id2entry map[string]desktopEntry
|
id2entry map[string]desktopEntry
|
||||||
@@ -266,6 +267,7 @@ func main() {
|
|||||||
|
|
||||||
// ENVIRONMENT
|
// ENVIRONMENT
|
||||||
configDirectory = configDir()
|
configDirectory = configDir()
|
||||||
|
dataDirectory = dataDir()
|
||||||
|
|
||||||
// Placing the drawer config files in the nwg-panel config directory was a mistake.
|
// Placing the drawer config files in the nwg-panel config directory was a mistake.
|
||||||
// Let's move them to their own location.
|
// Let's move them to their own location.
|
||||||
@@ -291,7 +293,7 @@ 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")) {
|
||||||
err := copyFile("/usr/share/nwg-drawer/drawer.css", filepath.Join(configDirectory, "drawer.css"))
|
err := copyFile(filepath.Join(dataDirectory, "drawer.css"), filepath.Join(configDirectory, "drawer.css"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed copying 'drawer.css' file: %s", err)
|
log.Errorf("Failed copying 'drawer.css' file: %s", err)
|
||||||
}
|
}
|
||||||
@@ -579,8 +581,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Power Button Bar
|
// Power Button Bar
|
||||||
dDir := dataDir()
|
if dataDirectory != "" {
|
||||||
if dDir != "" {
|
|
||||||
if *pbExit != "" || *pbLock != "" || *pbPoweroff != "" || *pbReboot != "" || *pbSleep != "" {
|
if *pbExit != "" || *pbLock != "" || *pbPoweroff != "" || *pbReboot != "" || *pbSleep != "" {
|
||||||
powerBarWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
powerBarWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
|
||||||
outerVBox.PackStart(powerBarWrapper, false, false, 0)
|
outerVBox.PackStart(powerBarWrapper, false, false, 0)
|
||||||
@@ -588,23 +589,23 @@ func main() {
|
|||||||
powerBarWrapper.PackStart(powerButtonsWrapper, true, false, 12)
|
powerBarWrapper.PackStart(powerButtonsWrapper, true, false, 12)
|
||||||
|
|
||||||
if *pbLock != "" {
|
if *pbLock != "" {
|
||||||
btn := powerButton(filepath.Join(dDir, "img/lock.svg"), *pbLock)
|
btn := powerButton(filepath.Join(dataDirectory, "img/lock.svg"), *pbLock)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
||||||
}
|
}
|
||||||
if *pbExit != "" {
|
if *pbExit != "" {
|
||||||
btn := powerButton(filepath.Join(dDir, "img/exit.svg"), *pbExit)
|
btn := powerButton(filepath.Join(dataDirectory, "img/exit.svg"), *pbExit)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
||||||
}
|
}
|
||||||
if *pbReboot != "" {
|
if *pbReboot != "" {
|
||||||
btn := powerButton(filepath.Join(dDir, "img/reboot.svg"), *pbReboot)
|
btn := powerButton(filepath.Join(dataDirectory, "img/reboot.svg"), *pbReboot)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
||||||
}
|
}
|
||||||
if *pbSleep != "" {
|
if *pbSleep != "" {
|
||||||
btn := powerButton(filepath.Join(dDir, "img/sleep.svg"), *pbSleep)
|
btn := powerButton(filepath.Join(dataDirectory, "img/sleep.svg"), *pbSleep)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
||||||
}
|
}
|
||||||
if *pbPoweroff != "" {
|
if *pbPoweroff != "" {
|
||||||
btn := powerButton(filepath.Join(dDir, "img/poweroff.svg"), *pbPoweroff)
|
btn := powerButton(filepath.Join(dataDirectory, "img/poweroff.svg"), *pbPoweroff)
|
||||||
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
powerButtonsWrapper.PackStart(btn, true, false, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user