diff --git a/bin/nwg-drawer b/bin/nwg-drawer index 2d51fc2..66a5def 100755 Binary files a/bin/nwg-drawer and b/bin/nwg-drawer differ diff --git a/main.go b/main.go index 56935e7..63cfbe2 100644 --- a/main.go +++ b/main.go @@ -19,7 +19,7 @@ import ( "github.com/gotk3/gotk3/gtk" ) -const version = "0.1.8" +const version = "0.1.9" var ( appDirs []string @@ -197,7 +197,6 @@ func main() { 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 @@ -273,7 +272,7 @@ func main() { default: if !searchEntry.IsFocus() { - searchEntry.GrabFocus() + searchEntry.GrabFocusWithoutSelecting() } return false } diff --git a/uicomponents.go b/uicomponents.go index 180147f..3999609 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -351,6 +351,29 @@ func setUpSearchEntry() *gtk.SearchEntry { fileSearchResultWrapper.Hide() } } + // focus 1st search result #17 + var w *gtk.Widget + if appFlowBox != nil { + b := appFlowBox.GetChildAtIndex(0) + if b != nil { + button, err := b.GetChild() + if err == nil { + button.ToWidget().GrabFocus() + w = button.ToWidget() + } + } + } + if w == nil && fileSearchResultFlowBox != nil { + f := fileSearchResultFlowBox.GetChildAtIndex(0) + if f != nil { + //f.SetCanFocus(false) + button, err := f.GetChild() + if err == nil { + button.ToWidget().SetCanFocus(true) + button.ToWidget().GrabFocus() + } + } + } } else { // clear search results appFlowBox = setUpAppsFlowBox(nil, "") @@ -364,9 +387,9 @@ func setUpSearchEntry() *gtk.SearchEntry { } } }) - searchEntry.Connect("focus-in-event", func() { + /*searchEntry.Connect("focus-in-event", func() { searchEntry.SetText("") - }) + })*/ return searchEntry } @@ -409,6 +432,7 @@ func setUpUserDirButton(iconName, displayName, entryName string, userDirsMap map } box, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) button, _ := gtk.ButtonNew() + button.SetAlwaysShowImage(true) img, _ := gtk.ImageNewFromIconName(iconName, gtk.ICON_SIZE_MENU) button.SetImage(img) @@ -441,6 +465,7 @@ func setUpUserFileSearchResultButton(fileName, filePath string) *gtk.Box { if strings.HasPrefix(filePath, "#is_dir#") { filePath = filePath[8:] img, _ := gtk.ImageNewFromIconName("folder", gtk.ICON_SIZE_MENU) + button.SetAlwaysShowImage(true) button.SetImage(img) } @@ -466,6 +491,10 @@ func setUpUserFileSearchResultButton(fileName, filePath string) *gtk.Box { return false }) + button.Connect("activate", func() { + open(filePath, true) + }) + box.PackStart(button, false, true, 0) return box }