9 Commits

Author SHA1 Message Date
Piotr Miller
7681055a23 Merge pull request #46 from nwg-piotr/fix45
check if fileSearchResultWrapper exists #45
2022-01-12 11:17:56 +01:00
piotr
15c9029935 check if fileSearchResultWrapper exists #45 2022-01-12 11:06:05 +01:00
Piotr Miller
f67f1a9950 Merge pull request #43 from nwg-piotr/fix-pinned
create empty pinned file if not found on startup (and some other minor issues)
2022-01-11 14:41:39 +01:00
piotr
2c63e256ba update readme 2022-01-11 14:36:56 +01:00
piotr
92095d5b97 hide fileSearchResultWrapper initially 2022-01-11 12:31:47 +01:00
piotr
a6977d9444 create pinned file if not found 2022-01-11 11:45:05 +01:00
Piotr Miller
378aa33cf3 Merge pull request #42 from nwg-piotr/issue36
Close on RMB only #36
2022-01-10 23:55:16 +01:00
piotr
9d6d572f72 close on LMB only #36 2022-01-10 22:04:58 +01:00
piotr
8fdb174643 hot fix to #41 2022-01-09 23:20:48 +01:00
3 changed files with 20 additions and 8 deletions

View File

@@ -21,10 +21,12 @@ and `nwggrid`.
[![Packaging status](https://repology.org/badge/vertical-allrepos/nwg-drawer.svg)](https://repology.org/project/nwg-drawer/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/nwg-drawer.svg)](https://repology.org/project/nwg-drawer/versions)
To close the window w/o running a program, you may use `Esc` key, or right-click the window next to the icons.
## v0.2.x note ## v0.2.x note
1. Placing config files in the nwg-panel config directory was a mistake, sorry. The 0.2.0 version migrates them to `~/.config/nwg-drawer`. 1. Placing config files in the nwg-panel config directory was a mistake, sorry. The 0.2.0 version migrates them to `~/.config/nwg-drawer`.
2. From now on you may run the program residently, which should speed it up. See "Running" below. 2. From now on you may run the program residently, which should speed it up (but also occupy some resources!). See "Running" below.
## Installation ## Installation
@@ -38,7 +40,7 @@ and `nwggrid`.
Optional (recommended): Optional (recommended):
- thunar - thunar
- alacritty - foot
You may use another file manager and terminal emulator (see command line arguments), but mentioned above have been You may use another file manager and terminal emulator (see command line arguments), but mentioned above have been
confirmed to work well with the program. Also see **Files** below. confirmed to work well with the program. Also see **Files** below.

Binary file not shown.

22
main.go
View File

@@ -21,7 +21,7 @@ import (
"github.com/gotk3/gotk3/gtk" "github.com/gotk3/gotk3/gtk"
) )
const version = "0.2.3" const version = "0.2.5"
var ( var (
appDirs []string appDirs []string
@@ -251,6 +251,7 @@ func main() {
pinned, err = loadTextFile(pinnedFile) pinned, err = loadTextFile(pinnedFile)
if err != nil { if err != nil {
pinned = nil pinned = nil
savePinned()
} }
log.Info(fmt.Sprintf("Found %v pinned items", len(pinned))) log.Info(fmt.Sprintf("Found %v pinned items", len(pinned)))
@@ -351,8 +352,7 @@ func main() {
win.Connect("key-release-event", func(window *gtk.Window, event *gdk.Event) bool { win.Connect("key-release-event", func(window *gtk.Window, event *gdk.Event) bool {
key := &gdk.EventKey{Event: event} key := &gdk.EventKey{Event: event}
switch key.KeyVal() { if key.KeyVal() == gdk.KEY_Escape {
case gdk.KEY_Escape:
s, _ := searchEntry.GetText() s, _ := searchEntry.GetText()
if s != "" { if s != "" {
searchEntry.GrabFocus() searchEntry.GrabFocus()
@@ -365,15 +365,22 @@ func main() {
} }
} }
return true return true
}
return false
})
win.Connect("key-press-event", func(window *gtk.Window, event *gdk.Event) bool {
key := &gdk.EventKey{Event: event}
switch key.KeyVal() {
case gdk.KEY_downarrow, gdk.KEY_Up, gdk.KEY_Down, gdk.KEY_Left, gdk.KEY_Right, gdk.KEY_Tab, case gdk.KEY_downarrow, gdk.KEY_Up, gdk.KEY_Down, gdk.KEY_Left, gdk.KEY_Right, gdk.KEY_Tab,
gdk.KEY_Return, gdk.KEY_Page_Up, gdk.KEY_Page_Down, gdk.KEY_Home, gdk.KEY_End: gdk.KEY_Return, gdk.KEY_Page_Up, gdk.KEY_Page_Down, gdk.KEY_Home, gdk.KEY_End:
return true return false
default: default:
if !searchEntry.IsFocus() { if !searchEntry.IsFocus() {
searchEntry.GrabFocusWithoutSelecting() searchEntry.GrabFocusWithoutSelecting()
} }
return true return false
} }
}) })
@@ -419,7 +426,7 @@ func main() {
resultWindow.Connect("button-release-event", func(sw *gtk.ScrolledWindow, e *gdk.Event) bool { resultWindow.Connect("button-release-event", func(sw *gtk.ScrolledWindow, e *gdk.Event) bool {
btnEvent := gdk.EventButtonNewFromEvent(e) btnEvent := gdk.EventButtonNewFromEvent(e)
if btnEvent.Button() == 1 || btnEvent.Button() == 3 { if btnEvent.Button() == 3 {
if !*resident { if !*resident {
gtk.MainQuit() gtk.MainQuit()
} else { } else {
@@ -488,6 +495,9 @@ func main() {
glib.TimeoutAdd(uint(1), func() bool { glib.TimeoutAdd(uint(1), func() bool {
if showWindowTrigger && win != nil && !win.IsVisible() { if showWindowTrigger && win != nil && !win.IsVisible() {
win.ShowAll() win.ShowAll()
if fileSearchResultWrapper != nil {
fileSearchResultWrapper.Hide()
}
// focus 1st element // focus 1st element
b := appFlowBox.GetChildAtIndex(0) b := appFlowBox.GetChildAtIndex(0)
if b != nil { if b != nil {