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

KWin scripting: clientMaximizedStateChanged

Tags: None
(comma "," separated)
STiAT
Registered Member
Posts
6
Karma
0
I'm trying to use clientMaximizedStateChanged in a KWin script. Documentation of this is by the way pretty bad ;-).

Now, we're having two exported signals:
clientMaximizedStateChanged(KWin::Client *, KDecorationDefines::MaximizeMode)
clientMaximizedStateChanged(KWin::Client *c, bool h, bool v)

(for the documentation being bad, what the heck are "h" and "v" variables?)


The question is: How to connect to a specific signal?
Code: Select all
function onMaximize(client, h, v) {
  // do stuff
}

function handleNewClient(client) {
  client.clientMaximizedStateChanged.connect(onMaximize);
}

workspace.clientAdded.connect(handleNewClient);


will give me:
Code: Select all
Error: Function.prototype.connect: ambiguous connect to KWin::Client::clientMaximizedStateChanged(); candidates are
    clientMaximizedStateChanged(KWin::AbstractClient*,MaximizeMode)
    clientMaximizedStateChanged(KWin::AbstractClient*,bool,bool)
Use e.g. object['clientMaximizedStateChanged(KWin::AbstractClient*,bool,bool)'].connect() to connect to a particular overload


This looks like easy enough, but i failed hard trying to get javascript actually using this function (will give me parse errors).

Code: Select all
client['clientStartUserMovedResized(KWin::AbstractClient*,bool,bool)'].connect(soundOnMaximize);

gives
Code: Select all
TypeError: Result of expression 'client['clientStartUserMovedResized(KWin::AbstractClient*,bool,bool)']' [undefined] is not an object.


How to (in javascript) tell the guy that I want to use
Code: Select all
clientMaximizedStateChanged(KWin::Client *c, bool h, bool v)


In C++ I could simply cast it, but in JavaScript?

It's actually for this guy I'm trying to help:
https://forum.manjaro.org/t/calling-kde ... ds/12772/9

Another issue is how to play a sound out of there... is there a simple way to play a sound out of kwin scripts (as a qml container I can create and access with SoundEffect or Audio or similar QML type. There are not a lot of examples for KWin scripting around ;-).


Bookmarks



Who is online

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