diff --git a/bin/nwg-drawer b/bin/nwg-drawer index 4a3dd8b..215a35c 100755 Binary files a/bin/nwg-drawer and b/bin/nwg-drawer differ diff --git a/main.go b/main.go index 273403f..09f2326 100644 --- a/main.go +++ b/main.go @@ -100,6 +100,8 @@ var ( pinnedFlowBox *gtk.FlowBox pinnedFlowBoxWrapper *gtk.Box catButtons []*gtk.Button + statusLabel *gtk.Label + status string ) // Flags @@ -186,7 +188,7 @@ func main() { desktopFiles := listDesktopFiles() println(fmt.Sprintf("Found %v desktop files", len(desktopFiles))) - parseDesktopFiles(desktopFiles) + status = parseDesktopFiles(desktopFiles) // USER INTERFACE gtk.Init(nil) @@ -300,6 +302,11 @@ func main() { resultWindow.Add(appFlowBoxWrapper) appFlowBox = setUpAppsFlowBox(nil, "") + statusLineWrapper, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) + outerVBox.PackStart(statusLineWrapper, false, false, 10) + statusLabel, _ = gtk.LabelNew(status) + statusLineWrapper.PackStart(statusLabel, true, false, 0) + /*alignmentBox, _ := gtk.BoxNew(gtk.ORIENTATION_HORIZONTAL, 0) outerBox.PackStart(alignmentBox, true, true, 0) diff --git a/tools.go b/tools.go index e9621c7..2efcfac 100644 --- a/tools.go +++ b/tools.go @@ -324,7 +324,7 @@ func setUpCategories() { categories = append(categories, other) } -func parseDesktopFiles(desktopFiles []string) { +func parseDesktopFiles(desktopFiles []string) string { id2entry = make(map[string]desktopEntry) var added []string skipped := 0 @@ -429,7 +429,9 @@ func parseDesktopFiles(desktopFiles []string) { sort.Slice(desktopEntries, func(i, j int) bool { return desktopEntries[i].NameLoc < desktopEntries[j].NameLoc }) - println(fmt.Sprintf("Skipped %v duplicates; %v .desktop entries hidden by \"NoDisplay=true\"", skipped, hidden)) + summary := fmt.Sprintf("%v entries (+%v hidden)", len(desktopEntries)-hidden, hidden) + println("Skipped %v duplicates; %v .desktop entries hidden by \"NoDisplay=true\"", skipped, hidden) + return summary } // freedesktop Main Categories list consists of 13 entries. Let's contract it to 8+1 ("Other"). diff --git a/uicomponents.go b/uicomponents.go index 7cba68a..d243f72 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -221,7 +221,8 @@ func flowBoxButton(entry desktopEntry) *gtk.Button { ID := entry.DesktopID exec := entry.Exec terminal := entry.Terminal - button.Connect("button-release-event", func(row *gtk.Button, e *gdk.Event) bool { + desc := entry.CommentLoc + button.Connect("button-release-event", func(btn *gtk.Button, e *gdk.Event) bool { btnEvent := gdk.EventButtonNewFromEvent(e) if btnEvent.Button() == 1 { launch(exec, terminal) @@ -232,6 +233,12 @@ func flowBoxButton(entry desktopEntry) *gtk.Button { } return false }) + button.Connect("enter-notify-event", func() { + statusLabel.SetText(desc) + }) + button.Connect("leave-notify-event", func() { + statusLabel.SetText(status) + }) return button }