summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-01-25 20:03:12 +0200
committerPaul Buetow <paul@buetow.org>2024-01-25 20:03:12 +0200
commit61275a73f3d1d6559fca3c706b4dba30f326f3e9 (patch)
treeac48a98a3b360400942a0916c385b757aba9a6fd /main.go
parent5d8a28040830bdd1c05809bae298602008e275da (diff)
focus input window
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 3 insertions, 9 deletions
diff --git a/main.go b/main.go
index 0bc5b57..9292e9a 100644
--- a/main.go
+++ b/main.go
@@ -1,11 +1,10 @@
package main
import (
- "crypto/sha256"
- "encoding/hex"
"fmt"
"log"
"os"
+ "time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
@@ -24,7 +23,7 @@ func main() {
button := widget.NewButton("Log text", func() {
content := input.Text
- filename := fmt.Sprintf("%s/quicklog-%s.md", storageDir, getSHA256Hash(content))
+ filename := fmt.Sprintf("%s/quicklog-%d.md", storageDir, time.Now().Unix())
err := os.WriteFile(filename, []byte(content), 0644)
if err != nil {
log.Println("Error writing to file:", err)
@@ -40,11 +39,6 @@ func main() {
button,
))
w.Resize(fyne.NewSize(200, 100))
+ w.Canvas().Focus(input)
w.ShowAndRun()
}
-
-func getSHA256Hash(text string) string {
- hasher := sha256.New()
- hasher.Write([]byte(text))
- return hex.EncodeToString(hasher.Sum(nil))
-}