Skip to content

Commit

Permalink
commands: fix applications cache not being cleared, properly clear cl…
Browse files Browse the repository at this point in the history
…ipboard
  • Loading branch information
abenz1267 committed Jan 20, 2025
1 parent 20259e0 commit 2d35464
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.8-git
0.12.8
5 changes: 5 additions & 0 deletions internal/modules/clipboard/clipboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,8 @@ func (c *Clipboard) Delete(entry util.Entry) {

util.ToGob(&c.items, c.file)
}

func (c *Clipboard) Clear() {
c.items = []ClipboardItem{}
c.entries = []util.Entry{}
}
7 changes: 6 additions & 1 deletion internal/ui/interactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/abenz1267/walker/internal/config"
"github.com/abenz1267/walker/internal/history"
"github.com/abenz1267/walker/internal/modules"
"github.com/abenz1267/walker/internal/modules/clipboard"
"github.com/abenz1267/walker/internal/state"
"github.com/abenz1267/walker/internal/util"
"github.com/diamondburned/gotk4/pkg/core/gioutil"
Expand Down Expand Up @@ -45,11 +46,15 @@ func setupCommands() {
return true
}
commands["clearapplicationscache"] = func() bool {
os.Remove(filepath.Join(util.CacheDir(), "applications.json"))
os.Remove(filepath.Join(util.CacheDir(), "applications.gob"))
return true
}
commands["clearclipboard"] = func() bool {
os.Remove(filepath.Join(util.CacheDir(), "clipboard.gob"))

m := findModule("clipboard", available)
m.(*clipboard.Clipboard).Clear()

return true
}
commands["cleartypeaheadcache"] = func() bool {
Expand Down

0 comments on commit 2d35464

Please sign in to comment.