This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Debugging kwinscript

Tags: None
(comma "," separated)
sauve
Registered Member
Posts
3
Karma
0

Debugging kwinscript

Tue Apr 12, 2016 3:10 am
Hello,

I created a little kwinscript and I wonder how to debug it... (I'm using gentoo and kwin 5.6.2)

My action seems to be trigered as the selection flashes when I enter my shortcut but the action ( window resize/reposition ) is not performed

I put the source of the script there: https://github.com/megametres/positionshortcut

I use a slightly different code ( I only add a line to test in on execution in the init function )
Code: Select all
var position = {

  positionWindow: function(w, h, x, y) {
    var c = workspace.activeClient;
    var ca = workspace.clientArea(null, c);
    var g = c.geometry;

    g.width = eval(w);
    g.height = eval(h);
    g.x = eval(x);
    g.y = eval(y);

    print(g.x);
    print("hahaha");

    c.geometry = g;
  },

  registerShortcuts: function() {
    "use strict";
    registerShortcut("Position window tier top",
      "Position window tier top",
      "Meta+Shift+1",
      function() {
          position.positionWindow("ca.width", "ca.height / 3", "ca.x", "ca.y");
      });
  },

  init: function() {
    "use strict";
    this.registerShortcuts();
    position.positionWindow("ca.width", "ca.height / 3", "ca.x", "ca.y");
  }
}

position.init();


Which work in the plasma console with the kwin option enabled
Code: Select all
qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.showInteractiveConsole


I installed my script with:
Code: Select all
$ plasmapkg2 -t kwinscript -i .


I try to reload my script after few modifications with:
Code: Select all
qdbus org.kde.KWin /Scripting unloadScript "positionshortcut"
qdbus org.kde.KWin /Scripting loadScript . "positionshortcut"
qdbus org.kde.KWin /KWin reconfigure


and disabling/enabling my script within the kwin script section of the configuration panel

I also tried to set
Code: Select all
kdebugdialog5 --fullmode

and specify kwin to output to a file but I cant find thee file ( tried relative and absolute path )

I don't know if it is related or not, but I have another issue ( when trying to unsintall the script )

Code: Select all
$ plasmapkg2 -t kwinscript -r .
Calling KPluginInfo::property("X-KDE-PluginInfo-Name") is deprecated, use KPluginInfo::pluginName() in "/usr/lib64/qt5/plugins/plasma/packagestructure/plasma_packagestructure_share.so" instead.
No metadata file in the package, expected it at: "/home/metres/.local/share/kwin/scripts//metadata.desktop"
No metadata file in the package, expected it at: "/home/metres/.local/share/kwin/scripts//metadata.desktop"
Constructing a KPluginInfo object from old style JSON. Please use kcoreaddons_desktop_to_json() for "" instead of kservice_desktop_to_json() in your CMake code.
Calling KPluginInfo::property("X-KDE-PluginInfo-Name") is deprecated, use KPluginInfo::pluginName() in "/usr/lib64/qt5/plugins/plasma/packagestructure/plasma_packagestructure_share.so" instead.
Error: Plugin positionshortcut is not installed.



Could anyone point me something out?
sauve
Registered Member
Posts
3
Karma
0

Re: Debugging kwinscript

Tue Apr 12, 2016 5:05 am
I continue my tests and after installing my kwinscript with another startkde session my script worked.

But I was not able to modify it / reinstalling it with different spec and to reload it with the modified behavior. ( I changed the shortcut key and even after restarting kde, and reinstalling the script and modifying it in the ~/.local/share/kwin/script folder my change was not effective, I still with the initial first shortcut key )

Hence I think it is related with my uninstall problem...
sauve
Registered Member
Posts
3
Karma
0

Re: Debugging kwinscript  Topic is solved

Thu Apr 14, 2016 2:39 am
Hello,

I finally found my error...I was only testing trying the keyboard shortcut whose where registered in the kwin section in the global shortcut configuration...

I added other actions and they appeared in the configuration, my kwin script is loaded correctly, it was the shortcut that were registered globally...


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]