only serach in custom director.
hide&wait for the program to exit.
This commit is contained in:
11
run_forever.sh
Normal file
11
run_forever.sh
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Infinite loop to run the command
|
||||||
|
while true; do
|
||||||
|
echo "Starting nwg-drawer..."
|
||||||
|
bin/nwg-drawer -nocats -nofs -ovl -d
|
||||||
|
done &
|
||||||
|
|
||||||
|
|
||||||
|
# Return immediately after starting the loop
|
||||||
|
echo "The loop is running in the background."
|
||||||
38
tools.go
38
tools.go
@@ -5,8 +5,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/joshuarubin/go-sway"
|
|
||||||
log "github.com/sirupsen/logrus"
|
|
||||||
"io"
|
"io"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net"
|
"net"
|
||||||
@@ -20,6 +18,9 @@ import (
|
|||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/joshuarubin/go-sway"
|
||||||
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/diamondburned/gotk4/pkg/gdk/v3"
|
"github.com/diamondburned/gotk4/pkg/gdk/v3"
|
||||||
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
"github.com/diamondburned/gotk4/pkg/gdkpixbuf/v2"
|
||||||
"github.com/diamondburned/gotk4/pkg/gtk/v3"
|
"github.com/diamondburned/gotk4/pkg/gtk/v3"
|
||||||
@@ -250,35 +251,26 @@ func dataDir() string {
|
|||||||
|
|
||||||
func getAppDirs() []string {
|
func getAppDirs() []string {
|
||||||
var dirs []string
|
var dirs []string
|
||||||
|
log.Info("App dirs::")
|
||||||
|
|
||||||
home := os.Getenv("HOME")
|
home := os.Getenv("HOME")
|
||||||
xdgDataHome := os.Getenv("XDG_DATA_HOME")
|
//xdgDataHome := os.Getenv("XDG_DATA_HOME")
|
||||||
xdgDataDirs := os.Getenv("XDG_DATA_DIRS")
|
//xdgDataDirs := os.Getenv("XDG_DATA_DIRS")
|
||||||
if xdgDataDirs == "" {
|
if home != "" {
|
||||||
xdgDataDirs = "/usr/local/share/:/usr/share/"
|
dirs = append(dirs, filepath.Join(home, "/my_applications"))
|
||||||
}
|
}
|
||||||
if xdgDataHome != "" {
|
|
||||||
dirs = append(dirs, filepath.Join(xdgDataHome, "applications"))
|
|
||||||
} else if home != "" {
|
|
||||||
dirs = append(dirs, filepath.Join(home, ".local/share/applications"))
|
|
||||||
}
|
|
||||||
for _, d := range strings.Split(xdgDataDirs, ":") {
|
|
||||||
dirs = append(dirs, filepath.Join(d, "applications"))
|
|
||||||
}
|
|
||||||
flatpakDirs := []string{filepath.Join(home, ".local/share/flatpak/exports/share/applications"),
|
|
||||||
"/var/lib/flatpak/exports/share/applications"}
|
|
||||||
|
|
||||||
for _, d := range flatpakDirs {
|
log.Infof("App dirs: %v", dirs)
|
||||||
if pathExists(d) && !isIn(dirs, d) {
|
|
||||||
dirs = append(dirs, d)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var confirmedDirs []string
|
var confirmedDirs []string
|
||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
if pathExists(d) {
|
if pathExists(d) {
|
||||||
confirmedDirs = append(confirmedDirs, d)
|
confirmedDirs = append(confirmedDirs, d)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Infof("App dirs: %v", dirs)
|
||||||
|
|
||||||
return confirmedDirs
|
return confirmedDirs
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,7 +617,10 @@ func launch(command string, terminal bool, terminate bool) {
|
|||||||
// Collect the exit code of the child process to prevent zombies
|
// Collect the exit code of the child process to prevent zombies
|
||||||
// if the drawer runs in resident mode
|
// if the drawer runs in resident mode
|
||||||
go func() {
|
go func() {
|
||||||
|
restoreStateAndHide()
|
||||||
_ = cmd.Wait()
|
_ = cmd.Wait()
|
||||||
|
gtk.MainQuit()
|
||||||
|
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -633,7 +628,6 @@ func launch(command string, terminal bool, terminate bool) {
|
|||||||
if *resident {
|
if *resident {
|
||||||
restoreStateAndHide()
|
restoreStateAndHide()
|
||||||
} else {
|
} else {
|
||||||
gtk.MainQuit()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user