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

Detecting current screen geometry

Tags: None
(comma "," separated)
swafran
Registered Member
Posts
1
Karma
0

Detecting current screen geometry

Sat Apr 23, 2022 11:28 pm
Hello,

Could someone please tell me, in a kwin script, how to get the width and height of the screen that a window is in ? =)

Here is why I'm asking :

I'm trying to make a kwin script that would do what the META+Left and META+Right default key bindings do, but instead of the window being 1/2 screen size, it would be 1/3, or 2/3 of the screen size.

I made one attempt using workspace.displayWidth and height, but that gives the geometry of the combined screens, so didn't work for my purpose. For example I want to set the window height to the height of the screen it's currently in, not of the total virtual desktop.

Then I tried hard coding the dimensions of a screen, like this
https://github.com/swafran/third-two-th ... de/main.js
which is nasty but sets the correct dimensions. However if I move a window to a different screen and then use this script to resize it, the window will pop back to the original screen it was on.

Any pointers will be greatly appreciated.
Thanks =)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]