Biont / sway-launcher-desktop

TUI Application launcher with Desktop Entry support. Made for SwayWM, but runs anywhere
GNU General Public License v3.0
606 stars 28 forks source link

Introduce function to purge invalid entries from history #58

Closed Biont closed 2 years ago

Biont commented 2 years ago

Fix #50

Introduces a public function that iterates over the history file and runs each line against a validation callback (referred to as purge_cmd when writing custom providers)

If this command ~exits with 0, the entry is kept in the file~ exits with 43, the entry is removed from file.

PedroHLC commented 2 years ago

This works well after deleting some files from ~/.local/share/applications. Are you still not considering pushing it upstream?

Biont commented 2 years ago

@WhyNotHugo I think your comment made a lot of sense and I've taken a fair share of time to consider its implications. Maybe it shouldn't have taken me half a year, but I'm slow at times. So I had a look at common exit codes and chose 43 EIDRM (Identifier removed). I'm stretching its intended use a bit because as far as I understand, it's meant to be used in IPC, but then again, it's probably obscure enough to act as a very explicit and deliberate signal for removal.

What do you think?

(cc @PedroHLC, I hope we're getting close now :) )