從鍵盤開啟/關閉滑鼠鍵

從鍵盤開啟/關閉滑鼠鍵

我在通用存取功能表和許多帖子以及此文件頁面中打開了滑鼠鍵:

https://help.ubuntu.com/11.10/ubuntu-help/mouse-mousekeys.html

提及 NUMLOCK 或 SHIFT+NUMLOCK 可開啟或關閉此功能。這些都不適合我。我顯然可以關閉此功能的唯一方法是使用通用存取選單,如果我只想將其關閉以輸入幾個數字,那麼這很煩人。

我在 Windows 上使用滑鼠鍵,效果很好。

我跑的是 Ubuntu 11.10,鍵盤是 MS Ergonomic 4000。

我想知道是否有其他一些配置設定妨礙了?

答案1

我有同樣的問題。我也(仍然)使用 Ubuntu 11.10。

在我的日常工作中,我使用滑鼠鍵主要是因為我喜歡使用 num-5 鍵來按下滑鼠鍵。

然後我發現在Unity 中你可以做非常好的視窗平鋪(ctrl-alt-num4 將視窗發送到螢幕左側,ctrl-alt-num6 發送到右側,ctrl-alt-9 發送到右上角,等等等)。

因此,為了平鋪窗口,我想暫時停用滑鼠鍵。

我在這裡找到了答案:http://ubuntuforums.org/showpost.php?p=11776864&postcount=4

我將腳本儲存為 ubuntu-toggle-mousekeys,當我需要時,我輸入:

bash ubuntu-切換滑鼠鍵

....在我的終端中。

這是我稍微修改過的腳本 - 我只是添加了一些評論:

#!/bin/bash

# http://ubuntuforums.org/showthread.php?t=1942984

# I needed this when I connected a big monitor to my ubuntu laptop.
# Unity has nice window tiling shortcuts that need the number keypad to work.
# ctrl-alt-num4 sends a window left, ctrl-alt-num6 sends a window right, etc.

STATUS=$(gsettings get org.gnome.desktop.a11y.keyboard mousekeys-enable) #Are mousekeys on (true or false)

if [ "$STATUS" == "true" ]
then
  gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable false 

  notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "                    Mousekeys OFF"
  echo "Mousekeys are OFF - use ctrl-alt-num4 to send window left, ctrl-alt-num6 to send window right"

else
  gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable true

  notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "                    Mousekeys ON"
  echo "Mousekeys are ON"
fi

答案2

bash 程式碼不起作用,請嘗試以下操作:

#!/usr/bin/env ruby

# http://ubuntuforums.org/showthread.php?t=1942984

# I needed this when I connected a big monitor to my ubuntu laptop.
# Unity has nice window tiling shortcuts that need the number keypad to work.
# ctrl-alt-num4 sends a window left, ctrl-alt-num6 sends a window right, etc.

#Are mousekeys on (true or false)
r = `gsettings get org.gnome.desktop.a11y.keyboard mousekeys-enable`

p r

if r =~ /true/i
  `gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable false `
  `notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "Mousekeys OFF" `
  puts "Mousekeys are OFF - use ctrl-alt-num4 to send window left, ctrl-alt-num6 to send window right"

else
  `gsettings set org.gnome.desktop.a11y.keyboard mousekeys-enable true `

  `notify-send -i  "/usr/share/icons/gnome/48x48/devices/keyboard.png" "Mousekeys ON" `
  p "Mousekeys are ON"
end

相關內容