Как узнать, какая команда / действие выполняется для комбинации ярлыков?

Я создал собственный ярлык и привязал к нему shutter -s :

enter image description here

Затем я попытался выяснить, где хранится и проверена эта команда. настройки с помощью dconf-editor . Но нет информации о связанной команде shutter -s и комбинации Shift + Print :

enter image description here

Таким образом, вопросы :

  1. Где хранится полная информация о привязках клавиш? Существует ли способ сказать: эта комбинация клавиш использует эту команду? Например, я хочу видеть команду снимка экрана по умолчанию, которая выполняется при нажатии Печать .
  2. Что происходит, когда я нажимаю клавишу Печать ? Как это нажатие клавиши достигает утилиты скриншота? Например:
    • некоторые tty получают этот ключ
    • GNOME Shell подключается к этому tty , поэтому он получает ключ в качестве ввода.
    • затем GNOME Shell просматривает некоторую базу данных ( dconf ?) И выполняет команду, связанную с клавишей Print .

Я прочитал похожие вопросы, например

, но не нашли ответа на мои вопросы.

4
задан 17 June 2020 в 22:25

1 ответ

Okay, after alot of back-and-forth in the comments, I believe I found the proper way to find the settings:

It is described in https://wiki.ubuntu.com/Keybindings

To find all (system) key bindings:

lets just add all three mentioned commands:

gsettings list-recursively org.gnome.desktop.wm.keybindings ; gsettings list-recursively org.gnome.settings-daemon.plugins.media-keys ; gsettings list-recursively org.gnome.settings-daemon.plugins.power

To find a special key you would pipe the output of each command through grep -i (the -i flag is to ignore case of letters) - so if you look for print it would look like this:

gsettings list-recursively org.gnome.desktop.wm.keybindings | grep -i print ; gsettings list-recursively org.gnome.settings-daemon.plugins.media-keys | grep -i print ; gsettings list-recursively org.gnome.settings-daemon.plugins.power | grep -i print

with some bash-magic this clearly could look nicer - but it works ;)

Regarding custom Shortcuts

Custom Shortcuts

Custom shortcuts are stored in dconf using a "relocatable schema". The schema name is "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding". Each custom key binding has three properties: name, command, and binding. Because of the relocatable schema, it is harder to use "gsettings" with custom shortcuts. Here is an example of getting the name of the first custom keybinding:

gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name

Please note, that the last part custom0/refers to the first custom set key binding.

With following command gsettings list-recursively org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ you'll get something like:

org.gnome.settings-daemon.plugins.media-keys.custom-keybinding command 'libreoffice' org.gnome.settings-daemon.plugins.media-keys.custom-keybinding name 'libreoffice' org.gnome.settings-daemon.plugins.media-keys.custom-keybinding binding 'l'

To find the correct entry you might have to increase the number in custom0.

To change e.g. the command use:

gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command ''

This will also work for name or binding.

To "clear" a custom key binding you could use: gsettings сбросить-рекурсивно org.gnome.settings-daemon.plugins.media-keys.custom-keybinding: / org / gnome / settings-daemon / plugins / media-keys / custom-keybindings / custom0 / - это очистит записи внутри, но запись все еще будет существовать в настройках Gnome как пустая запись, но будет «деактивирована», вроде того.

Как это работает с gsettings - второй вопрос: Посмотрите здесь: https://developer.gnome.org/gio/stable/GSettings.html

Спокойной ночи и удачи! ;)

4
ответ дан 19 June 2020 в 21:23

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

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