Run -calc-command on Enter?
ryanerwin opened this issue · 3 comments
Is there a way to get the -calc-command to run every time we hit enter?
So instead of CTRL + Enter to run -calc-command
, every time we hit enter
we would run -calc-command
?
This way usage would only be Enter to finalize each line and Esc when you're all done.
Personally I don't remember to hit CTRL + Enter, and this way we've got one less thing to remember.
Also, if anyone is having problems getting calc-command
to interpolate properly, you may need to escape your curly brackets { }.
I was trying to get rofi-calc work from sxhkd and each time "{result}" would fail to be interpolated. I didn't immediately notice that the curly braces were missing...
If you're literally getting "result" on your clipboard instead of your desired calculation output, try escaping both of the curly braces and it should work.
XF86Calculator
rofi -show calc -modi calc -no-show-match -no-sort -calc-command 'echo -n "\{result\}" | xclip -sel clip'
This seems like it would be as simple as rebinding the keys using some CLI flags: -kb-accept-custom
is defaulting to Control+Return
but you could just do -kb-accept-custom Return
. You may need to unbind -kb-accept-entry
(which also binds just Return
).
About your second part: I'd appreciate a PR for the README if you think this would help more people.
I suspect the { }issue in my case is zsh
or perhaps some zsh setting.
I'll try to find the exact factors and then make a PR when I track them down.
Happy to help. This is a great project idea!
As you suspected, I had to unbind -kb-accept-entry "Control+Return"
to get custom-entry Return
to work, which isn't a huge improvement for me overalll.
After using Rofi for a few weeks, I hadn't even noticed that rofi will usually let you use Control + Enter will let you use the custom entry... I need to figure out how to more easily run shell commands with that. I think using Ctrl + Enter as you did is a great way - I Just need to learn more about how Rofi works.