Screen Snapping

Kwin Scripts

Source i (link to git-repo or to original if based on someone elses unmodified work):

Add the source-code for this project on opencode.net

1
Become a Fan
5.7

Description:
NOTICE:
-------------
installation via GHNS won't get you the config dialog.
Instead download the file and install it by

plasmapkg -i screenSnapping.kwinscript -t kwinscript

---
This overrides stock screen snapping and snaps to the decoration directly (unlike snap-to-deco which fixes the position after the actual snap and stopping the movement)

In addition, vertical, horizontal, inner and outer snap distance can be configured independently.

Ratings & Comments

14 Comments

giogziro95

A couple of problems: 1. Snapping to the bottom edge while resizing doesn't work. 2. Snapping to the left edge while resizing doesn't work when part of the window is above or bellow the screen real estate. 3. Same as 2, but for the right edge.

woko1754

Thanks from me too. It's still working, even on Plasma 5 !! I never will understand why they changed the behavior.

thomas12777

"They"? Actually I wrote the relevant patch. We changed the behavior on top of the agreement that the screen edges are valuable (fitt's law) and the deco borders make little use of that value (the only thing you can do with them is to remove the window from that valuable area...) but "steal" them from the decorated client UI (scrollbars, toolbuttons, ...) That caused a stupid situation for bad luck conditions. Few weeks after the patch, kde-workspace was "frozen" (shifting focus towards KDE 5) and some more weeks later, first reports of unhappy users filed in. While one would probably not have gone for such rather invasive change, knowing it was "set in stone" (we'd just have added it to KDE5 instead), we neither could act anymore. Calamities *shrug* We'll likely ultimately either pipe snapping through a script, so one can eg. treat konsole different from kwrite and the left corner different from the right etc. or provide a setting and rules.

jstalnak

This is the solution I was looking for. You might want to add to the description that users need to go to their System Settings > Window Behavior > KWin Scripts to enable it.

davesp

Thank you for this! The KDE devs may have forgotten that they can set side borders to zero width if they so highly value their screen real estate. Then they could have spared us this aggravation. This is the first time I had to install a KWinScript to fix an issue (which shouldn't have been introduced in the first place). Well done!

spacecase-25

Works well on screen edges, but doesn't work at all (no snapping enabled) at joining screen edges when using more than one monitor (normally Kwin would snap windows on these edges). Can this be added? Thanks.

spacecase-25

Actually there is snapping with this script enabled, but there's overhang between the two screens.

thomas12777

It's supposed to work since the matching is done to var area = workspace.clientArea(KWin.WorkArea, workspace.activeScreen, workspace.currentDesktop); and the algorithm doesn't make differences between inner and outer screen edged. It also works as expected here. Can you please post the output of "xrandr -q"?

spacecase-25

ben@arch-desktop:~$ xrandr -q Screen 0: minimum 320 x 200, current 3840 x 1200, maximum 16384 x 16384 DFP1 disconnected (normal left inverted right x axis y axis) DFP2 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 495mm x 310mm 1920x1200 59.95*+ 1920x1080 59.95 1600x1200 59.95 1680x1050 59.95 1400x1050 59.95 1280x1024 59.95 1440x900 59.95 1280x960 59.95 1280x800 59.95 1280x768 59.95 1280x720 59.95 1024x768 59.95 800x600 59.95 640x480 59.95 DFP3 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 444mm x 249mm 1920x1080 59.80*+ 59.94 60.00 59.94 1776x1000 59.94 59.94 1680x1050 59.94 59.80 1400x1050 59.94 59.80 1600x900 59.94 1280x1024 59.94 59.80 1440x900 59.94 1280x960 60.00 1360x768 60.02 1280x768 60.00 1280x720 60.00 59.94 1024x768 60.00 1152x648 59.94 800x600 60.32 720x480 60.00 59.94 640x480 59.94 CRT1 disconnected (normal left inverted right x axis y axis)

thomas12777

Hmm - simple horizontal strip. Looks like mine. Do you have window snapping enabled and/or could there be windows or panels (latter don't require window snapping) that couls impact the behavior?

spacecase-25

Center snapping was actually disabled (oops). However, with it enabled, this is infact an issue. This is also an issue when windows are opened in the "center" of my screen, so despite my original complaint being invalid, there's still a bug here. Thanks for all your time working this through with me.

thomas12777

Let's see whether we can sort that out ;-) Center snapping was disabled but window snapping enabled? And as result windows would snap to other windows and by this bleed into the other screen? Was/is the window snapping distance bigger than the screen snapping distance? (Maybe you could upload a screenshot of the problematic setting and constellation, ie. windows "mis-snapped"?)

spacecase-25

I'm not sure what you're asking, but here's a screenshot. Look closely at the circled regions. You can clearly see overlap onto the second screen. All other snapping works just fine. http://i.imgur.com/9nR9ZoZ.jpg

thomas12777

Thanks a lot - that looks like an "off-by-one" issue, but doesn't occur here. Do you get the same for the oxygen decoration? If not: what decoration do you use (some aurorae theme I assume) and does it also happen when suspending the compositor (Shift+Alt+F12)?

Pling
0 Affiliates
Details
license
version 1.0
updated
added
downloads 24h 0
mediaviews 24h 0
pageviews 24h 3

More Kwin Scripts from thomas12777:

GameMode
thomas12777
last update date: 10 years ago

Score 6.1

Spam Transients
thomas12777
last update date: 10 years ago

Score 5.0

Big Screen
thomas12777
last update date: 11 years ago

Score 6.1

Steady Screen
thomas12777
last update date: 11 years ago

Score 6.0

Debug Clients
thomas12777
last update date: 11 years ago

Score 5.0

Unminimize windows w/o taskbar entry
thomas12777
last update date: 11 years ago

Score 5.0

Other Kwin Scripts:

MiniStack
faho
last update date: 11 years ago

Score 5.0

TIL3R
causa-prima
last update date: 11 years ago

Score 5.7

True Video Wall
zezinho
last update date: 10 years ago

Score 5.0

eQui-binds
enno
last update date: 9 years ago

Score 5.0

Demands Attention Only on Current Deskto
mgraesslin
last update date: 12 years ago

Score 5.8

Opacity Menu
mgraesslin
last update date: 12 years ago

Score 6.1



System Tags