[software development] 注册系统热键
Tofloor
poster avatar
小钱钱
deepin
2024-06-04 23:04
Author

深度系统的快捷键 是否可以通过 c++ 或者 shell 调用终端命令完整快捷键的注册

image.png

Reply Favorite View the author
All Replies
小钱钱
deepin
2024-06-04 23:05
#1

如何可以话 希望可以提供一下相关的资料 非常感谢

Reply View the author
DebuggerX
deepin
2024-06-05 10:07
#2

你可以通过dbus调用添加自定义快捷键的方法,如果是shell里,推荐用qdbus比较方便:

qdbus org.deepin.dde.Keybinding1 /org/deepin/dde/Keybinding1 org.deepin.dde.Keybinding1.AddCustomShortcut test1 test2 "1"

效果:

录屏_dde-control-center_20240605095816.gif

相关的dbus接口定义在这里:https://github.com/linuxdeepin/dde-api-proxy/blob/master/file/dbus/v1/session/org.deepin.dde.Keybinding1.xml

使用:https://github.com/linuxdeepin/dde-control-center/blob/2013c421ea942eb340df65731dfccff0208db331/src/plugin-keyboard/operation/keyboardwork.cpp#L224

C++也是操作dbus。

Reply View the author
DebuggerX
deepin
2024-06-05 10:11
#3
DebuggerX

你可以通过dbus调用添加自定义快捷键的方法,如果是shell里,推荐用qdbus比较方便:

qdbus org.deepin.dde.Keybinding1 /org/deepin/dde/Keybinding1 org.deepin.dde.Keybinding1.AddCustomShortcut test1 test2 "1"

效果:

录屏_dde-control-center_20240605095816.gif

相关的dbus接口定义在这里:https://github.com/linuxdeepin/dde-api-proxy/blob/master/file/dbus/v1/session/org.deepin.dde.Keybinding1.xml

使用:https://github.com/linuxdeepin/dde-control-center/blob/2013c421ea942eb340df65731dfccff0208db331/src/plugin-keyboard/operation/keyboardwork.cpp#L224

C++也是操作dbus。

补充一下,当前添加的自定义快捷键的配置文件路径是 ~/.config/deepin/dde-daemon/keybinding/custom.ini 如果组合键不会写,可以先通过控制中心添加,然后参考这里的写法。

Reply View the author
小钱钱
deepin
2024-06-17 12:53
#4
DebuggerX

补充一下,当前添加的自定义快捷键的配置文件路径是 ~/.config/deepin/dde-daemon/keybinding/custom.ini 如果组合键不会写,可以先通过控制中心添加,然后参考这里的写法。

非常感谢 一直在工作 回复晚了谢

Reply View the author