effects/{private,desktopgrid,overview}: Clean up QML/JS code and bump imports
This commit is contained in:
parent
f892c9510e
commit
8feaa8922a
8 changed files with 94 additions and 93 deletions
src/effects
desktopgrid/qml
overview/qml
private/qml
windowview/qml
|
@ -46,7 +46,7 @@ FocusScope {
|
||||||
Connections {
|
Connections {
|
||||||
target: effect
|
target: effect
|
||||||
function onItemDroppedOutOfScreen(globalPos, item, screen) {
|
function onItemDroppedOutOfScreen(globalPos, item, screen) {
|
||||||
if (screen != targetScreen) {
|
if (screen !== targetScreen) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const pos = screen.mapFromGlobal(globalPos);
|
const pos = screen.mapFromGlobal(globalPos);
|
||||||
|
@ -91,7 +91,7 @@ FocusScope {
|
||||||
|
|
||||||
WindowHeap {
|
WindowHeap {
|
||||||
id: heap
|
id: heap
|
||||||
function resetPosition () {
|
function resetPosition() {
|
||||||
x = 0;
|
x = 0;
|
||||||
y = 0;
|
y = 0;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,8 @@ FocusScope {
|
||||||
screenName: targetScreen.name
|
screenName: targetScreen.name
|
||||||
clientModel: desktopView.clientModel
|
clientModel: desktopView.clientModel
|
||||||
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
||||||
~KWinComponents.ClientFilterModel.Desktop &
|
~KWinComponents.ClientFilterModel.Desktop &
|
||||||
~KWinComponents.ClientFilterModel.Notification;
|
~KWinComponents.ClientFilterModel.Notification
|
||||||
}
|
}
|
||||||
delegate: WindowHeapDelegate {
|
delegate: WindowHeapDelegate {
|
||||||
windowHeap: heap
|
windowHeap: heap
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtQuick.Window 2.12
|
import QtQuick.Layouts 1.15
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Window 2.15
|
||||||
import QtGraphicalEffects 1.12
|
import QtGraphicalEffects 1.15
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.kwin.private.effects 1.0
|
import org.kde.kwin.private.effects 1.0
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
@ -26,17 +26,17 @@ Rectangle {
|
||||||
color: "black"
|
color: "black"
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
container.animationEnabled = true;
|
animationEnabled = true;
|
||||||
container.organized = true;
|
organized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
container.organized = false;
|
organized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function switchTo(desktopId) {
|
function switchTo(desktopId) {
|
||||||
KWinComponents.Workspace.currentDesktop = desktopId;
|
KWinComponents.Workspace.currentDesktop = desktopId;
|
||||||
container.effect.deactivate(container.effect.animationDuration);
|
effect.deactivate(effect.animationDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectNext(direction) {
|
function selectNext(direction) {
|
||||||
|
@ -87,19 +87,19 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onPressed: {
|
Keys.onPressed: {
|
||||||
if (event.key == Qt.Key_Escape) {
|
if (event.key === Qt.Key_Escape) {
|
||||||
effect.deactivate(effect.animationDuration);
|
effect.deactivate(effect.animationDuration);
|
||||||
} else if (event.key == Qt.Key_Plus || event.key == Qt.Key_Equal) {
|
} else if (event.key === Qt.Key_Plus || event.key === Qt.Key_Equal) {
|
||||||
addButton.clicked();
|
addButton.clicked();
|
||||||
} else if (event.key == Qt.Key_Minus) {
|
} else if (event.key === Qt.Key_Minus) {
|
||||||
removeButton.clicked();
|
removeButton.clicked();
|
||||||
} else if (event.key >= Qt.Key_F1 && event.key <= Qt.Key_F12) {
|
} else if (event.key >= Qt.Key_F1 && event.key <= Qt.Key_F12) {
|
||||||
const desktopId = (event.key - Qt.Key_F1) + 1;
|
const desktopId = (event.key - Qt.Key_F1) + 1;
|
||||||
switchTo(desktopId);
|
switchTo(desktopId);
|
||||||
} else if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) {
|
} else if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) {
|
||||||
const desktopId = event.key == Qt.Key_0 ? 10 : (event.key - Qt.Key_0);
|
const desktopId = event.key === Qt.Key_0 ? 10 : (event.key - Qt.Key_0);
|
||||||
switchTo(desktopId);
|
switchTo(desktopId);
|
||||||
} else if (event.key == Qt.Key_Up) {
|
} else if (event.key === Qt.Key_Up) {
|
||||||
event.accepted = selectNext(WindowHeap.Direction.Up);
|
event.accepted = selectNext(WindowHeap.Direction.Up);
|
||||||
if (!event.accepted) {
|
if (!event.accepted) {
|
||||||
let view = effect.getView(Qt.TopEdge)
|
let view = effect.getView(Qt.TopEdge)
|
||||||
|
@ -107,7 +107,7 @@ Rectangle {
|
||||||
effect.activateView(view)
|
effect.activateView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Down) {
|
} else if (event.key === Qt.Key_Down) {
|
||||||
event.accepted = selectNext(WindowHeap.Direction.Down);
|
event.accepted = selectNext(WindowHeap.Direction.Down);
|
||||||
if (!event.accepted) {
|
if (!event.accepted) {
|
||||||
let view = effect.getView(Qt.BottomEdge)
|
let view = effect.getView(Qt.BottomEdge)
|
||||||
|
@ -115,7 +115,7 @@ Rectangle {
|
||||||
effect.activateView(view)
|
effect.activateView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Left) {
|
} else if (event.key === Qt.Key_Left) {
|
||||||
event.accepted = selectNext(WindowHeap.Direction.Left);
|
event.accepted = selectNext(WindowHeap.Direction.Left);
|
||||||
if (!event.accepted) {
|
if (!event.accepted) {
|
||||||
let view = effect.getView(Qt.LeftEdge)
|
let view = effect.getView(Qt.LeftEdge)
|
||||||
|
@ -123,7 +123,7 @@ Rectangle {
|
||||||
effect.activateView(view)
|
effect.activateView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Right) {
|
} else if (event.key === Qt.Key_Right) {
|
||||||
event.accepted = selectNext(WindowHeap.Direction.Right);
|
event.accepted = selectNext(WindowHeap.Direction.Right);
|
||||||
if (!event.accepted) {
|
if (!event.accepted) {
|
||||||
let view = effect.getView(Qt.RightEdge)
|
let view = effect.getView(Qt.RightEdge)
|
||||||
|
@ -131,7 +131,7 @@ Rectangle {
|
||||||
effect.activateView(view)
|
effect.activateView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.key == Qt.Key_Return || event.key == Qt.Key_Space) {
|
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Space) {
|
||||||
for (let i = 0; i < gridRepeater.count; i++) {
|
for (let i = 0; i < gridRepeater.count; i++) {
|
||||||
if (gridRepeater.itemAt(i).focus) {
|
if (gridRepeater.itemAt(i).focus) {
|
||||||
switchTo(gridRepeater.itemAt(i).desktop.x11DesktopNumber)
|
switchTo(gridRepeater.itemAt(i).desktop.x11DesktopNumber)
|
||||||
|
@ -154,7 +154,7 @@ Rectangle {
|
||||||
id: grid
|
id: grid
|
||||||
|
|
||||||
property Item currentItem
|
property Item currentItem
|
||||||
readonly property real targetScale : 1 / Math.max(rows, columns)
|
readonly property real targetScale: 1 / Math.max(rows, columns)
|
||||||
property real panelOpacity: 1
|
property real panelOpacity: 1
|
||||||
|
|
||||||
Behavior on x {
|
Behavior on x {
|
||||||
|
@ -199,8 +199,8 @@ Rectangle {
|
||||||
when: container.effect.gestureInProgress
|
when: container.effect.gestureInProgress
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: grid
|
target: grid
|
||||||
x: Math.max(0, container.width / 2 - (width * targetScale) / 2) * container.effect.partialActivationFactor - grid.currentItem.x * (1 - container.effect.partialActivationFactor)
|
x: Math.max(0, container.width / 2 - (grid.width * grid.targetScale) / 2) * container.effect.partialActivationFactor - grid.currentItem.x * (1 - container.effect.partialActivationFactor)
|
||||||
y: Math.max(0, container.height / 2 - (height * targetScale) / 2) * container.effect.partialActivationFactor - grid.currentItem.y * (1 - container.effect.partialActivationFactor)
|
y: Math.max(0, container.height / 2 - (grid.height * grid.targetScale) / 2) * container.effect.partialActivationFactor - grid.currentItem.y * (1 - container.effect.partialActivationFactor)
|
||||||
scale: 1 - (1 - grid.targetScale) * container.effect.partialActivationFactor
|
scale: 1 - (1 - grid.targetScale) * container.effect.partialActivationFactor
|
||||||
panelOpacity: 1 - container.effect.partialActivationFactor
|
panelOpacity: 1 - container.effect.partialActivationFactor
|
||||||
}
|
}
|
||||||
|
@ -213,8 +213,8 @@ Rectangle {
|
||||||
when: container.organized
|
when: container.organized
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: grid
|
target: grid
|
||||||
x: Math.max(0, container.width / 2 - (width * targetScale) / 2)
|
x: Math.max(0, container.width / 2 - (grid.width * grid.targetScale) / 2)
|
||||||
y: Math.max(0, container.height / 2 - (height * targetScale) / 2)
|
y: Math.max(0, container.height / 2 - (grid.height * grid.targetScale) / 2)
|
||||||
scale: grid.targetScale
|
scale: grid.targetScale
|
||||||
panelOpacity: 0
|
panelOpacity: 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtQuick.Controls 2.12
|
import QtQuick.Controls 2.15
|
||||||
import QtQuick.Layouts 1.12
|
import QtQuick.Layouts 1.15
|
||||||
import QtGraphicalEffects 1.12
|
import QtGraphicalEffects 1.15
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtGraphicalEffects 1.12
|
import QtGraphicalEffects 1.15
|
||||||
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.kwin.private.effects 1.0
|
import org.kde.kwin.private.effects 1.0
|
||||||
import org.kde.milou 0.3 as Milou
|
import org.kde.milou 0.3 as Milou
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
import org.kde.plasma.extras 2.0 as PlasmaExtras
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
|
||||||
|
|
||||||
FocusScope {
|
FocusScope {
|
||||||
id: container
|
id: container
|
||||||
|
@ -257,8 +257,8 @@ FocusScope {
|
||||||
filter: searchField.text
|
filter: searchField.text
|
||||||
minimizedWindows: !effect.ignoreMinimized
|
minimizedWindows: !effect.ignoreMinimized
|
||||||
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
||||||
~KWinComponents.ClientFilterModel.Desktop &
|
~KWinComponents.ClientFilterModel.Desktop &
|
||||||
~KWinComponents.ClientFilterModel.Notification
|
~KWinComponents.ClientFilterModel.Notification
|
||||||
}
|
}
|
||||||
onActivated: effect.deactivate();
|
onActivated: effect.deactivate();
|
||||||
delegate: WindowHeapDelegate {
|
delegate: WindowHeapDelegate {
|
||||||
|
@ -269,11 +269,11 @@ FocusScope {
|
||||||
return targetScale; // leave it alone, so it won't affect transitions before they start
|
return targetScale; // leave it alone, so it won't affect transitions before they start
|
||||||
}
|
}
|
||||||
var localPressPosition = activeDragHandler.centroid.scenePressPosition.y - heap.layout.Kirigami.ScenePosition.y;
|
var localPressPosition = activeDragHandler.centroid.scenePressPosition.y - heap.layout.Kirigami.ScenePosition.y;
|
||||||
if (localPressPosition == 0) {
|
if (localPressPosition === 0) {
|
||||||
return 0.1
|
return 0.1;
|
||||||
} else {
|
} else {
|
||||||
var localPosition = activeDragHandler.centroid.scenePosition.y - heap.layout.Kirigami.ScenePosition.y;
|
var localPosition = activeDragHandler.centroid.scenePosition.y - heap.layout.Kirigami.ScenePosition.y;
|
||||||
return Math.max(0.1, Math.min(localPosition / localPressPosition, 1))
|
return Math.max(0.1, Math.min(localPosition / localPressPosition, 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtQuick.Window 2.12
|
import QtQuick.Window 2.15
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.kwin.private.effects 1.0
|
import org.kde.kwin.private.effects 1.0
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
|
@ -32,6 +32,7 @@ FocusScope {
|
||||||
property bool animationEnabled: false
|
property bool animationEnabled: false
|
||||||
property bool absolutePositioning: true
|
property bool absolutePositioning: true
|
||||||
property real padding: 0
|
property real padding: 0
|
||||||
|
// Either a string "activeClass" or a list internalIds of clients
|
||||||
property var showOnly: []
|
property var showOnly: []
|
||||||
property string activeClass
|
property string activeClass
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
function findNextItem(selectedIndex, direction) {
|
function findNextItem(selectedIndex, direction) {
|
||||||
if (selectedIndex == -1) {
|
if (selectedIndex === -1) {
|
||||||
return findFirstItem();
|
return findFirstItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +148,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidateItem.x + candidateItem.width < selectedItem.x + selectedItem.width) {
|
if (candidateItem.x + candidateItem.width < selectedItem.x + selectedItem.width) {
|
||||||
if (nextIndex == -1) {
|
if (nextIndex === -1) {
|
||||||
nextIndex = candidateIndex;
|
nextIndex = candidateIndex;
|
||||||
} else {
|
} else {
|
||||||
const nextItem = windowsRepeater.itemAt(nextIndex);
|
const nextItem = windowsRepeater.itemAt(nextIndex);
|
||||||
|
@ -172,11 +173,11 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedItem.x < candidateItem.x) {
|
if (selectedItem.x < candidateItem.x) {
|
||||||
if (nextIndex == -1) {
|
if (nextIndex === -1) {
|
||||||
nextIndex = candidateIndex;
|
nextIndex = candidateIndex;
|
||||||
} else {
|
} else {
|
||||||
const nextItem = windowsRepeater.itemAt(nextIndex);
|
const nextItem = windowsRepeater.itemAt(nextIndex);
|
||||||
if (nextIndex == -1 || candidateItem.x < nextItem.x) {
|
if (nextIndex === -1 || candidateItem.x < nextItem.x) {
|
||||||
nextIndex = candidateIndex;
|
nextIndex = candidateIndex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +198,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (candidateItem.y + candidateItem.height < selectedItem.y + selectedItem.height) {
|
if (candidateItem.y + candidateItem.height < selectedItem.y + selectedItem.height) {
|
||||||
if (nextIndex == -1) {
|
if (nextIndex === -1) {
|
||||||
nextIndex = candidateIndex;
|
nextIndex = candidateIndex;
|
||||||
} else {
|
} else {
|
||||||
const nextItem = windowsRepeater.itemAt(nextIndex);
|
const nextItem = windowsRepeater.itemAt(nextIndex);
|
||||||
|
@ -222,7 +223,7 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedItem.y < candidateItem.y) {
|
if (selectedItem.y < candidateItem.y) {
|
||||||
if (nextIndex == -1) {
|
if (nextIndex === -1) {
|
||||||
nextIndex = candidateIndex;
|
nextIndex = candidateIndex;
|
||||||
} else {
|
} else {
|
||||||
const nextItem = windowsRepeater.itemAt(nextIndex);
|
const nextItem = windowsRepeater.itemAt(nextIndex);
|
||||||
|
@ -239,30 +240,30 @@ FocusScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetSelected() {
|
function resetSelected() {
|
||||||
heap.selectedIndex = -1;
|
selectedIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectNextItem(direction) {
|
function selectNextItem(direction) {
|
||||||
const nextIndex = findNextItem(heap.selectedIndex, direction);
|
const nextIndex = findNextItem(selectedIndex, direction);
|
||||||
if (nextIndex != -1) {
|
if (nextIndex !== -1) {
|
||||||
heap.selectedIndex = nextIndex;
|
selectedIndex = nextIndex;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectLastItem(direction) {
|
function selectLastItem(direction) {
|
||||||
let last = heap.selectedIndex;
|
let last = selectedIndex;
|
||||||
while (true) {
|
while (true) {
|
||||||
const next = findNextItem(last, direction);
|
const next = findNextItem(last, direction);
|
||||||
if (next == -1) {
|
if (next === -1) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
last = next;
|
last = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (last != -1) {
|
if (last !== -1) {
|
||||||
heap.selectedIndex = last;
|
selectedIndex = last;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -301,8 +302,8 @@ FocusScope {
|
||||||
case Qt.Key_Space:
|
case Qt.Key_Space:
|
||||||
handled = true;
|
handled = true;
|
||||||
let selectedItem = null;
|
let selectedItem = null;
|
||||||
if (heap.selectedIndex != -1) {
|
if (selectedIndex !== -1) {
|
||||||
selectedItem = windowsRepeater.itemAt(heap.selectedIndex);
|
selectedItem = windowsRepeater.itemAt(selectedIndex);
|
||||||
} else {
|
} else {
|
||||||
// If the window heap has only one visible window, activate it.
|
// If the window heap has only one visible window, activate it.
|
||||||
for (let i = 0; i < windowsRepeater.count; ++i) {
|
for (let i = 0; i < windowsRepeater.count; ++i) {
|
||||||
|
@ -319,7 +320,7 @@ FocusScope {
|
||||||
if (selectedItem) {
|
if (selectedItem) {
|
||||||
handled = true;
|
handled = true;
|
||||||
KWinComponents.Workspace.activeClient = selectedItem.client;
|
KWinComponents.Workspace.activeClient = selectedItem.client;
|
||||||
heap.activated();
|
activated();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4,15 +4,14 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtQuick.Window 2.12
|
import QtQuick.Window 2.15
|
||||||
import org.kde.kirigami 2.12 as Kirigami
|
import org.kde.kirigami 2.20 as Kirigami
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.kwin.private.effects 1.0
|
import org.kde.kwin.private.effects 1.0
|
||||||
import org.kde.plasma.components 3.0 as PC3
|
import org.kde.plasma.components 3.0 as PC3
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: thumb
|
id: thumb
|
||||||
|
|
||||||
|
@ -20,13 +19,15 @@ Item {
|
||||||
required property int index
|
required property int index
|
||||||
required property Item windowHeap
|
required property Item windowHeap
|
||||||
|
|
||||||
readonly property bool selected: thumb.windowHeap.selectedIndex == index
|
readonly property bool selected: windowHeap.selectedIndex === index
|
||||||
//TODO: move?
|
//TODO: move?
|
||||||
readonly property bool hidden: {
|
readonly property bool hidden: {
|
||||||
if (thumb.windowHeap.showOnly === "activeClass") {
|
if (windowHeap.showOnly === "activeClass") {
|
||||||
return thumb.windowHeap.activeClass !== String(thumb.client.resourceName); // thumb.client.resourceName is not an actual String as comes from a QByteArray so === would fail
|
// client.resourceName is not an actual String as comes from a QByteArray so === would fail
|
||||||
|
return windowHeap.activeClass !== String(client.resourceName);
|
||||||
} else {
|
} else {
|
||||||
return thumb.windowHeap.showOnly.length && thumb.windowHeap.showOnly.indexOf(client.internalId) == -1;
|
return windowHeap.showOnly.length !== 0
|
||||||
|
&& windowHeap.showOnly.indexOf(client.internalId) === -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,15 +39,15 @@ Item {
|
||||||
//scale up and down the whole thumbnail without affecting layouting
|
//scale up and down the whole thumbnail without affecting layouting
|
||||||
property real targetScale: 1.0
|
property real targetScale: 1.0
|
||||||
|
|
||||||
|
property DragManager activeDragHandler: dragHandler
|
||||||
|
|
||||||
// Swipe down gesture by touch, in some effects will close the window
|
// Swipe down gesture by touch, in some effects will close the window
|
||||||
readonly property alias downGestureProgress: touchDragHandler.downGestureProgress
|
readonly property alias downGestureProgress: touchDragHandler.downGestureProgress
|
||||||
signal downGestureTriggered()
|
signal downGestureTriggered()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
if (thumb.client.active) {
|
if (client.active) {
|
||||||
thumb.windowHeap.activeClass = thumb.client.resourceName;
|
windowHeap.activeClass = client.resourceName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Connections {
|
Connections {
|
||||||
|
@ -62,15 +63,15 @@ Item {
|
||||||
if (effect.gestureInProgress) {
|
if (effect.gestureInProgress) {
|
||||||
return "partial";
|
return "partial";
|
||||||
}
|
}
|
||||||
if (thumb.windowHeap.effectiveOrganized) {
|
if (windowHeap.effectiveOrganized) {
|
||||||
return hidden ? "active-hidden" : "active";
|
return hidden ? "active-hidden" : "active";
|
||||||
}
|
}
|
||||||
return client.minimized ? "initial-minimized" : "initial";
|
return client.minimized ? "initial-minimized" : "initial";
|
||||||
}
|
}
|
||||||
|
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
z: thumb.activeDragHandler.active ? 1000
|
z: activeDragHandler.active ? 1000
|
||||||
: client.stackingOrder + (thumb.client.desktop == KWinComponents.Workspace.currentDesktop ? 100 : 0)
|
: client.stackingOrder + (client.desktop === KWinComponents.Workspace.currentDesktop ? 100 : 0)
|
||||||
|
|
||||||
component TweenBehavior : Behavior {
|
component TweenBehavior : Behavior {
|
||||||
enabled: thumb.state !== "partial" && thumb.windowHeap.animationEnabled && !thumb.activeDragHandler.active
|
enabled: thumb.state !== "partial" && thumb.windowHeap.animationEnabled && !thumb.activeDragHandler.active
|
||||||
|
@ -160,7 +161,6 @@ Item {
|
||||||
anchors.bottomMargin: -height / 4
|
anchors.bottomMargin: -height / 4
|
||||||
visible: !thumb.hidden && !activeDragHandler.active
|
visible: !thumb.hidden && !activeDragHandler.active
|
||||||
|
|
||||||
|
|
||||||
PC3.Label {
|
PC3.Label {
|
||||||
id: caption
|
id: caption
|
||||||
visible: thumb.windowTitleVisible
|
visible: thumb.windowTitleVisible
|
||||||
|
@ -213,7 +213,7 @@ Item {
|
||||||
y: (thumb.client.y - targetScreen.geometry.y - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.y : 0)) * (1 - effect.partialActivationFactor) + cell.y * effect.partialActivationFactor
|
y: (thumb.client.y - targetScreen.geometry.y - (thumb.windowHeap.absolutePositioning ? windowHeap.layout.Kirigami.ScenePosition.y : 0)) * (1 - effect.partialActivationFactor) + cell.y * effect.partialActivationFactor
|
||||||
width: thumb.client.width * (1 - effect.partialActivationFactor) + cell.width * effect.partialActivationFactor
|
width: thumb.client.width * (1 - effect.partialActivationFactor) + cell.width * effect.partialActivationFactor
|
||||||
height: thumb.client.height * (1 - effect.partialActivationFactor) + cell.height * effect.partialActivationFactor
|
height: thumb.client.height * (1 - effect.partialActivationFactor) + cell.height * effect.partialActivationFactor
|
||||||
opacity: thumb.client.minimized || thumb.client.desktop != KWinComponents.Workspace.currentDesktop ? effect.partialActivationFactor : 1
|
opacity: thumb.client.minimized || thumb.client.desktop !== KWinComponents.Workspace.currentDesktop ? effect.partialActivationFactor : 1
|
||||||
}
|
}
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
target: icon
|
target: icon
|
||||||
|
@ -278,7 +278,6 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PlasmaCore.FrameSvgItem {
|
PlasmaCore.FrameSvgItem {
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
|
@ -295,7 +294,7 @@ Item {
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
id: hoverHandler
|
id: hoverHandler
|
||||||
onHoveredChanged: if (hovered != selected) {
|
onHoveredChanged: if (hovered !== selected) {
|
||||||
thumb.windowHeap.resetSelected();
|
thumb.windowHeap.resetSelected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,11 +330,12 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property DragManager activeDragHandler: dragHandler
|
|
||||||
DragManager {
|
DragManager {
|
||||||
id: dragHandler
|
id: dragHandler
|
||||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
|
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad | PointerDevice.Stylus
|
||||||
}
|
}
|
||||||
|
|
||||||
DragManager {
|
DragManager {
|
||||||
id: touchDragHandler
|
id: touchDragHandler
|
||||||
acceptedDevices: PointerDevice.TouchScreen
|
acceptedDevices: PointerDevice.TouchScreen
|
||||||
|
@ -384,7 +384,7 @@ Item {
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
thumb.windowHeap.resetSelected();
|
windowHeap.resetSelected();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
SPDX-License-Identifier: GPL-2.0-or-later
|
SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import QtQuick 2.12
|
import QtQuick 2.15
|
||||||
import QtQuick.Layouts 1.4
|
import QtQuick.Layouts 1.15
|
||||||
import QtGraphicalEffects 1.12
|
import QtGraphicalEffects 1.15
|
||||||
import org.kde.kwin 3.0 as KWinComponents
|
import org.kde.kwin 3.0 as KWinComponents
|
||||||
import org.kde.kwin.private.effects 1.0
|
import org.kde.kwin.private.effects 1.0
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
|
@ -26,12 +26,12 @@ Item {
|
||||||
readonly property int animationDuration: PlasmaCore.Units.longDuration
|
readonly property int animationDuration: PlasmaCore.Units.longDuration
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
container.animationEnabled = true;
|
animationEnabled = true;
|
||||||
container.organized = true;
|
organized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
container.organized = false;
|
organized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Keys.onEscapePressed: effect.deactivate(animationDuration);
|
Keys.onEscapePressed: effect.deactivate(animationDuration);
|
||||||
|
@ -150,9 +150,9 @@ Item {
|
||||||
switch (container.effect.mode) {
|
switch (container.effect.mode) {
|
||||||
case WindowView.ModeWindowClass:
|
case WindowView.ModeWindowClass:
|
||||||
case WindowView.ModeWindowClassCurrentDesktop:
|
case WindowView.ModeWindowClassCurrentDesktop:
|
||||||
return "activeClass"
|
return "activeClass";
|
||||||
default:
|
default:
|
||||||
return selectedIds
|
return selectedIds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layout.mode: effect.layout
|
layout.mode: effect.layout
|
||||||
|
@ -168,9 +168,9 @@ Item {
|
||||||
switch (container.effect.mode) {
|
switch (container.effect.mode) {
|
||||||
case WindowView.ModeCurrentDesktop:
|
case WindowView.ModeCurrentDesktop:
|
||||||
case WindowView.ModeWindowClassCurrentDesktop:
|
case WindowView.ModeWindowClassCurrentDesktop:
|
||||||
return KWinComponents.Workspace.currentVirtualDesktop
|
return KWinComponents.Workspace.currentVirtualDesktop;
|
||||||
default:
|
default:
|
||||||
return undefined
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
screenName: targetScreen.name
|
screenName: targetScreen.name
|
||||||
|
@ -178,8 +178,8 @@ Item {
|
||||||
filter: effect.searchText
|
filter: effect.searchText
|
||||||
minimizedWindows: !effect.ignoreMinimized
|
minimizedWindows: !effect.ignoreMinimized
|
||||||
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
windowType: ~KWinComponents.ClientFilterModel.Dock &
|
||||||
~KWinComponents.ClientFilterModel.Desktop &
|
~KWinComponents.ClientFilterModel.Desktop &
|
||||||
~KWinComponents.ClientFilterModel.Notification;
|
~KWinComponents.ClientFilterModel.Notification
|
||||||
}
|
}
|
||||||
delegate: WindowHeapDelegate {
|
delegate: WindowHeapDelegate {
|
||||||
windowHeap: heap
|
windowHeap: heap
|
||||||
|
|
Loading…
Reference in a new issue