svenstaro / rofi-calc

🖩 Do live calculations in rofi!
MIT License
991 stars 32 forks source link

request: automatic clipboardness #3

Closed chapmanjacobd closed 5 years ago

chapmanjacobd commented 6 years ago

I would like to have rofi-calc to copy the current result to the clipboard and close rofi when ctrl+c is pressed

How could this be implemented? thanks Sven!

chapmanjacobd commented 6 years ago

preferably everything to the right of the last equal sign unless there are more than one equal signs

svenstaro commented 6 years ago

Yeah sounds cool, I'm going to implement that.

chapmanjacobd commented 6 years ago

maybe this would actually be better implemented within rofi

https://github.com/DaveDavenport/rofi/issues/378

matt-snider commented 5 years ago

@svenstaro I think a simple thing to do would be to just allow -run-command to be specified like rofi run provides, perhaps with different format options (e.g. {equation}, {result}).

Currently, the behaviour when selecting a history entry is to printf the equation and result (i.e. -run-command "echo {equation} = {result}"). Selecting the current equation with Enter results in "Add to history" being run, so I think it would also be necessary to bind "Ctrl+Enter" or similar to the same sort of behaviour as selecting a history entry.

matt-snider commented 5 years ago

I didn't really finish that thought - this would allow -run-command "echo {result} | xclip" or similar and would provide the most flexibility

svenstaro commented 5 years ago

Would you like to take a stab at implementing that? I'm not quite sure how to do that right now.

matt-snider commented 5 years ago

@svenstaro Sure, I'll give it a try!