remove search bar

This commit is contained in:
2025-08-06 03:41:42 +02:00
parent f35903bfb7
commit 85320215be
2 changed files with 26 additions and 22 deletions

41
main.go
View File

@@ -3,8 +3,6 @@ package main
import (
"flag"
"fmt"
"github.com/diamondburned/gotk4-layer-shell/pkg/gtklayershell"
"github.com/expr-lang/expr"
"os"
"os/signal"
"path"
@@ -14,6 +12,9 @@ import (
"syscall"
"time"
"github.com/diamondburned/gotk4-layer-shell/pkg/gtklayershell"
"github.com/expr-lang/expr"
"github.com/allan-simon/go-singleinstance"
log "github.com/sirupsen/logrus"
@@ -112,10 +113,10 @@ var desktopEntries []desktopEntry
// UI elements
var (
win *gtk.Window
resultWindow *gtk.ScrolledWindow
fileSearchResults []string
searchEntry *gtk.SearchEntry
win *gtk.Window
resultWindow *gtk.ScrolledWindow
fileSearchResults []string
//searchEntry *gtk.SearchEntry
phrase string
fileSearchResultFlowBox *gtk.FlowBox
userDirsMap map[string]string
@@ -472,10 +473,11 @@ func main() {
//key := &gdk.EventKey{Event: event}
key := event.AsKey()
if key.Keyval() == gdk.KEY_Escape {
s := searchEntry.Text()
//s := searchEntry.Text()
s := ""
if s != "" {
searchEntry.GrabFocus()
searchEntry.SetText("")
//searchEntry.GrabFocus()
//searchEntry.SetText("")
} else {
if !*resident {
gtk.MainQuit()
@@ -491,7 +493,8 @@ func main() {
}
} else if key.Keyval() == gdk.KEY_Return {
s := searchEntry.Text()
//s := searchEntry.Text()
s := ""
if s != "" {
// Check if the search box content is an arithmetic expression. If so, display the result
// and copy to the clipboard with wl-copy.
@@ -515,9 +518,9 @@ func main() {
return false
default:
if !searchEntry.IsFocus() {
searchEntry.GrabFocusWithoutSelecting()
}
//if !searchEntry.IsFocus() {
// searchEntry.GrabFocusWithoutSelecting()
//}
}
return false
})
@@ -537,12 +540,12 @@ func main() {
outerVBox := gtk.NewBox(gtk.OrientationVertical, 0)
win.Add(outerVBox)
searchBoxWrapper := gtk.NewBox(gtk.OrientationHorizontal, 0)
outerVBox.PackStart(searchBoxWrapper, false, false, 10)
//searchBoxWrapper := gtk.NewBox(gtk.OrientationHorizontal, 0)
//outerVBox.PackStart(searchBoxWrapper, false, false, 10)
searchEntry = setUpSearchEntry()
searchEntry.SetMaxWidthChars(30)
searchBoxWrapper.PackStart(searchEntry, true, false, 0)
//searchEntry = setUpSearchEntry()
//searchEntry.SetMaxWidthChars(30)
//searchBoxWrapper.PackStart(searchEntry, true, false, 0)
if !*noCats {
categoriesWrapper = gtk.NewBox(gtk.OrientationHorizontal, 0)
@@ -771,7 +774,7 @@ func restoreStateAndHide() {
}
// clear search
searchEntry.SetText("")
//searchEntry.SetText("")
// One day or another we'll add SetFilterFunction here; it was impossible on the gotk3 library
appFlowBox = setUpAppsFlowBox(nil, "")

View File

@@ -2,11 +2,12 @@ package main
import (
"fmt"
"github.com/diamondburned/gotk4-layer-shell/pkg/gtklayershell"
"io/fs"
"path/filepath"
"strings"
"github.com/diamondburned/gotk4-layer-shell/pkg/gtklayershell"
log "github.com/sirupsen/logrus"
"github.com/diamondburned/gotk4/pkg/gdk/v3"
@@ -115,7 +116,7 @@ func setUpCategoriesButtonBox() *gtk.EventBox {
button := gtk.NewButtonWithLabel("All")
button.SetObjectProperty("name", "category-button")
button.Connect("clicked", func(item *gtk.Button) {
searchEntry.SetText("")
//searchEntry.SetText("")
appFlowBox = setUpAppsFlowBox(nil, "")
for _, btn := range catButtons {
btn.SetImagePosition(gtk.PosLeft)
@@ -135,7 +136,7 @@ func setUpCategoriesButtonBox() *gtk.EventBox {
name := cat.Name
b := *button
button.Connect("clicked", func(item *gtk.Button) {
searchEntry.SetText("")
//searchEntry.SetText("")
// One day or another we'll add SetFilterFunction here; it was impossible on the gotk3 library
appFlowBox = setUpAppsFlowBox(lists[name], "")
for _, btn := range catButtons {