Bug 318379 - kwin scripting "registerShortcut" does not work when starting script via dbus
Summary: kwin scripting "registerShortcut" does not work when starting script via dbus
Status: RESOLVED WORKSFORME
Alias: None
Product: kwin
Classification: Plasma
Component: scripting (show other bugs)
Version: 4.10.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 318383 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-15 10:01 UTC by github
Modified: 2013-04-15 11:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description github 2013-04-15 10:01:45 UTC
Hi, I have a very simgle script:

    print("script startup")
    registerShortcut("Register Desc", "cool", "Meta+B", function() { "got key" })

I start the script using:

    qdbus-qt4 org.kde.kwin /Scripting loadScript PATH_TO_SCRIPT
    qdbus-qt4 org.kde.kwin /0 run   # where 0 is the ID returned by the previous command

At this stage I notice "script startup" logged by kwin, however upon pressing "Meta+B" I get absolutely nothing.

I don't know whether the shortcut would start working after packaging my script as a plasma package... at this stage I am just in the testing stage and being able to quickly unload and reload my script is essential. I am able to connect to other signals and get output only registerShortcut seems to be broken for me.
Comment 1 github 2013-04-15 10:05:37 UTC
Sorry I messed up that script after pasting it, it should read:

    print("script startup")
    registerShortcut("Script Binding Test", "test", "Meta+B", function() { print("got key") })
Comment 2 github 2013-04-15 10:22:46 UTC
Here is the results of calling "registerShortcut" 4 times to my kglobalshortcutsrc (each time with a slightly different title):

    Script Test1=,Meta+B,cool
    Script Test2=Meta+B,Meta+B,cool
    Script Test3=,Meta+B,cool
    Script Test4=,Meta+B,cool

Now strangely enough the time I registered it with "Script Test2" the key binding actually worked. Seems random as to what type of entry it creates. Also... seems kinda weird I get all these duplicate entries in that file just from registering script shortcuts but I guess that's okay.
Comment 3 Martin Flöser 2013-04-15 10:30:55 UTC
seems like a worksforme. The global shortcut system is not very good and not really suited for rapid prototyping of scripts. You need to ensure in the global shortcut editor that the keybinding is actually registered.
Comment 4 github 2013-04-15 10:34:23 UTC
I have found the actual issue, I guess I'll open a new bug for it.
Comment 5 Martin Flöser 2013-04-15 11:11:56 UTC
*** Bug 318383 has been marked as a duplicate of this bug. ***