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] rofi script mode only accept one colon (problem with filename which includes colons) #1718

Closed
matclab opened this issue Oct 3, 2022 · 6 comments
Labels
Milestone

Comments

@matclab
Copy link

matclab commented Oct 3, 2022

Rofi version (rofi -v)

1.7.5

Configuration

https://gist.github.com/matclab/e3600d7b89e898a6efdd35b595b25346#file-rofi-dump-txt

Theme

https://gist.github.com/matclab/e3600d7b89e898a6efdd35b595b25346#file-rofi-theme

Timing report

NA

Launch command

rofi -show mimeopen -modes 'mimeopen:echo -e b:1.pdf\nc.pdf'

Step to reproduce

  • launch the given command

Expected behavior

I would expect rofi to show a menu with

  • b:1.pdf
  • c.pdf

Actual behavior

But instead I get the error:

The script command 'mimeopen:echo -e b:1.pdf\\nc.pdf' has 3 options, but needs 2: <name>:<script>.

Additional information

I didn't see a way to escape colon.

Shall I try to send a PR which makes rofi accept several colons for the modi script argument ?

@matclab matclab added the bug label Oct 3, 2022
@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Oct 3, 2022

You should pass a path to a script (or executable name if in $PATH) as second argument, not inline the script.
(I never even think about people doing this).

For me this is a no-fix, this: mimeopen:echo -e b:1.pdf\\nc.pdf is not valid.

I will add a check to see if an actual executable file is passed as 2nd argument.

@matclab
Copy link
Author

matclab commented Oct 3, 2022

You can always expect random user to find interesting or stupid but unexpected way to use your tool ;-).

The initial use case was motivated by my scripts https://gitlab.com/matclab/rofi-file-selector (choosexe.sh) where I use a helper script to get a list of executables registered as able to open the mimetype of the given file.

I guess I can find a way to communicate the filename between the script calling rofi and the modi script (via temporary file for example), but at first look the command line was a nice way to do it.

Anyway, thank you for your very nice tool.
I close this issue.

@matclab matclab closed this as completed Oct 3, 2022
@DaveDavenport
Copy link
Collaborator

Interesting, always good to see the usecase.

I think argument to the script is a valid use-case.
What might be a good fix is to allow 'escaping' the ':'.
Currently it does a simple split on ':#' as separator, this we might need to change.

@DaveDavenport
Copy link
Collaborator

Can you check if that fix works ^^. I kept it simple, I only split once on ':'.

@matclab
Copy link
Author

matclab commented Oct 3, 2022

Wow, It was quick !
Yes. It seems to work flawlessly.
Simple is good.

Thank you very much !

@DaveDavenport DaveDavenport added this to the 1.7.6 milestone Oct 3, 2022
@github-actions
Copy link

github-actions bot commented Nov 4, 2022

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 Nov 4, 2022
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