You are not logged in.
Pages: 1
I am using Arch + sway.
I am trying to have a vary little and simple file launcher.
I have a small script like
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" &
It works very well if I execute the script in terminal.
But I want to use it as Rofi, for example, I will keybind to open terminal and run the script in it.
If I execute by keybinding like
bindsym Alt+r exec foot -e /path/to/script
it will start foot and run fzf in it but it does not launch the file by select and enter.
What I am missing.
Last edited by duyinthee (2022-08-26 10:20:51)
Offline
Try removing the trailing '&' from your script...
Notifications for Arch Linux package updates
Wayland.
"We are eternal, all this pain is an illusion" - Maynard James Keenan
Offline
Yeah, by removing "&", it will launch the file but the terminal will not close.
Offline
"… & disown"
Online
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && "xdg-open "$file" & disown"
and
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" & disown
both do not work.
Offline
What do you mean by "do not work"?
What happens?
Is this maybe an issue of https://bbs.archlinux.org/viewtopic.php … 6#p2053636 ?
Edit: the 2nd one btw. the 1st one is nonsensical
Last edited by seth (2022-08-26 13:34:31)
Online
I mean it will not open the file.
the script, the 2nd one, btw
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xdg-open "$file" & disown
will not open the file but the terminal will close.
the way I am trying is that I set keybind to the script to open terminal (foot) and run the script.
so I have this
bindsym Alt+r exec foot -e /path/to/script
in my ~/.config/sway/config.
Then I will hit Alt+r and terminal (foot) will open, fzf in it, I type something for search and hit enter.
Here the way I way I want is that, the file open and the terminal (foot) will close.
I still can't get it works.
Offline
Can you "… && xterm & disown" (assuming xterm is installed) ie. run anything but xdg-open?
Online
Yes.
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xterm & disown
the terminal (foot) will close but xterm will not open.
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && xterm && disown
the terminal (foot) will not close but xterm will open.
I tested with alacritty and firefox. All same.
Last edited by duyinthee (2022-08-27 00:38:06)
Offline
the terminal (foot) will not close but xterm will open.
Because that is nonsens. Please do not enter random strings into a shell, you could end up screwing yourself badly.
#!/bin/bash
file=$(fzf)
[ -f "$file" ] && nohup xdg-open "$file" & disown
#!/bin/bash
file=$(fzf)
[ -f "$file" ] || exit
[ -e /dev/fd/0 ] || exec 0</dev/null
[ -e /dev/fd/1 ] || exec 1>/dev/null
[ -e /dev/fd/2 ] || exec 2>/dev/null
xdg-open "$file" & disown
Online
Pages: 1