6 Commits

Author SHA1 Message Date
Piotr Miller
3fe6d71234 Merge pull request #73 from nwg-piotr/fix-72
Fix inconsistent behaviour of normal resident instance
2022-10-30 23:54:41 +01:00
piotr
0e5b1cf659 bump to 0.3.3 2022-10-30 22:58:19 +01:00
piotr
6494557979 focus 1st pinned if any, or focus 1st appBox entry; fixes #72 2022-10-30 22:53:06 +01:00
Piotr Miller
f68678f687 Merge pull request #71 from nwg-piotr/fix-45-revisited
Fix 45 revisited
2022-10-26 02:13:02 +02:00
piotr
e31df6e721 bump to 0.3.2 2022-10-25 04:06:30 +02:00
piotr
9509a65625 attempt to fix #45 (revisited) 2022-10-25 04:02:05 +02:00

21
main.go
View File

@@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk"
)
const version = "0.3.1"
const version = "0.3.3"
var (
appDirs []string
@@ -200,7 +200,10 @@ func main() {
log.Warnf("Resident instance already running (PID %v)", i)
} else {
log.Infof("Showing resident instance (PID %v)", i)
syscall.Kill(i, syscall.SIGUSR1)
err := syscall.Kill(i, syscall.SIGUSR1)
if err != nil {
return
}
}
}
}
@@ -546,14 +549,16 @@ func main() {
fileSearchResultWrapper.Hide()
}
// focus 1st element
b := appFlowBox.GetChildAtIndex(0)
if b != nil {
button, err := b.GetChild()
var button gtk.IWidget
if pinnedFlowBox.GetChildren().Length() > 0 {
button, err = pinnedFlowBox.GetChildAtIndex(0).GetChild()
} else {
button, err = appFlowBox.GetChildAtIndex(0).GetChild()
}
if err == nil {
button.ToWidget().GrabFocus()
}
}
}
return false
})
@@ -577,7 +582,9 @@ func main() {
func restoreStateAndHide() {
timeStart1 := time.Now()
if win != nil {
win.Hide()
}
// clear search
searchEntry.SetText("")
@@ -590,7 +597,9 @@ func restoreStateAndHide() {
}
// scroll to the top
if resultWindow != nil {
resultWindow.GetVAdjustment().SetValue(0)
}
t := time.Now()
log.Debugf(fmt.Sprintf("UI hidden and restored in the backgroud in %v ms", t.Sub(timeStart1).Milliseconds()))