xdg-open or open in FM

This commit is contained in:
piotr
2021-08-20 04:46:26 +02:00
parent 41d48a0824
commit 6912e7f320
4 changed files with 74 additions and 12 deletions

14
main.go
View File

@@ -19,7 +19,7 @@ import (
"github.com/gotk3/gotk3/gtk"
)
const version = "0.1.6"
const version = "0.1.7"
var (
appDirs []string
@@ -28,6 +28,7 @@ var (
pinned []string
src glib.SourceHandle
id2entry map[string]desktopEntry
preferredApps map[string]interface{}
)
var categoryNames = [...]string{
@@ -188,6 +189,17 @@ func main() {
status = parseDesktopFiles(desktopFiles)
// For opening files we use xdg-open. As its configuration is PITA, we may override some associations
// in the ~/.config/nwg-panel/preferred-apps.json file.
paFile := filepath.Join(configDirectory, "preferred-apps.json")
preferredApps, err = loadPreferredApps(paFile)
if err != nil {
println(fmt.Sprintf("Custom associations file %s not found or invalid", paFile))
} else {
println(fmt.Sprintf("Found %v associations in %s", len(preferredApps), paFile))
fmt.Println(preferredApps)
}
// USER INTERFACE
gtk.Init(nil)