davatorium / rofi

Rofi: A window switcher, application launcher and dmenu replacement
https://davatorium.github.io/rofi/
Other
13.29k stars 612 forks source link

Custom -run-command fails to launch any program #375

Closed Nohac closed 8 years ago

Nohac commented 8 years ago

Version

Version: 0.15.12

Configuration

gist

Launch Command

rofi -run-command "zsh -i -c '{cmd}'" -show run

Steps to reproduce

rofi -run-command "zsh -c -i '{cmd}'" -key-run F2 &

What behaviour you see

DaveDavenport commented 8 years ago

hmm I can only reproduce this with zsh.

Does it also happen when you do not pass the -i flag to zsh (this fixes it for me). This looks to be not applicable here.

Nohac commented 8 years ago

When using this command from terminal whithout -i: rofi -run-command "zsh -c '{cmd}'" -key-run F2 & I can successfully launch programs, but -i is required to access aliases etc. it seems. With -i, the program starts to consume 100% until I kill it.

From sxhkd, both with and without -i does nothing, this is the sxhkd config:

alt + {_,shift} + space
    rofi -run-command "zsh -c -i '{cmd}'" -show {run,window}
sardemff7 commented 8 years ago

Are you sure your sxhkd configuration works as expected? It seems that {} have a special meaning in there, so maybe the {cmd} for rofi is conflicting?

I cannot reproduce from a terminal. Zsh 5.2 here.

DaveDavenport commented 8 years ago

I am unsure why -i is needed for aliases, given it is:

-i Force shell to be interactive.

According to manpage. Can try setting run-command Xresources? to see if it is conflicting syntax?

sardemff7 commented 8 years ago

Zsh will read:

Usually, you define aliases in .zshrc because it is where they make sense, but in this case, you could actually use .zshenv.

DaveDavenport commented 8 years ago

aah that explains, thx.

Nohac commented 8 years ago

@sardemff7 You were right about the {cmd} in sxhkd, it strips out {} from the command, so it only tries to run cmd. I can't find a way to escape the curly brackets either, it must be a bug with sxhkd, or just something I've overlooked.

But that still doesn't explain why something like rofi -run-command "zsh -c -i 'vim'" -show run & hangs and uses 100% cpu. htop shows zsh -c -i vim as the command that hangs and uses all the cpu. The same command works from the terminal.

edit: I worked around the sxhkd issue by making a script, now everything seems to work. Thanks and I'm sorry for wasting your time, still weird about the background process issue though..

jazoom commented 5 years ago

I worked around the sxhkd issue by making a script, now everything seems to work.

I just used back slashes and it seems to have escaped them. This works fine for me:

rofi -show drun -run-command 'gksudo \{cmd\}'

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.