I am trying to set which calculator will be called when I press the calculator button on the keyboard. My favourite calc app is Qalculate.
How can I set it be the default one so I can open it via calc button on my keyboard?
I am trying to set which calculator will be called when I press the calculator button on the keyboard. My favourite calc app is Qalculate.
How can I set it be the default one so I can open it via calc button on my keyboard?
I came here to find an answer which doesn't include moving around executables and creating links. Then realized that the answer is actually very simple and obvious:
Go to settings and create a custom key binding for whichever calculator app you want and calc key. Let it disable the old one. And that's it :)
I solved it following the link in this comment by @Wilf to this Ubuntu Forums thread
Ubuntu 13.10 uses the calculator tool gnome-caculator
. So instead of messing with the system, the easiest is to fake this shortcut with a symbolic link bound to qalculator
tool.
sudo mv /usr/bin/gnome-calculator /usr/bin/gnome-calculator_original
sudo ln -sT /usr/bin/qalculate /usr/bin/gnome-calculator
The shortcut works instantly.
gnome-calculator
may cause this to break by overwriting the symlink with an upgraded version of gnome-calculator
. Updating a keyboard shortcut that goes directly to qalculate
is recommended instead.
– Mark Stosberg
Aug 14 '19 at 15:35
The best option IMHO is to redefine the keybinding of the Calculator key, just as @user58635 said.
In order to make it more programatically, for example to include in a script to be executed after a new installation, these steps may be useful for more than one:
Set the current binding to none:
gsettings set org.gnome.settings-daemon.plugins.media-keys calculator ''
Or you can set it to another keybinding, e.g. pressing Shift+Calculator:
gsettings set org.gnome.settings-daemon.plugins.media-keys calculator '<Shift>Calculator'
Create a new custom keybinding for the Calculator key1:
If you have no other custom keybinding:
# Create a new set of custom keybindings
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
# Set the new custom keybinding (key, command, name)
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding 'Calculator'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command 'qalculate-gtk'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'Qalculate'
If you already have some custom keybinding in operation, you must add this as another one. For example:
# Create a new set of custom keybindings
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/']"
# Set the first custom keybinding (key, command, name)
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding 'Launch5'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command 'iceweasel -ProfileManager -no-remote'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'Iceweasel'
# Set the second (new) custom keybinding (key, command, name)
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ binding 'Calculator'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ command 'qalculate-gtk'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ name 'Qalculate'
If nothing happens at first try, just restart Gnome. In Gnome Shell it is just Alt+F2 and then press r+Enter
References:
1: Take this excellent answer as advice: https://askubuntu.com/a/597414/17564