Reply to topic

programmatic assignment of a shortcut to show a window

kirkdevito
Registered Member
Posts
3
Karma
0
hi, I am trying to say *from the command line* (I know I could do every time Alt-F3 -> More -> "Set Window Shortcut") "My beloved KDE, I have a got a few seconds ago a new window on my desktop, it has the following xwininfo ID : 0x6008039 and I would like you to show it every time I press the key combination `Ctrl+Alt+X, Ctrl+Alt+S` ", but am not having much success.

I have spent several hours of digging through source code and trying to find some examples, without much success. I found the Client::setShortcut(const QString& _cut) definition in https://code.woboq.org/kde/kde-workspace/kwin/useractions.cpp.html#1937 , I even found that through DBUS and qdbus I can call some methods :

Code: Select all
qdbus  --literal  org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.allShortcutInfos | sed -e 's/],/],\n/g' | grep 'activate window'

[Argument: (ssssssaiai) "_k_session:52429584", "Activate Window (aa {Ctrl+3})", "kwin", "KWin", "default", "Default Context", [Argument: ai {67108915}],

But I am having no luck figuring out how to specify the parameters "Ctrl+Alt+X, Ctrl+Alt+S" or at least just a single-key combo : Ctrl+3 and the window ID to the right DBUS method. It seems like /component/kwin does not export "setShortcut" via dbus and the setShortcut that is exported in /kglobalaccess does not allow for specifying the window ID. But on KDE session startup (initial login) this *is* somehow done automagically, that the windows respawn with the shortcuts assigned. So it is doable somehow without interactive dialog, and without registering a global action "raise window ID 0x6008039". So HOW?

qdbus --literal org.kde.kglobalaccel /component/kwin org.kde.kglobalaccel.Component.setShortcut does not exist :(

Btw, how do I know which key combo corresponds to which integer? I.e. I know that "Ctrl+3" is expressed as 67108915, but what how do I know what Ctrl+Alt+x (and all other combinations) are?

thanks a bunch in advance!!

kirkdevito
kirkdevito
Registered Member
Posts
3
Karma
0
hmm, and the procedure involving the interactive dialog doesn't even seem to save the shortcut into the session anywhere - so how do I trace the execution path to where the session startup (after KDE logout / login) uses a programmatic way to re-establish the previous window activation shortcuts?
kirkdevito
Registered Member
Posts
3
Karma
0
can someone suggest an example of a successful qdbus command that would accomplish this assignment?

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], dchmelik, Google [Bot], irvingarrietavazquez, Majestic-12 [Bot], MountainX, win8linux