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

5,473

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.

Solution 3

System Settings -> Shorcuts and Gestures -> Custom Shortcuts
Edit -> New -> Global Shortcut -> Command/URL
On Action tab Command/URL: type "kcalc"
On Trigger tab, click the button (possibly labelled "None") to enter a keyboard Shortcut.

Note that you may generalize this to use any calculator program (or any program) if you know the command that launches it - the above uses "kcalc" as an example.

I believe this is the only answer so far that works for KDE (as asked for) without some additional special package installed.

Thanks to user lueck at the below reference, for this info: https://forum.kde.org/viewtopic.php?f=15&t=96246

Share:
5,473

Related videos on Youtube

Garri Sumalapao Farol
Author by

Garri Sumalapao Farol

Updated on September 18, 2022

Comments

  • Garri Sumalapao Farol
    Garri Sumalapao Farol almost 2 years

    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.

  • SimplySimon
    SimplySimon almost 11 years
    You got me excited there, I have a social network button on my Packard Bell, but when I try to assign it to a command it reports as L and doesn't start anything, so not all keys can be used like that, I'm sorry to say.
  • Jez W
    Jez W almost 11 years
    Does this plugin have to be installed manually? (or alternatively which version of Ubuntu/ccsm is this?) - I've opened up mine (CCSM 0.9.9.0 on 13.04) and there's no commands plugin available anywhere (at least, not that I can see)
  • Geppettvs D'Constanzo
    Geppettvs D'Constanzo almost 11 years
    I can't remember if it came pre-installed with the default plugins but you can try installing the Extra Plugins by dropping in a terminal: sudo apt-get install compiz-plugins-extra and check again. Please inform if you succeed.
  • Geppettvs D'Constanzo
    Geppettvs D'Constanzo almost 11 years
    Already edited, thank you for pointing that. :) Don't forget to let us know if you succeed with your key binding for your calculator.
  • ImaginaryRobots
    ImaginaryRobots almost 11 years
    if that key is coming through as an L, you may need to change keyboard layouts. Try these instructions: wikihow.com/Change-Keyboard-Layout-in-Ubuntu
  • soulsource
    soulsource almost 11 years
    With laptops it's often a different issue. Many of the laptop special keys require that a special WMI driver for the respective laptop model is installed.