如何将 Qalculator 设置为默认计算器?

如何将 Qalculator 设置为默认计算器?

我正在尝试设置按下键盘上的计算器按钮时将调用哪个计算器。我最喜欢的计算应用程序是 Qalculate。

我如何将其设置为默认值,以便我可以通过键盘上的计算按钮打开它?

答案1

我来这里是为了找到一个不包括移动可执行文件和创建链接的答案。然后意识到答案实际上非常简单和明显:

设置并为您想要的任何计算器应用程序和 calc 键创建自定义键绑定。让它禁用旧的。就这样 :)

答案2

我按照以下链接解决了这个问题@Wilf 的评论此 Ubuntu 论坛主题

Ubuntu 13.10 使用计算器工具gnome-caculator。因此,与其扰乱系统,最简单的方法是使用绑定到qalculator该工具的符号链接来伪造此快捷方式。

sudo mv /usr/bin/gnome-calculator /usr/bin/gnome-calculator_original
sudo ln -sT /usr/bin/qalculate /usr/bin/gnome-calculator

该快捷方式立即生效。

答案3

我认为最好的选择是重新定义Calculator键的键绑定,就像@user58635 所说的那样。

为了使其更具编程性,例如将其包含在新安装后要执行的脚本中,以下步骤可能对多个步骤有用:

  1. 将当前绑定设置为无:

    gsettings set org.gnome.settings-daemon.plugins.media-keys calculator ''
    
    • 或者您可以将其设置为另一个键绑定,例如按Shift+ Calculator

      gsettings set org.gnome.settings-daemon.plugins.media-keys calculator '<Shift>Calculator'
      
  2. 为计算器键1创建新的自定义键绑定:

    1. 如果您没有其他自定义键绑定:

      # 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'
      
    2. 如果你已经使用了一些自定义键绑定,则必须将其添加为另一个。例如:

      # 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'
      
  3. 如果第一次尝试没有任何反应,只需重新启动 Gnome。在 Gnome Shell 中,只需按Alt+ F2,然后按r+Enter


参考:

1:把这个优秀的答案当作建议:https://askubuntu.com/a/597414/17564

相关内容