diff options
| author | Paul Buetow <paul@buetow.org> | 2024-01-25 20:03:12 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-01-25 20:03:12 +0200 |
| commit | 61275a73f3d1d6559fca3c706b4dba30f326f3e9 (patch) | |
| tree | ac48a98a3b360400942a0916c385b757aba9a6fd /main.go | |
| parent | 5d8a28040830bdd1c05809bae298602008e275da (diff) | |
focus input window
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -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)) -} |
