20
849
Fork
You've already forked fuzzel
83

main: add --preview-selection, prints outputs when selection changes #496

Closed
chills wants to merge 1 commit from chills/fuzzel:master into master
pull from: chills/fuzzel:master
merge into: dnkl:master
dnkl:master
dnkl:gnome-support
dnkl:releases/1.14
dnkl:issue-319-window-switching
dnkl:issue-561-nord-theme-only
dnkl:resvg-filtering-take-2
dnkl:resvg-filtering
dnkl:releases/1.13
dnkl:rehanzo-dont-ignore-execute-648
dnkl:keybinds-overwrite
dnkl:issue-561-refresh-theme
dnkl:ci-automated-testing
dnkl:reenable-legacy-icons
dnkl:releases/1.12
dnkl:test-coverage-for-fzf-caching
dnkl:releases/1.11
dnkl:releases/1.10
dnkl:releases/1.9
dnkl:releases/1.8
dnkl:releases/1.7
dnkl:releases/1.6
dnkl:releases/1.5
dnkl:releases/1.4
dnkl:releases/1.3
dnkl:releases/1.2
dnkl:releases/1.1
dnkl:releases/1.0
First-time contributor
Copy link

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.
main: add --preview-selection, prints outputs when selection changes
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval
1ec6cf21fe
dnkl left a comment
Copy link

I think the general idea here is fine, but there is way too much code duplication, and "patching" (e.g. resetting state to RUNNING) as it is now.

I would prefer a PR that perhaps introduces a larger refactoring, if it makes implementing this feature easier (and thus better).

I think the general idea here is fine, but there is way too much code duplication, and "patching" (e.g. resetting state to `RUNNING`) as it is now. I would prefer a PR that perhaps introduces a larger refactoring, if it makes implementing this feature easier (and thus better).
Collaborator
Copy link

@dnkl Could you say more about the kind of refactor you have in mind?

@dnkl Could you say more about the kind of refactor you have in mind?
Owner
Copy link

I'm not really sure, as I haven't tried to solve the problem myself. It's just that the code duplication, and the way KEEP_RUNNING is reset all over the place doesn't feel very clean.

I'm not really sure, as I haven't tried to solve the problem myself. It's just that the code duplication, and the way `KEEP_RUNNING` is reset all over the place doesn't feel very clean.
Collaborator
Copy link

I created an alt PR in #593.

I created an alt PR in #593.
Author
First-time contributor
Copy link

Closing for #593

Closing for https://codeberg.org/dnkl/fuzzel/pulls/593
chills closed this pull request 2025年06月22日 00:23:30 +02:00
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending approval
builds.sr.ht/freebsd-x64 Job completed
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval

Pull request closed

Please reopen this pull request to perform a merge.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fuzzel!496
Reference in a new issue
dnkl/fuzzel
No description provided.
Delete branch "chills/fuzzel:master"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?