Any keypress crashed rofi's calc mode
hjpotter92 opened this issue · 9 comments
I build rofi-calc from source.
➜ sudo make install
make[1]: Entering directory '/home/hjpotter92/Documents/rofi-calc/build'
make[1]: Nothing to be done for 'install-exec-am'.
/bin/mkdir -p '/usr/local/lib/rofi/'
/bin/bash ./libtool --mode=install /usr/bin/install -c calc.la '/usr/local/lib/rofi/'
libtool: install: /usr/bin/install -c .libs/calc.so /usr/local/lib/rofi/calc.so
libtool: install: /usr/bin/install -c .libs/calc.lai /usr/local/lib/rofi/calc.la
libtool: warning: remember to run 'libtool --finish /usr/local/lib/rofi/'
make[1]: Leaving directory '/home/hjpotter92/Documents/rofi-calc/build'
➜ sudo ./libtool --finish /usr/local/lib/rofi/
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/sbin" ldconfig -n /usr/local/lib/rofi/
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib/rofi/
.
.
.
when I actually run rofi-calc
, it opens the rofi's dmenu but on any keypress it sends the signal 6:
➜ rofi -show calc -modi calc -no-show-match -no-sort
** (process:4869): ERROR **: Process errored with: Child process killed by signal 6
[1] 4869 trace trap rofi -show calc -modi calc -no-show-match -no-sort
Found the problem!
qalc
tries to download currency metadata on first launch. If the $HOME/.qalculate
folder does not exist and currency support is not explicitly disabled (-nocurrencies
) this prompt will be presented to the user:
You need the download exchange rates to be able to convert between different currencies.
You can later get current exchange rates with the "exchange rates" command.
Do you want to fetch exchange rates now from the Internet (default yes)?
rofi-calc
can't really deal with the prompt and crashes. I did not find a clean solution to skip the prompt, therefore I just forked the project and disabled currency support.
@svenstaro Should I open up a pull request? My fix definitely isn't a good solution, but at least it works 🤷♂️.
I will investigate. I had this problem too and thought I did something so it will always download the currencies without prompting.
@svenstaro I think I know why it works on your end. The libqalculate
Debian package is pretty old (0.9.7-9.2) while the Arch version is, to the surprise of absolutely no one, is very recent (2.6.1-1).
The newer versions don't present the prompt on first startup and also accept -version
as a parameter to check which version is installed. The old ones do not support the -v
argument, but interpret it as literal input, which doesn't really ease version detection efforts. The solution I'm proposing is to look for -v, -version
in the -h
output of qalc
. If the search yields no results, disable currency conversion, if it does check the version and enable currency conversion based on that.
Another solution, which I'd consider the easiest to implement would be to just add an invocation of qalc
to the installation instructions in the README
.
Both solutions are somewhat hacky, but I can't really think of another way besides directly calling into libqalculate
, which also doesn't really work around the problem with different versions.
From the releases page, it seems that the version in Debian is 8 years old. Do you really think that there is merit to supporting such an old version?
Fair point. A semi-recent version is already present in the Debian experimental
channel, and the version upgrade is seemingly blocked by a bug report filed in 2009. I'll contact the package maintainer and hope for the best.
I think denoting a minimum supported libqalculate
version in the README
would be useful regardless.
I added this to the README. Does this work for you?
Recompiling and isntalling qalculate to /usr/bin/
(default install is to /usr/local/bin/
) solved the issue.
Thanks a ton @svenstaro and @PhilipTrauner :)
Any ideas how I can configure rofi's combi
to also work with rofi-calc
? I'd like something similar to apple's launcher, which allows for calculations to be done from inside itself.
Right now, I use Ctrl-Tab
to switch between calc and combi:
rofi.combi-modi: window,drun,ssh,run
rofi.modi: combi,calc
rofi.show: combi
@svenstaro Yep, looks good to me 👍
@hjpotter92 I invoke it like this:
rofi -show calc -modi calc -no-show-match -no-sort
I don't think mixing it into the combi would work very well. However, I'm currently building a new tool which also has graphing and all that really fancy stuff built in. I believe I've reached the extent of what rofi will support.