Переключить навигацию с помощью клавиатуры (также известную как навигация с помощью мыши) с помощью клавиатуры

В KDE, есть ли способ переключать «навигацию по клавиатуре», также известную как «клавиши мыши» используя клавиатуру? В идеале я хотел бы привязать эту функциональность к Scroll Lock. Этот вопрос касается того, есть ли собственный способ или программа, которую я могу установить.

Мне бы хотелось, чтобы это было так же просто, как нажать «применить» в диалоговом окне «Настройки системы-> Клавиатура». Сейчас я делаю это через диалог настроек системы несколько раз в день и пытаюсь улучшить свой рабочий процесс.

Я пытался искать и здесь, и в другом месте, но без особой удачи.

Я пытался писать скрипт для обновления файла конфигурации. Насколько я могу судить, для загрузки нового конфига требуется перезапуск плазменного сервера, который занимает около 6–7 секунд. Это слишком долго для моих нужд. Если вы знаете, как это сделать, загрузив новые настройки из обновленного файла конфигурации без перезапуска плазмы, ответьте на мой другой вопрос: Как заставить KDE обновлять настройки после изменения файла конфигурации .

0
задан 24 July 2020 в 18:02

2 ответа

Mousekeys functionality is provided by the xkeyboard driver. You can use xkbset to activate and deactivate mousekeys from the terminal, scripts, or hotkey.

sudo apt install xkbset
xkbset mousekeys   # enable mousekeys
xkbset -mousekeys  # disable mousekeys
1
ответ дан 30 July 2020 в 22:03

I managed to bind a script which toggles the Mouse Keys feature to a keyboard key as follows, using xiota's answer:

Write the following shell script:

#!/bin/bash

if which xkbset &> /dev/null
then
    if xkbset q | grep "Mouse-Keys = Off" > /dev/null
    then
        xkbset mousekeys
    else
        xkbset -mousekeys
    fi
else
    echo Command 'xkbset' not found, but can be installed with:
    echo sudo apt install xkbset
fi

and save it somewhere useful. I called it toggle-mousekeys and saved it in ~/bin/.

Make this file executable:

chmod +x toggle_mousekeys

You can run the toggle_mousekeys command from a shell if the folder it's in is in your path. It will turn on Mouse Keys if it is currently off and turn it off if it is currently on.

The rest of the answer explains how to bind this new command to a key in KDE. There will be a similar way to do it in GNOME, Xfce etc.

In KDE's System Settings -> Shortcuts -> Custom Shortcuts dialog:

  1. In the 'Edit' dropdown choose: New -> Global Shortcuts -> Command/URL

  2. Name the short cut 'Toggle Mouse Keys' and explain what it does in the 'Comment' tab: “Toggle the state of Mouse Keys: enable Mouse Keys if disabled and disable if already enabled”.

  3. In the 'Trigger' tab, choose the key you wish to bind to the script. I chose Scroll Lock. Click on the button in the tab showing 'None' and then press your chosen key.

  4. In the 'Action' tab write in the path to your script in the 'Command/URL' field, eg ~/bin/toggle_mousekeys. You can also click the button with the folder icon and choose your script from a dialog.

  5. Click 'Apply' and test it.

0
ответ дан 30 July 2020 в 22:03

Другие вопросы по тегам:

Похожие вопросы: