This adds a --preview-selection flag. When it is set and fuzzel is running in dmenu mode, it will print an output every time the selection changes without exiting.
I think this covers what was requested in #428 but is a bit simpler (I don't think anything like hooks as discussed there are needed, xargs can suffice).
There's a video demo attached here (warning: flashing lights) using this in a niri window switching script:
niri msg -j windows |\
jq -r 'map("\(.title // .app_id)\t\(.id)\u0000icon\u001f\(.app_id)") | .[]' |\
stdbuf -oL nix run .#fuzzel -- -d --with-nth 1 --accept-nth 2 --preview-selection |\
xargs -n1 niri msg action focus-window --id
I don't really know C so I'm not sure if my approach here is quite right, so I've left this in a proof-of-concept state. At the very least, documentation and the completion script changes are missing. Happy for some guidance if I'm off track here.
This adds a `--preview-selection` flag. When it is set and fuzzel is running in dmenu mode, it will print an output every time the selection changes without exiting.
I think this covers what was requested in https://codeberg.org/dnkl/fuzzel/issues/428 but is a bit simpler (I don't think anything like hooks as discussed there are needed, `xargs` can suffice).
There's a video demo attached here (warning: flashing lights) using this in a niri window switching script:
```
niri msg -j windows |\
jq -r 'map("\(.title // .app_id)\t\(.id)\u0000icon\u001f\(.app_id)") | .[]' |\
stdbuf -oL nix run .#fuzzel -- -d --with-nth 1 --accept-nth 2 --preview-selection |\
xargs -n1 niri msg action focus-window --id
```
I don't really know C so I'm not sure if my approach here is quite right, so I've left this in a proof-of-concept state. At the very least, documentation and the completion script changes are missing. Happy for some guidance if I'm off track here.