nclarius / tile-gaps

KWin script to add space around windows touching a screen edge or other window
https://store.kde.org/p/1619642
GNU General Public License v3.0
104 stars 16 forks source link

Script doesnt load #1

Closed Akselmo closed 2 years ago

Akselmo commented 2 years ago

Hi, been looking for a script like this for a long while so I'm glad to see one

Unfortunately I can't get mine to work. I have it loaded in my Kwin Scripts settings, but the config button won't appear even after following the readme.

Here's what I get after running kwin_x11 --replace &

Icon theme "elementary" not found.
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5079:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5081:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5083:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5087:47: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5089:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5097:48: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5101:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5103:46: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5107:45: this compose sequence is a duplicate of another; skipping line
kwin_xkbcommon: XKB: /usr/share/X11/locale/en_US.UTF-8/Compose:5110:46: this compose sequence is a duplicate of another; skipping line
Module 'org.kde.kwin.decoration' does not contain a module identifier directive - it cannot be protected from external registrations.
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
file:///usr/share/kwin/aurorae/MenuButton.qml:11: TypeError: Cannot read property 'closeOnDoubleClickOnMenu' of null
OpenGL vendor string:                   AMD
OpenGL renderer string:                 AMD Radeon (TM) RX 480 Graphics (POLARIS10, DRM 3.40.0, 5.11.0-37-generic, LLVM 12.0.0)
OpenGL version string:                  4.6 (Compatibility Profile) Mesa 21.3.0-rc1
OpenGL shading language version string: 4.60
Driver:                                 RadeonSI
GPU class:                              Arctic Islands
OpenGL version:                         4.6
GLSL version:                           4.60
Mesa version:                           21.3
X server version:                       1.20.11
Linux kernel version:                   5.11
Requires strict binding:                yes
GLSL shaders:                           yes
Texture NPOT support:                   yes
Virtual Machine:                        no
kwin_core: XCB error: 10 (BadAccess), sequence: 3011, resource id: 1744, major code: 142 (Composite), minor code: 2 (RedirectSubwindows)
nclarius commented 2 years ago

The problem should be fixed now; please reinstall, including running the fix described in the readme again, and see if it works now.

Akselmo commented 2 years ago

The settings menu now appeared, but the script is still not doing anything when i move the window around screen. Is there some way I can help you debug this?

nclarius commented 2 years ago
  1. Did you make sure to reenable the script?
  2. The script will only take action on windows that are approximately tiled to a screen quarter or half. Does the window you tried have the size of a half or quarter of the screen and is touching the screen edges?
Akselmo commented 2 years ago
  1. Yup, i unchecked the script box, applied, checked the box and applied again
  2. Yes, I moved the windows to the edge of the screen and got the "shadow box" that shows where the window will be applied when i release the mouse button. I also tried moving the windows around with shortcuts. I have dual monitors so i tried disabling one monitor as well to see if it was affecting this, but no dice.

I tried to run the script with qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.showInteractiveConsole and it returns

Executing script at Monday, 18 October 2021 21:53:02 EEST

Runtime: 1ms

SyntaxError: Parse error
Akselmo commented 2 years ago

I enabled debug mode from kdebugsettings and kwin_x11 --replace & gave me this

kwin_scripting: defaultscript encountered an error at [Line  25 ]
kwin_scripting: Message:  "SyntaxError: Parse error"
kwin_scripting: -----------------
kwin_scripting:   "message" :  "Parse error"
kwin_scripting:   "lineNumber" :  "25"
kwin_scripting:   "sourceId" :  "140203906767488"
kwin_scripting:   "fileName" :  ""

This also pops up when enabling the script from menu. Wonder what's going wrong with that part of code, since it works for you.

Akselmo commented 2 years ago

I figured it out! I had to change the

// add to watchlist when client is initially present or added
for (const client of workspace.clientList()) {
    onAdded(client);
}
workspace.clientAdded.connect(onAdded);

to other kind of for loop


// add to watchlist when client is initially present or added
const clients = workspace.clientList();
for (var i = 0; i < clients.length; i++) {
    onAdded(clients[i]);
}
workspace.clientAdded.connect(onAdded);

My guess is that I'm on older version of Kwin that doesnt support the kind of iteration for for loops you used. Now it works just fine for me!

nclarius commented 2 years ago

That sounds plausible, kudos for figuring that one out. I'm glad to hear it works now.
Which KWin version are you using (kwin_x11 --version)? Depending on how old it is, I might consider rewriting the script for broader compatibility.

Akselmo commented 2 years ago
kwin_x11 --version
kwin 5.21.4
nclarius commented 2 years ago

Okay, thank you!