junegunn / fzf

:cherry_blossom: A command-line fuzzy finder
https://junegunn.github.io/fzf/
MIT License
61.81k stars 2.35k forks source link

Running `fzf -f whatever` with an `i3` keybinding fails #3895

Closed a-pav closed 1 week ago

a-pav commented 1 week ago

Checklist

Output of fzf --version

0.53.0 (c4a9ccd)

OS

Shell

Problem / Steps to reproduce

I have this following script placed at ~/.config/0_conf/t.sh

#!/bin/sh

printf '%s\n' "running..." >> '/tmp/q'; # DEBUG
ls -al ~ | fzf -f conf >> /tmp/q

When I run this file directly inside the terminal, these lines are printed into /tmp/q file:

running...
drwxr-xr-x 61 pav     pav       4096 Jun 24 10:57 .config
-rw-rw-r--  1 pav     pav          0 Apr 20 11:20 .gitconfig

But when I trigger it with an i3 keybinding like:

bindsym --release $hyper+e exec --no-startup-id ~/.config/0_conf/t.sh

only

running...

is printed to /tmp/q file.

I'm not sure what is causing this. This is the first time ever I'm having such a strange issue with a program triggered by an i3 keybinding.

a-pav commented 1 week ago

I've been at this for more than I care to admit and just minutes after I create this issue, I found what the problem is: fzf is only set in PATH for the current shell session in ~/.fzf.zsh file.

Fix is

-ls -al ~ | fzf -f conf >> /tmp/q
+ls -al ~ | ~/.fzf/bin/fzf -f conf >> /tmp/q

Or properly setting the PATH system wide.