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

View File

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