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

[BUG] Empty keybind arguments appear to be skipped #1950

Closed
2 tasks done
lonkaars opened this issue Feb 27, 2024 · 9 comments
Closed
2 tasks done

[BUG] Empty keybind arguments appear to be skipped #1950

lonkaars opened this issue Feb 27, 2024 · 9 comments
Labels

Comments

@lonkaars
Copy link

Rofi version (rofi -v)

Version: 1.7.5

Configuration

https://gist.github.com/lonkaars/b3bed963fd102a0ff76af67cf892d37d#file-rofi-dump-config

Theme

https://gist.github.com/lonkaars/b3bed963fd102a0ff76af67cf892d37d#file-rofi-dump-theme

Timing report

No response

Launch command

rofi -no-config -kb-mode-previous '' -kb-mode-next '' -show run

Step to reproduce

Run:

rofi -no-config -kb-mode-previous '' -kb-mode-next '' -show run

Expected behavior

I expected rofi to parse the empty arguments as empty keysims, effectively un-binding the keys

Actual behavior

rofi appears to skip the empty arguments entirely, which results in the following error:
image

Additional information

Substituting the empty strings for comma's seems to mitigate the issue:

rofi -no-config -kb-mode-previous ',' -kb-mode-next ',' -show run

My guess is that rofi parses a single comma as a list of two empty keysims, and does not skip the arguments because they are no longer empty. Man rofi-keys(5) does describe the usage of the comma to specify multiple keybinds for the same action, but unbinding a key only seems to be documented in the online manpage.

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version
@DaveDavenport
Copy link
Collaborator

I cannot reproduce:

rofi -no-config -kb-mode-previous '' -kb-mode-next '' -show keys

works.

rofi-2024-02-27-2334-00000

@DaveDavenport
Copy link
Collaborator

Tested, works with latest and 1.7.5.

I can reproduce your error:

rofi -no-config -kb-mode-previous  -kb-mode-next -show keys

are you sure you shell/launcher passes empty arguments?

@lonkaars
Copy link
Author

lonkaars commented Feb 27, 2024

If I substitute rofi for printf -- '"%s"\n':

$ printf -- '"%s"\n' -no-config -kb-mode-previous '' -kb-mode-next '' -show keys
"-no-config"
"-kb-mode-previous"
""
"-kb-mode-next"
""
"-show"
"keys"

So I guess it works as intended?

Edit: tested with ZSH 5.9, Bash 5.2.26 and Dash 0.5.12. All show the above output

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Feb 27, 2024

What shell do you use, because from your error message, those empty ones are not there.
It tries to interper '-show' as the value of '-kb-mode-next'.

For me with bash, your example works fine (see screenshot).

also tested zsh 5.9, works fine.

This does not feel like a rofi issue because rofi code does not skip 'empty' arguments (it gets an array passed), but I am unsure why for you the shell does not pass those .

@lonkaars
Copy link
Author

Calling rofi from python does seem to work on my system (os.exec does not run in a shell):

#!/bin/python3
import os
os.execv('/bin/rofi', [ 'rofi', # argv[0] needs to be passed again
  '-no-config',
  '-kb-mode-previous', '',
  '-kb-mode-next', '',
  '-show', 'keys'
])

I am unsure why this works, while the shell does not

@DaveDavenport
Copy link
Collaborator

Ok, that confirms it aint rofi's fault, but I wonder why your shell is behaving differently for you then me.

@lonkaars
Copy link
Author

This is incredibly embarassing, I had a wrapper around rofi in my home directoy that set some environment variables which did not properly forward the arguments. Thanks for helping out though!

@DaveDavenport
Copy link
Collaborator

Happy the problem is resolved .

Copy link

This pull request 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 Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants