Where does Deepin store the custom keyboard shortcuts ?
Tofloor
poster avatar
mike235
deepin
2017-11-25 11:11
Author
Hi,

In the Control Center > Keyboard and Langage > Shortcut, you can create custom shortcuts. Where does Deepin save these settings ?
Reply Favorite View the author
All Replies
o4is
deepin
2017-11-26 00:56
#1
Take a look for ~/.config/deepin/dde-daemon/keybinding/custom.ini
Reply View the author
mike235
deepin
2017-11-26 03:53
#2
Yes, perfect ! Thanks
Reply View the author
mike235
deepin
2017-11-26 08:47
#3
https://bbs.deepin.org/post/148930
Take a look for ~/.config/deepin/dde-daemon/keybinding/custom.ini

Here's an example of what's in ~/.config/deepin/dde-daemon/keybinding/custom.ini after having created a shortcut.

  1. [32613935-e1b6-4236-9505-fea1e1537d1a]
  2. Name=KeepassX
  3. Action=/usr/bin/keepassx
  4. Accels=K;
Copy the Code


What's the long ID number on the first line ?

Can we create shortcuts by hand in this text file, and if so how to generate the number ?
Reply View the author
nipos
deepin
2017-11-26 09:42
#4
It's an random UUID.
You can get one with the following command:
cat /proc/sys/kernel/random/uuid
Reply View the author
o4is
deepin
2017-11-26 13:22
#5
https://bbs.deepin.org/post/148930
Here's an example of what's in ~/.config/deepin/dde-daemon/keybinding/custom.ini after having crea ...

Not exactly sure what you mean "by hand"...
but you can add,remove,modify...etc the file through the Keybinding service.

Remove a custom shortcut using its uuid, e.g
  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.DeleteCustomShortcut string:"ccdb45bf-b319-4385-a470-4b41fe024c3f"
Copy the Code


Or add a custom shortcut(the uuid is auto-generated) e.g
  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.AddCustomShortcut string:"Video Player" string:"vlc" string:"V"
Copy the Code


The file will be modified...
If  you want the new entries to be listed in the control-center keyboard shortcut section you might have to restart it.
  1. killall dde-control-center
Copy the Code


You can check all the available methods for this service with
  1. gdbus introspect --session --dest com.deepin.daemon.Keybinding --object-path /com/deepin/daemon/Keybinding --recurse
Copy the Code

Reply View the author
mike235
deepin
2017-12-07 01:10
#6
Edited by mike235 at 2017-12-6 17:12

Thanks, this helped me a lot :

  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.AddCustomShortcut string:"Video Player" string:"vlc" string:"V"
Copy the Code
Sometimes when I created a shortcut through the Control Center, it wouldn't work and not even show up in the shortcut's list in the CC.

But when I do it through the command line, for example :

  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.AddCustomShortcut string:"Opera" string:"opera" string:"W"
Copy the Code
It gives me an error message with the reason why it doesn't work, the combination is already used (apparently? the message is kind of unclear) :
  1. Error com.deepin.DBus.Error.UnknowError: keystroke have been used
Copy the Code
Now I have to find out where my W combination is already used, because I don't see it in "~/.config/deepin/dde-daemon/keybinding/custom.ini" and I don't see it either in "dconf /com/deepin/wrap/gnome/desktop/wm/keybindings".

Is there a way I can know which keybinding is associated with a specific key combination ?



Reply View the author
o4is
deepin
2017-12-07 05:10
#7
https://bbs.deepin.org/post/148930
Thanks, this helped me a lot :

Sometimes when I created a shortcut through the Control Center, it w ...

Hi,
if you execute the last command from my last reply, i.e:
  1. gdbus introspect --session --dest com.deepin.daemon.Keybinding --object-path /com/deepin/daemon/Keybinding --recurse
Copy the Code

you will get a list of available methods for this service. One of them is the method CheckAvaliable which returns the associated keybinding e.g:
  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.CheckAvaliable string:"U"
Copy the Code

returns correctly for me (cause i have deepin-system-monitor in that keybinding):
  1. method return time=1512564224.114430 sender=:1.28 -> destination=:1.101 serial=657 reply_serial=2
  2.    boolean false
  3.    string "{"Id":"5cf75711-526b-4b35-bdf0-ab770d8c89ae","Type":1,"Accels":["\u003cControl\u003e\u003cAlt\u003eU"],"Name":"Monitor","Exec":"deepin-system-monitor"}"
Copy the Code

The custom shortcuts are not displayed in any of the gsettings schemas.
You can also display them like this:
  1. dbus-send --session --dest=com.deepin.daemon.Keybinding --type=method_call --print-reply /com/deepin/daemon/Keybinding com.deepin.daemon.Keybinding.ListShortcutsByType int32:1
Copy the Code
Reply View the author