Biont / sway-launcher-desktop

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

Use it as a finder / search for files #41

Open choucavalier opened 3 years ago

choucavalier commented 3 years ago

Is it possible to configure sway-laucher-desktop to also search for files (fuzzy finding with fzf) and open them with xdg-open?

In other words, is it possible to use it for searching not only binaries and desktop entries but also search files and open them?

Biont commented 3 years ago

This should be possible with a custom provider, yes. There's a description of how it works in the Readme. The use of custom providers replaces the builtin ones though, so using a custom provide in addition to the builtin ones is currently not possible

choucavalier commented 3 years ago

Too bad they cannot be combined.

I think this would be a great addition to this launcher. Basically, it would be a use-case similar to what the Spotlight launcher does for macOS.

I often find myself wanting to access a specific document (like a PDF or an image) and would love to be able to quickly fuzzy find it with `sway-launcher-desktop'.

But loosing the ability to also launch applications is a big downside.

Biont commented 3 years ago

I totally agree and I've been thinking about this myself. Maybe we could add a flag that controls whether or not to include the builtins. Or add some way to refer to them in a provider config file (or: support this kind of flag in the file parser).

mathroc commented 3 years ago

@Biont it's not too bad if we want to include the defaults providers, just add something like this in the config file:

[desktop]
list_cmd=/path/to/sway-launcher-desktop.sh list-entries
preview_cmd=/path/to/sway-launcher-desktop.sh describe-desktop "{1}"
launch_cmd=/path/to/sway-launcher-desktop.sh run-desktop '{1}' {2}

[command]
list_cmd=/path/to/sway-launcher-desktop.sh list-commands
preview_cmd=/path/to/sway-launcher-desktop.sh describe-command "{1}"
launch_cmd=alacritty -e {1}

however, it won't keep in sync if you want to change something, add another, etc. maybe it would be enough to check that the config file starts with the line !keep builtin providers (or anything similar you deem appropriate)

Biont commented 3 years ago

Cool. I was thinking this would work, but I never actually tried. Good to know. I guess I should rather think about documenting thinks like this. Thanks!

Biont commented 3 years ago

I just added a section in the README: 01618435a543af7926f658f6f33f1e187c03bd55