6 Commits

Author SHA1 Message Date
piotr
b61e665c71 bump to 0.4.2 2023-11-22 01:23:59 +01:00
piotr
8408c669ef remove unused function 2023-11-22 01:13:48 +01:00
Piotr Miller
d66066c3b6 Merge pull request #105 from nwg-piotr/fix-wm
remove `XDG_CURRENT_DESKTOP` as default `-wm` value; allow capitalized `Hyprland`
2023-11-21 14:53:22 +01:00
piotr
dac55cdd0d remove setting XDG_CURRENT_DESKTOP as dafault -wm value; allow capitalized Hyprland value 2023-11-21 14:26:04 +01:00
Piotr Miller
03365d24e5 Merge pull request #104 from Schuldkroete/main
Make the description line at the bottom of the drawer themable
2023-11-21 14:20:22 +01:00
Schuldkröte
8e58654336 add gtk name property to statusLineWrapper and statusLabel 2023-11-21 11:47:01 +01:00
2 changed files with 7 additions and 13 deletions

18
main.go
View File

@@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
) )
const version = "0.4.1" const version = "0.4.2"
var ( var (
appDirs []string appDirs []string
@@ -114,18 +114,10 @@ func defaultTermIfBlank(s, fallback string) string {
return s return s
} }
func defaultStringIfBlank(s, fallback string) string {
s = strings.TrimSpace(s)
if s == "" {
return fallback
}
return s
}
func validateWm() { func validateWm() {
if !(*wm == "sway" || *wm == "hyprland") && *wm != "" { if !(*wm == "sway" || *wm == "hyprland" || *wm == "Hyprland") && *wm != "" {
*wm = "" *wm = ""
log.Warn("-wm argument supports only sway or hyprland string.") log.Warn("-wm argument supports only 'sway' or 'hyprland' string.")
} }
} }
@@ -149,7 +141,7 @@ var itemSpacing = flag.Uint("spacing", 20, "icon spacing")
var lang = flag.String("lang", "", "force lang, e.g. \"en\", \"pl\"") var lang = flag.String("lang", "", "force lang, e.g. \"en\", \"pl\"")
var fileManager = flag.String("fm", "thunar", "File Manager") var fileManager = flag.String("fm", "thunar", "File Manager")
var term = flag.String("term", defaultTermIfBlank(os.Getenv("TERM"), "foot"), "Terminal emulator") var term = flag.String("term", defaultTermIfBlank(os.Getenv("TERM"), "foot"), "Terminal emulator")
var wm = flag.String("wm", defaultStringIfBlank(os.Getenv("XDG_CURRENT_DESKTOP"), ""), "Use swaymsg (with 'sway' argument) or hyprctl (with 'hyprland')") var wm = flag.String("wm", "", "Use swaymsg (with 'sway' argument) or hyprctl (with 'hyprland')")
var nameLimit = flag.Int("fslen", 80, "File Search name LENgth Limit") var nameLimit = flag.Int("fslen", 80, "File Search name LENgth Limit")
var noCats = flag.Bool("nocats", false, "Disable filtering by category") var noCats = flag.Bool("nocats", false, "Disable filtering by category")
var noFS = flag.Bool("nofs", false, "Disable file search") var noFS = flag.Bool("nofs", false, "Disable file search")
@@ -542,8 +534,10 @@ func main() {
} }
statusLineWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) statusLineWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0)
statusLineWrapper.SetProperty("name", "status-line-wrapper")
outerVBox.PackStart(statusLineWrapper, false, false, 10) outerVBox.PackStart(statusLineWrapper, false, false, 10)
statusLabel, _ = gtk.LabelNew(status) statusLabel, _ = gtk.LabelNew(status)
statusLabel.SetProperty("name", "status-label")
statusLineWrapper.PackStart(statusLabel, true, false, 0) statusLineWrapper.PackStart(statusLabel, true, false, 0)
win.ShowAll() win.ShowAll()

View File

@@ -585,7 +585,7 @@ func launch(command string, terminal bool) {
cmd = exec.Command(prefixCommand, args...) cmd = exec.Command(prefixCommand, args...)
} else if *wm == "sway" { } else if *wm == "sway" {
cmd = exec.Command("swaymsg", "exec", strings.Join(elements, " ")) cmd = exec.Command("swaymsg", "exec", strings.Join(elements, " "))
} else if *wm == "hyprland" { } else if *wm == "hyprland" || *wm == "Hyprland" {
cmd = exec.Command("hyprctl", "dispatch", "exec", strings.Join(elements, " ")) cmd = exec.Command("hyprctl", "dispatch", "exec", strings.Join(elements, " "))
} }