Comments (15)
That seems reasonable to me. It should then just output the command line on stdout?
from j4-dmenu-desktop.
My solution is to override the SHELL
variable.
Create a file which will be used as the fake shell:
#!/bin/bash
function run_dmenu {
while test $# -gt 0; do
[[ $1 == fzf ]] && return 0
shift
done
return 1
}
if run_dmenu $*; then
SHELL=/bin/bash exec /bin/bash "$@"
else
shift
[[ $1 == -c ]] && shift
exec echo "$@"
fi
Then use j4dd like this:
cmd=$(SHELL=/path/to/fake_shell j4-dmenu-desktop --dmenu=fzf | sed -n 2p)
[[ -n "$cmd" ]] && i3-msg exec "$cmd"
from j4-dmenu-desktop.
Is this going to be resolved? I would also like to use fzf as an app launcher, but i3dd + fzf is too slow for my liking. For me, j4dd just doesn't detach from the terminal. Would this be possible to implement?
from j4-dmenu-desktop.
That seems reasonable to me. It should then just output the command line on stdout?
That'd be great!
from j4-dmenu-desktop.
It should be possible to integrate fzf and dmenu without changing this application. Maybe fzf even supports a "pipe-through" mode? (maybe something like j4-d-d --dmenu="fzf --pipe-into-and-read-input-from=dmenu"
)
from j4-dmenu-desktop.
Yeah, I think something like that. FZF is a standard UNIX pipe.
On Fri, Nov 6, 2015, 19:01 enkore [email protected] wrote:
It should be possible to integrate fzf and dmenu without changing this
application. Maybe fzf even supports a "pipe-through" mode? (maybe
something like j4-d-d --dmenu="fzf --pipe-into-and-read-input-from=dmenu")—
Reply to this email directly or view it on GitHub
#48 (comment)
.from Google Inbox
from j4-dmenu-desktop.
Please excuse me this little necrobump, but I'm struggling with this approach:
j4-dmenu-desktop --dmenu="fzf --prompt='Run: ' --height 100% --reverse --cycle"
It works, but the selected process is not being started in background and therefore it blocks the launcher terminal from exiting. The same approach works 100% fine using i3-dmenu-desktop
and the terminal is gone after application is selected:
i3-dmenu-desktop --dmenu="fzf --prompt='Run: ' --height 100% --reverse --cycle"
... but it's noticeably (painfully) slower :(
@enkore, is there a reason those two behave differently? Can I get somehow j4dd
to behave like i3dd
?
from j4-dmenu-desktop.
IIRC i3dd uses some proprietary i3 stuff (i3-sendmsg or so) to have i3 start the process on its behalf, j4dd stopped doing that years ago to be independent of i3.
Try
j4-dmenu-desktop --dmenu="fzf --prompt='Run: ' --height 100% --reverse --cycle" &
from j4-dmenu-desktop.
Adding simple ampersand at the end of command results in:
Failed to read /dev/tty
and nothing shows up.
I believe that i3dd
uses i3-msg exec <cmd>
.
Would it be possible to just return the selection from j4dd
instead of executing it (something like --no-exec)?
Then I could use it this way:
selection=$(j4-dmenu-desktop --no-exec --dmenu="fzf --prompt='Run: ' --height 100% --reverse --cycle")
[[ -z $selection ]] || i3-msg exec $selection
from j4-dmenu-desktop.
@ritobanrc see my comment above - someone would have to implement a switch to disable automatic selection execution 🙏
from j4-dmenu-desktop.
so I got this to work with two scripts like this: (on sway)
----------$HOME/scripts/dmenu-fzf.sh--------------------
#!/bin/bash
swaymsg '[title="dmenu-fzf"]' kill ||
alacritty -t dmenu-fzf -e $HOME/scripts/j4-dmenu-fzf.sh
------------$HOME/scripts/j4-dmenu-fzf.sh----------------------
#!/bin/bash
swaymsg '[title="dmenu-fzf"]' kill ||
alacritty -t dmenu-fzf -e $HOME/scripts/j4-dmenu-fzf.sh
its not perfect though, I'm not sure if the Path part of .desktop files is being respected like this...
would be much nicer, if the launched program would just be disowned by j4-dmenu automatically, so the terminal could close afterwards
from j4-dmenu-desktop.
Nevermind I just found out about the wrapper part:
#!/bin/bash
swaymsg '[title="dmenu-fzf"]' kill ||
alacritty -t dmenu-fzf -e j4-dmenu-desktop --wrapper='swaymsg exec' --dmenu=fzf
from j4-dmenu-desktop.
FYI: The code for --no-exec
is already in develop
branch 🍾
from j4-dmenu-desktop.
I don't quite understand the difference to --wrapper.
Right now you would use
alacritty -t dmenu-fzf -e j4-dmenu-desktop --wrapper='swaymsg exec' --dmenu=fzf
with --no-exec you would do
alacritty -t dmenu-fzf -e swaymsg exec $(j4-dmenu-desktop --dmenu=fzf --no-exec)
Am I missing something? This would still involve swaymsg / i3msg or any other program to spawn the program.
What I'd have thought would be a good solution is a --bg / --disown flag, that spawns the program in the background and then terminates j4-dmenu-desktop.
That way you could just do
alacritty -t dmenu-fzf -e j4-dmenu-desktop --dmenu=fzf --bg
from j4-dmenu-desktop.
That would be pretty simple, just fork+setsid before executing.
if(background)
switch(fork()) {
case 0:
setsid();
break;
case -1:
perror("fork");
return 1;
default:
return 0;
}
exec(...);
from j4-dmenu-desktop.
Related Issues (20)
- Reimplement #137
- Add GitHub actions
- Signed releases HOT 5
- Add contributing help
- Consider switching to C++17 HOT 1
- Reconsider history
- Add proper logging
- Exec parsing issues/Wrong shell being used HOT 4
- Fix --no-exec HOT 1
- Always load GenericNames HOT 1
- Allow compiling with system-installed loguru HOT 6
- Error when running j4-dmenu-desktop without sudo HOT 5
- Handle non-readable desktop files properly HOT 1
- Switch to spdlog HOT 1
- r3.0 release HOT 10
- tests fail on non x86_64 and x86 HOT 5
- Thoroughly test j4-dmenu-desktop on i3
- Implement system testing HOT 2
- TryExec is not acknowledged
- j4-dmenu-desktop --no-exec improperly handles terminal applications HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from j4-dmenu-desktop.