Skip to content

Commit 321d360

Browse files
authored
1.6.2, merge from dev
Merge pull request #37 from emvaized/dev
2 parents 132e92a + bfa277a commit 321d360

File tree

8 files changed

+149
-8
lines changed

8 files changed

+149
-8
lines changed

CHANGELOG

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
1.6.2
2+
- New feature "Show desktop background" and associated blur option
3+
- Improved stability and performance by not attaching listeners to special windows (alerts, notifications, etc)
4+
5+
1.6.1
6+
- Fix for KWin crash after waking from sleep
7+
18
1.6
29
- Wayland support for snap groups features and sorting windows by last activation time
310
- New option "Remember window sizes, and restore it on un-snap" for windows snapped with the script

contents/config/main.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,13 @@
8585
<label>Delay in ms before assist gets shown</label>
8686
<default>100</default>
8787
</entry>
88+
<entry name="showDesktopBackground" type="bool">
89+
<label>Show desktop background</label>
90+
<default>false</default>
91+
</entry>
92+
<entry name="desktopBackgroundBlur" type="int">
93+
<label>Amount of blur to apply to desktop background</label>
94+
<default>18</default>
95+
</entry>
8896
</group>
8997
</kcfg>

contents/ui/code/assist.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/// assist
22
function delayedShowAssist(dx, dy, height, width, window){
3-
clients = Object.values(workspace.clients).filter(c => WindowManager.shouldShowWindow(c));
3+
const allClients = Object.values(workspace.clients);
4+
clients = allClients.filter(c => WindowManager.shouldShowWindow(c));
45
if (clients.length == 0) return;
56

67
cardWidth = currentScreenWidth / 5;
@@ -17,6 +18,13 @@ function delayedShowAssist(dx, dy, height, width, window){
1718

1819
if (sortByLastActive) WindowManager.sortClientsByLastActive();
1920
if (descendingOrder) clients = clients.reverse();
21+
22+
/// find current desktop background
23+
if (showDesktopBackground) {
24+
const indexOfDesktopWindow = allClients.findIndex((c) => c.desktopWindow && c.screen === workspace.activeScreen);
25+
if (indexOfDesktopWindow < 0) return;
26+
desktopWindowId = allClients[indexOfDesktopWindow].internalId;
27+
}
2028
}
2129

2230
function showAssist(dx, dy, height, width) {

contents/ui/code/windows.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ function selectClient(client){
2424

2525
/// listeners
2626
function addListenersToClient(client) {
27+
if (!client || client.specialWindow) return;
28+
2729
client.frameGeometryChanged.connect(function() {
2830
if (!client.move && !client.resize && activated == false && preventFromShowing == false) {
2931
if (delayBeforeShowingAssist == 0) {
@@ -80,8 +82,7 @@ function addListenersToClient(client) {
8082
}
8183

8284
function onWindowResize(window) {
83-
if (!window) return;
84-
if (activated) return;
85+
if (activated || !window || window.deleted || window.specialWindow) return;
8586
AssistManager.finishSnap(false); /// make sure we cleared all variables
8687

8788
/// don't show assist if window could be fit in the group behind
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import QtQuick 2.12
2+
import QtQuick.Window 2.12
3+
import QtGraphicalEffects 1.12
4+
import org.kde.kwin 2.0 as KWinComponents
5+
6+
Item {
7+
y: - (mainWindow.y - minDy)
8+
x: - (mainWindow.x - minDx)
9+
height: Screen.height
10+
width: currentScreenWidth
11+
visible: showDesktopBackground && mainWindow.activated
12+
13+
KWinComponents.ThumbnailItem {
14+
wId: desktopWindowId
15+
id: desktopBackground
16+
anchors.fill: parent
17+
}
18+
19+
/// configurable blur
20+
FastBlur {
21+
id: blurBackground
22+
anchors.fill: parent
23+
source: desktopBackground
24+
radius: desktopBackgroundBlur
25+
cached: false
26+
visible: desktopBackgroundBlur > 0
27+
}
28+
}

contents/ui/config.ui

Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>868</width>
10-
<height>620</height>
9+
<width>998</width>
10+
<height>715</height>
1111
</rect>
1212
</property>
1313
<property name="minimumSize">
@@ -298,6 +298,68 @@
298298
</item>
299299
</layout>
300300
</item>
301+
<item>
302+
<widget class="QCheckBox" name="kcfg_showDesktopBackground">
303+
<property name="cursor">
304+
<cursorShape>ArrowCursor</cursorShape>
305+
</property>
306+
<property name="toolTip">
307+
<string/>
308+
</property>
309+
<property name="text">
310+
<string>Show desktop background</string>
311+
</property>
312+
</widget>
313+
</item>
314+
<item>
315+
<layout class="QHBoxLayout" name="horizontalLayout_11">
316+
<item>
317+
<widget class="KIntNumInput" name="kcfg_desktopBackgroundBlur">
318+
<property name="enabled">
319+
<bool>false</bool>
320+
</property>
321+
<property name="value">
322+
<number>18</number>
323+
</property>
324+
<property name="minimum">
325+
<number>0</number>
326+
</property>
327+
<property name="maximum">
328+
<number>60</number>
329+
</property>
330+
<property name="suffix">
331+
<string>px</string>
332+
</property>
333+
</widget>
334+
</item>
335+
<item>
336+
<widget class="QLabel" name="label_8">
337+
<property name="cursor">
338+
<cursorShape>ArrowCursor</cursorShape>
339+
</property>
340+
<property name="toolTip">
341+
<string/>
342+
</property>
343+
<property name="text">
344+
<string>Blur radius for desktop background</string>
345+
</property>
346+
</widget>
347+
</item>
348+
<item>
349+
<spacer name="horizontalSpacer_9">
350+
<property name="orientation">
351+
<enum>Qt::Horizontal</enum>
352+
</property>
353+
<property name="sizeHint" stdset="0">
354+
<size>
355+
<width>40</width>
356+
<height>20</height>
357+
</size>
358+
</property>
359+
</spacer>
360+
</item>
361+
</layout>
362+
</item>
301363
</layout>
302364
</widget>
303365
</item>
@@ -670,7 +732,7 @@
670732
<cursorShape>ArrowCursor</cursorShape>
671733
</property>
672734
<property name="title">
673-
<string>Snap groups</string>
735+
<string>Snap groups (experimental)</string>
674736
</property>
675737
<property name="alignment">
676738
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
@@ -752,5 +814,22 @@
752814
</customwidget>
753815
</customwidgets>
754816
<resources/>
755-
<connections/>
817+
<connections>
818+
<connection>
819+
<sender>kcfg_showDesktopBackground</sender>
820+
<signal>toggled(bool)</signal>
821+
<receiver>kcfg_desktopBackgroundBlur</receiver>
822+
<slot>setEnabled(bool)</slot>
823+
<hints>
824+
<hint type="sourcelabel">
825+
<x>538</x>
826+
<y>217</y>
827+
</hint>
828+
<hint type="destinationlabel">
829+
<x>539</x>
830+
<y>245</y>
831+
</hint>
832+
</hints>
833+
</connection>
834+
</connections>
756835
</ui>

contents/ui/main.qml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Window {
3131
/// service variables
3232
property bool activated: false
3333
property var clients: null
34+
property var desktopWindowId: null
3435
property var lastActiveClient: null /// last active client to focus if cancelled
3536
property int focusedIndex: 0 /// selection by keyboard
3637
property bool trackActiveWindows: true
@@ -83,6 +84,8 @@ Window {
8384
property bool fillOnSnappedMove
8485
property int fitWindowInGroupBehind
8586
property bool rememberWindowSizes
87+
property bool showDesktopBackground
88+
property int desktopBackgroundBlur
8689

8790
Connections {
8891
target: workspace
@@ -120,6 +123,11 @@ Window {
120123
mainWindow.hide();
121124
}
122125

126+
/// Desktop preview on background with blur
127+
Loader {
128+
source: showDesktopBackground && desktopWindowId != null ? 'components/DesktopBackground.qml' : ''
129+
}
130+
123131
/// Main view
124132
Rectangle {
125133
id: assistBackground
@@ -348,6 +356,8 @@ Window {
348356
fillOnSnappedClose = KWin.readConfig("fillOnSnappedClose", false);
349357
fillOnSnappedMove = KWin.readConfig("fillOnSnappedMove", false);
350358
fitWindowInGroupBehind = KWin.readConfig("fitWindowInGroupBehind", false);
359+
showDesktopBackground = KWin.readConfig("showDesktopBackground", false);
360+
desktopBackgroundBlur = KWin.readConfig("desktopBackgroundBlur", 18);
351361
trackSnappedWindows = minimizeSnappedTogether || raiseSnappedTogether || fillOnSnappedClose || !showSnappedWindows;
352362
trackActiveWindows = sortByLastActive || fitWindowInGroupBehind;
353363

metadata.desktop

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ X-KDE-ConfigModule=kwin/effects/configs/kcm_kwin4_genericscripted
1717
X-KDE-PluginInfo-Author=emvaized
1818
X-KDE-PluginInfo-Email=maximtsyba@gmail.com
1919
X-KDE-PluginInfo-Name=kdesnapassist
20-
X-KDE-PluginInfo-Version=1.6
20+
X-KDE-PluginInfo-Version=1.6.2
2121
X-KDE-PluginInfo-License=GPL
2222
X-KDE-PluginInfo-EnabledByDefault=true
2323
X-KDE-PluginInfo-Website=https://github.com/emvaized/kde-snap-assist

0 commit comments

Comments
 (0)