How to connect a "calculator" button on a keyboard with a call of a calculator?

I have a calculator button on my keyboard. Under Windows it starts Windows calculator. But under Xubuntu (but with kubuntu-desktop) it starts nothing, it is inactive. To start a calculator I have to choose it from Application > Utilities now.

How may I connect calculator button with calculator to start it as in Windows.


Solution 1:

if you are using Compiz Config Settings Manager (CCSM) You can use the "Commands" Plugin to "Assign bindings to arbitrary commands". The "Commands" Plugin can be easily installed by dropping the next in a terminal: sudo apt-get install compiz-plugins-extra.

Its powerful key grabber may have better chances to catch the custom keyboard buttons presses in order to provide the proper key binding which can be assigned to the proper command in the list. A Key Binding for a command, this is: "Run command 0" will invoke the line that you write in the Commands section related to the "Command line 0".

In the "Commands" tab of the "Commands Plugin", we write the arbitrary commands that we wish to be executed when we hit the proper key or key bindings, as shown in the next screenshot:

enter image description here

Then we click on the "Key Bindings" tab of the same window in order to enable the proper key bindings for the command. Please notice that I placed the command for the calculator in the "Command line 1" thus the key bindings will be which corresponds to the "Run command 1" as shown in the next screenshot.

enter image description here

What I did to see the "Edit Run command 1" key bindings it was to click in the "Disabled" button to the right, which showed me a window with a checkbox, after enabling it showed the options. Then simply hit the "Grab key combination" and press the proper button in your keyboard. Please notice that the key bindings corresponds to the "XF86Calculator" key.

This way you can define as many custom key bindings to fit your needs.

Good luck!

P.S. Compiz Config Settings Manager can be installed from the Software Center or by dropping sudo apt-get install ccsm in a terminal.

Solution 2:

Edit: Sorry, I somehow managed not to see that you are using KDE... This answer is for Xfce...

Afaik these keys can be assigned the same way as any other keyboard shortcuts:

Go to Settings -> Keyboard -> Shortcuts for Applications. (or similar - I'm using the German localization). There should be a button to add new custom keyboard shortcuts.

The first dialogue that pops up after pressing the add button will ask about the command that should be run. I don't know by heart, which calculator is installed on Xubuntu, but you can try to enter xcalc as command name, or maybe gnome-calculator.

The second dialogue will then record the key you press.