Add support for absolute paths
In reference to https://github.com/nwg-piotr/nwg-bar/issues/1
This commit is contained in:
4
Makefile
4
Makefile
@@ -8,7 +8,7 @@ get:
|
||||
go get "github.com/sirupsen/logrus"
|
||||
|
||||
build:
|
||||
go build -o bin/nwg-drawer *.go
|
||||
go build -o bin/nwg-drawer .
|
||||
|
||||
install:
|
||||
mkdir -p /usr/share/nwg-drawer
|
||||
@@ -21,5 +21,5 @@ uninstall:
|
||||
rm /usr/bin/nwg-drawer
|
||||
|
||||
run:
|
||||
go build -o bin/nwg-drawer *.go
|
||||
go build -o bin/nwg-drawer .
|
||||
bin/nwg-drawer
|
||||
|
||||
10
main.go
10
main.go
@@ -190,7 +190,9 @@ func main() {
|
||||
}
|
||||
log.Info(fmt.Sprintf("Found %v pinned items", len(pinned)))
|
||||
|
||||
cssFile := filepath.Join(configDirectory, *cssFileName)
|
||||
if !strings.HasPrefix(*cssFileName, "/") {
|
||||
*cssFileName = filepath.Join(configDirectory, *cssFileName)
|
||||
}
|
||||
|
||||
appDirs = getAppDirs()
|
||||
|
||||
@@ -216,12 +218,12 @@ func main() {
|
||||
|
||||
cssProvider, _ := gtk.CssProviderNew()
|
||||
|
||||
err = cssProvider.LoadFromPath(cssFile)
|
||||
err = cssProvider.LoadFromPath(*cssFileName)
|
||||
if err != nil {
|
||||
log.Errorf("ERROR: %s css file not found or erroneous. Using GTK styling.", cssFile)
|
||||
log.Errorf("ERROR: %s css file not found or erroneous. Using GTK styling.", *cssFileName)
|
||||
log.Errorf("%s", err)
|
||||
} else {
|
||||
log.Info(fmt.Sprintf("Using style from %s", cssFile))
|
||||
log.Info(fmt.Sprintf("Using style from %s", *cssFileName))
|
||||
screen, _ := gdk.ScreenGetDefault()
|
||||
gtk.AddProviderForScreen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user