diff --git a/main.go b/main.go index ff5986f..e11972b 100644 --- a/main.go +++ b/main.go @@ -503,6 +503,8 @@ func main() { } else if key.KeyVal() == gdk.KEY_Return { s, _ := searchEntry.GetText() 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. result, err := expr.Eval(s, nil) if err == nil { log.Debugf("Setting up mathemathical operation result window. Operation: %s, result: %v", s, result) diff --git a/uicomponents.go b/uicomponents.go index e68874d..7818727 100644 --- a/uicomponents.go +++ b/uicomponents.go @@ -599,6 +599,7 @@ func setUpOperationResultWindow(operation string, result string) { layershell.SetKeyboardMode(win, layershell.LAYER_SHELL_KEYBOARD_MODE_EXCLUSIVE) } + // any key to close the window win.Connect("key-release-event", func(_ *gtk.Window, event *gdk.Event) bool { win.Destroy() return true