Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Nohac opened this issue Apr 6, 2016 · 9 comments
Closed

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

Nohac opened this issue Apr 6, 2016 · 9 comments
Labels
Shell environment issue The shell setup is incorrect for use with rofi

Comments

@Nohac
Copy link

Nohac commented Apr 6, 2016

Version

Version: 0.15.12

Configuration

gist

Launch Command

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

Steps to reproduce

  • Start something using the launch command
  • make sure rofi is a background process
    eg: run from sxhkd or using this command from terminal:

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

What behaviour you see

  • Programs does not start
  • Nothing happens if rofi is launched from sxhkd
  • If running from the terminal, the launched application might crash or just use 100% cpu until it's manually killed

What behaviour you expect to see

@DaveDavenport
Copy link
Collaborator

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
Copy link
Author

Nohac commented Apr 6, 2016

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

sardemff7 commented Apr 6, 2016

Zsh will read:

  • .zshenv
  • .zprofile if -l (login mode)
  • .zshrc if -i (interactive mode)

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

@DaveDavenport
Copy link
Collaborator

aah that explains, thx.

@Nohac
Copy link
Author

Nohac commented Apr 6, 2016

@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..

@sardemff7 sardemff7 added the Shell environment issue The shell setup is incorrect for use with rofi label Oct 14, 2018
@jazoom
Copy link

jazoom commented Sep 29, 2019

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
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Shell environment issue The shell setup is incorrect for use with rofi
Projects
None yet
Development

No branches or pull requests

4 participants