2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Layouts
|
2023-11-05 05:14:39 +00:00
|
|
|
import QtQuick.Effects
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2025-07-16 17:02:18 +00:00
|
|
|
import plasma.applet.org.kde.plasma.mobile.homescreen.folio as Folio
|
2023-11-05 05:14:39 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
import "./delegate"
|
2023-11-05 05:14:39 +00:00
|
|
|
import "./private"
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
Item {
|
|
|
|
|
id: root
|
2024-06-21 04:42:14 +00:00
|
|
|
property Folio.HomeScreen folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
property MobileShell.MaskManager maskManager
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property int pageNum
|
|
|
|
|
|
|
|
|
|
property var pageModel
|
|
|
|
|
property var homeScreen
|
|
|
|
|
|
2025-08-11 20:04:35 +00:00
|
|
|
onActiveFocusChanged: {
|
|
|
|
|
if (activeFocus) {
|
|
|
|
|
// Focus on first delegate when this page is focused
|
|
|
|
|
let firstDelegate = findFirstDelegate();
|
|
|
|
|
if (!firstDelegate) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
firstDelegate.keyboardFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Returns the first delegate on the page, or null if none exist
|
|
|
|
|
function findFirstDelegate() {
|
|
|
|
|
let firstDelegate = delegateRepeater.itemAt(0);
|
|
|
|
|
if (!firstDelegate) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < delegateRepeater.count; ++i) {
|
|
|
|
|
let delegate = delegateRepeater.itemAt(i);
|
|
|
|
|
|
|
|
|
|
const isAppOrFolder = delegate.pageDelegate.type === Folio.FolioDelegate.Application || delegate.pageDelegate.type === Folio.FolioDelegate.Folder;
|
|
|
|
|
|
|
|
|
|
// If it's on an earlier row, or on the same row but earlier column
|
|
|
|
|
if (isAppOrFolder
|
|
|
|
|
&& (delegate.row < firstDelegate.row
|
|
|
|
|
|| (delegate.column < firstDelegate.column
|
|
|
|
|
&& delegate.row === firstDelegate.row))) {
|
|
|
|
|
firstDelegate = delegate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return firstDelegate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Returns the next application/folder delegate on the page from the given delegate
|
|
|
|
|
// in a certain direction, or null if none exist.
|
|
|
|
|
function findNextAppDelegate(delegate, direction: MobileShell.Direction) {
|
|
|
|
|
let dx = 0;
|
|
|
|
|
let dy = 0;
|
|
|
|
|
switch (direction) {
|
|
|
|
|
case MobileShell.Direction.Up:
|
|
|
|
|
dy = -1;
|
|
|
|
|
break;
|
|
|
|
|
case MobileShell.Direction.Down:
|
|
|
|
|
dy = 1;
|
|
|
|
|
break;
|
|
|
|
|
case MobileShell.Direction.Left:
|
|
|
|
|
dx = -1;
|
|
|
|
|
break;
|
|
|
|
|
case MobileShell.Direction.Right:
|
|
|
|
|
dx = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let x = delegate.column + dx;
|
|
|
|
|
let y = delegate.row + dy;
|
|
|
|
|
|
|
|
|
|
// Loop in direction to find delegate
|
|
|
|
|
while (x >= 0 && x < folio.HomeScreenState.pageColumns && y >= 0 && y < folio.HomeScreenState.pageRows) {
|
|
|
|
|
for (let i = 0; i < delegateRepeater.count; ++i) {
|
|
|
|
|
let delegate = delegateRepeater.itemAt(i);
|
|
|
|
|
|
|
|
|
|
if (delegate.row === y && delegate.column === x
|
|
|
|
|
&& (delegate.pageDelegate.type === Folio.FolioDelegate.Application
|
|
|
|
|
|| delegate.pageDelegate.type === Folio.FolioDelegate.Folder)) {
|
|
|
|
|
return delegate;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
x += dx;
|
|
|
|
|
y += dy;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 09:04:38 +00:00
|
|
|
MobileShell.HapticsEffect {
|
|
|
|
|
id: haptics
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// background when in settings view (for rearranging pages)
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: settingsViewBackground
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
color: Qt.rgba(255, 255, 255, 0.2)
|
2024-06-21 04:42:14 +00:00
|
|
|
opacity: folio.HomeScreenState.settingsOpenProgress
|
2023-10-22 03:59:27 +00:00
|
|
|
radius: Kirigami.Units.largeSpacing
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// square that shows when hovering over a spot to drop a delegate on
|
|
|
|
|
PlaceholderDelegate {
|
|
|
|
|
id: dragDropFeedback
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dropPosition: folio.HomeScreenState.dragState.candidateDropPosition
|
|
|
|
|
property var dropDelegate: folio.HomeScreenState.dragState.dropDelegate
|
2023-11-05 05:14:39 +00:00
|
|
|
property bool dropDelegateIsWidget: dropDelegate && dropDelegate.type === Folio.FolioDelegate.Widget
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// only show if it is an empty spot on this page
|
2025-12-12 05:33:25 +00:00
|
|
|
visible: folio.HomeScreenState.isDraggingDelegate &&
|
|
|
|
|
dropPosition.location === Folio.DelegateDragPosition.Pages &&
|
|
|
|
|
dropPosition.page === root.pageNum &&
|
|
|
|
|
!dropDelegateIsWidget &&
|
|
|
|
|
folio.HomeScreenState.getPageDelegateAt(root.pageNum, dropPosition.pageRow, dropPosition.pageColumn) === null
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: dropPosition.pageColumn * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: dropPosition.pageRow * folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
// square that shows when a widget hovers over a spot to drop a delegate on
|
|
|
|
|
Rectangle {
|
|
|
|
|
id: widgetDragDropFeedback
|
2024-06-21 04:42:14 +00:00
|
|
|
width: (dropDelegateIsWidget ? dropDelegate.widget.gridWidth : 0) * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: (dropDelegateIsWidget ? dropDelegate.widget.gridHeight : 0) * folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dropPosition: folio.HomeScreenState.dragState.candidateDropPosition
|
|
|
|
|
property var dropDelegate: folio.HomeScreenState.dragState.dropDelegate
|
2023-11-05 05:14:39 +00:00
|
|
|
property bool dropDelegateIsWidget: dropDelegate && dropDelegate.type === Folio.FolioDelegate.Widget
|
|
|
|
|
|
|
|
|
|
// only show if the widget can be placed here
|
2025-12-12 05:33:25 +00:00
|
|
|
visible: folio.HomeScreenState.isDraggingDelegate &&
|
2025-08-11 20:04:35 +00:00
|
|
|
dropPosition.location === Folio.DelegateDragPosition.Pages &&
|
|
|
|
|
dropPosition.page === root.pageNum &&
|
|
|
|
|
dropDelegateIsWidget &&
|
|
|
|
|
pageModel.canAddDelegate(dropPosition.pageRow, dropPosition.pageColumn, dropDelegate)
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2024-07-27 04:02:05 +00:00
|
|
|
radius: Kirigami.Units.cornerRadius
|
2023-11-05 05:14:39 +00:00
|
|
|
color: Qt.rgba(255, 255, 255, 0.3)
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: dropPosition.pageColumn * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: dropPosition.pageRow * folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
layer.enabled: true
|
|
|
|
|
layer.effect: DelegateShadow {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// repeater of all delegates in the page
|
2023-10-22 03:59:27 +00:00
|
|
|
Repeater {
|
2025-08-11 20:04:35 +00:00
|
|
|
id: delegateRepeater
|
2023-10-22 03:59:27 +00:00
|
|
|
model: root.pageModel
|
|
|
|
|
|
|
|
|
|
delegate: Item {
|
|
|
|
|
id: delegate
|
|
|
|
|
|
|
|
|
|
property Folio.FolioPageDelegate pageDelegate: model.delegate
|
|
|
|
|
property int row: pageDelegate.row
|
|
|
|
|
property int column: pageDelegate.column
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
property var dragState: folio.HomeScreenState.dragState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
property bool isDropPositionThis: dragState.candidateDropPosition.location === Folio.DelegateDragPosition.Pages &&
|
2025-08-11 20:04:35 +00:00
|
|
|
dragState.candidateDropPosition.page === root.pageNum &&
|
|
|
|
|
dragState.candidateDropPosition.pageRow === delegate.pageDelegate.row &&
|
|
|
|
|
dragState.candidateDropPosition.pageColumn === delegate.pageDelegate.column
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-12-12 05:33:25 +00:00
|
|
|
property bool isAppHoveredOver: folio.HomeScreenState.isDraggingDelegate &&
|
2025-08-11 20:04:35 +00:00
|
|
|
dragState.dropDelegate &&
|
|
|
|
|
dragState.dropDelegate.type === Folio.FolioDelegate.Application &&
|
|
|
|
|
isDropPositionThis
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
implicitWidth: loader.item ? loader.item.implicitWidth : 0
|
|
|
|
|
implicitHeight: loader.item ? loader.item.implicitHeight : 0
|
|
|
|
|
width: loader.item ? loader.item.width : 0
|
|
|
|
|
height: loader.item ? loader.item.height : 0
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
x: column * folio.HomeScreenState.pageCellWidth
|
|
|
|
|
y: row * folio.HomeScreenState.pageCellHeight
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
visible: row >= 0 && row < folio.HomeScreenState.pageRows &&
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
column >= 0 && column < folio.HomeScreenState.pageColumns
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-03-05 03:24:44 +00:00
|
|
|
// called when we want to delete this delegate
|
|
|
|
|
function removeSelf() {
|
|
|
|
|
// remove from model
|
|
|
|
|
root.pageModel.removeDelegate(delegate.row, delegate.column);
|
2024-06-21 04:42:14 +00:00
|
|
|
|
|
|
|
|
// TODO: this doesn't work, because the removeDelegate calls removes this entire object and the calls fail
|
|
|
|
|
// // delete empty pages at the end, and snap position to page that exists
|
|
|
|
|
// folio.PageListModel.deleteEmptyPagesAtEnd();
|
|
|
|
|
// folio.HomeScreenState.snapPage();
|
2024-03-05 03:24:44 +00:00
|
|
|
}
|
|
|
|
|
|
2025-08-11 20:04:35 +00:00
|
|
|
// Keyboard navigation between delegates
|
|
|
|
|
Keys.onPressed: (event) => {
|
|
|
|
|
let direction = MobileShell.Direction.Up;
|
|
|
|
|
switch (event.key) {
|
|
|
|
|
case Qt.Key_Up:
|
|
|
|
|
direction = MobileShell.Direction.Up;
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Down:
|
|
|
|
|
direction = MobileShell.Direction.Down;
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Left:
|
|
|
|
|
direction = MobileShell.Direction.Left;
|
|
|
|
|
break;
|
|
|
|
|
case Qt.Key_Right:
|
|
|
|
|
direction = MobileShell.Direction.Right;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let nextDelegate = root.findNextAppDelegate(delegate, direction);
|
|
|
|
|
if (nextDelegate) {
|
|
|
|
|
nextDelegate.keyboardFocus();
|
|
|
|
|
event.accepted = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function keyboardFocus() {
|
|
|
|
|
if (loader.item) {
|
|
|
|
|
loader.item.keyboardFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Loader {
|
2023-11-05 05:14:39 +00:00
|
|
|
id: loader
|
|
|
|
|
anchors.top: parent.top
|
|
|
|
|
anchors.left: parent.left
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
sourceComponent: {
|
|
|
|
|
if (delegate.pageDelegate.type === Folio.FolioDelegate.Application) {
|
|
|
|
|
return appComponent;
|
|
|
|
|
} else if (delegate.pageDelegate.type === Folio.FolioDelegate.Folder) {
|
|
|
|
|
return folderComponent;
|
2023-11-05 05:14:39 +00:00
|
|
|
} else if (delegate.pageDelegate.type === Folio.FolioDelegate.Widget) {
|
|
|
|
|
return widgetComponent;
|
2023-10-22 03:59:27 +00:00
|
|
|
} else {
|
|
|
|
|
return noneComponent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: noneComponent
|
|
|
|
|
|
|
|
|
|
Item {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: appComponent
|
|
|
|
|
|
|
|
|
|
AppDelegate {
|
|
|
|
|
id: appDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showPagesAppLabels ? delegate.pageDelegate.application.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
application: delegate.pageDelegate.application
|
|
|
|
|
turnToFolder: delegate.isAppHoveredOver
|
2025-12-12 05:33:25 +00:00
|
|
|
turnToFolderAnimEnabled: folio.HomeScreenState.isDraggingDelegate
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
implicitWidth: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
implicitHeight: folio.HomeScreenState.pageCellHeight
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// do not show if the drop animation is running to this delegate
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning && delegate.isDropPositionThis)
|
|
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, appDelegate.delegateItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appDelegate.pressPosition.x,
|
|
|
|
|
appDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-12-12 05:33:25 +00:00
|
|
|
function onDelegateDragStarted() {
|
|
|
|
|
contextMenu.close();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2025-04-21 14:01:54 +00:00
|
|
|
enabled: !folio.FolioSettings.lockLayout
|
2024-03-05 03:24:44 +00:00
|
|
|
onTriggered: delegate.removeSelf()
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: folderComponent
|
|
|
|
|
|
|
|
|
|
AppFolderDelegate {
|
|
|
|
|
id: appFolderDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
maskManager: root.maskManager
|
2024-06-21 04:42:14 +00:00
|
|
|
name: folio.FolioSettings.showPagesAppLabels ? delegate.pageDelegate.folder.name : ""
|
2023-10-22 03:59:27 +00:00
|
|
|
folder: delegate.pageDelegate.folder
|
|
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
implicitWidth: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
implicitHeight: folio.HomeScreenState.pageCellHeight
|
|
|
|
|
width: folio.HomeScreenState.pageCellWidth
|
|
|
|
|
height: folio.HomeScreenState.pageCellHeight
|
2023-11-05 05:14:39 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// do not show if the drop animation is running to this delegate, and the drop delegate is a folder
|
|
|
|
|
visible: !(root.homeScreen.dropAnimationRunning &&
|
2025-08-11 20:04:35 +00:00
|
|
|
delegate.isDropPositionThis &&
|
|
|
|
|
delegate.dragState.dropDelegate.type === Folio.FolioDelegate.Folder)
|
2023-10-22 03:59:27 +00:00
|
|
|
|
|
|
|
|
// don't show label in drag and drop mode
|
|
|
|
|
labelOpacity: delegate.opacity
|
|
|
|
|
|
|
|
|
|
appHoveredOver: delegate.isAppHoveredOver
|
|
|
|
|
|
|
|
|
|
onAfterClickAnimation: {
|
|
|
|
|
const pos = homeScreen.prepareFolderOpen(appFolderDelegate.contentItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.openFolder(pos.x, pos.y, folder);
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHold: {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, appFolderDelegate.delegateItem);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-10-22 03:59:27 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
2023-11-05 05:14:39 +00:00
|
|
|
appFolderDelegate.pressPosition.x,
|
|
|
|
|
appFolderDelegate.pressPosition.y,
|
2023-10-22 03:59:27 +00:00
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
contextMenu.open();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressAndHoldReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
2023-10-22 03:59:27 +00:00
|
|
|
homeScreen.cancelDelegateDrag();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onRightMousePress: {
|
|
|
|
|
contextMenu.open();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ContextMenuLoader {
|
|
|
|
|
id: contextMenu
|
|
|
|
|
|
|
|
|
|
// close menu when drag starts
|
|
|
|
|
Connections {
|
2024-06-21 04:42:14 +00:00
|
|
|
target: folio.HomeScreenState
|
2023-10-22 03:59:27 +00:00
|
|
|
|
2025-12-12 05:33:25 +00:00
|
|
|
function onDelegateDragStarted() {
|
|
|
|
|
contextMenu.close();
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
actions: [
|
|
|
|
|
Kirigami.Action {
|
|
|
|
|
icon.name: "emblem-favorite"
|
|
|
|
|
text: i18n("Remove")
|
2025-04-21 14:01:54 +00:00
|
|
|
enabled: !folio.FolioSettings.lockLayout
|
2024-03-06 14:19:03 +00:00
|
|
|
onTriggered: deleteDialog.open()
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
]
|
2024-03-06 14:19:03 +00:00
|
|
|
|
|
|
|
|
ConfirmDeleteFolderDialogLoader {
|
|
|
|
|
id: deleteDialog
|
|
|
|
|
parent: root.homeScreen
|
|
|
|
|
onAccepted: delegate.removeSelf()
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
Component {
|
|
|
|
|
id: widgetComponent
|
|
|
|
|
|
|
|
|
|
WidgetDelegate {
|
|
|
|
|
id: widgetDelegate
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
// don't reparent applet if the drop animation is running to this delegate
|
|
|
|
|
// background: there is only one "visual" instance of the widget, once this delegate loads
|
|
|
|
|
// it will reparent it to here (but we don't want it to happen while the drop animation is running)
|
|
|
|
|
property bool suppressAppletReparent: (root.homeScreen.currentlyDraggedWidget === delegate.pageDelegate.widget)
|
Folio/Halcyon: Expand Background Blur Effect using a MaskLayer
This merge request expands upon the folio and halcyon background blur effects, making the folio background blur include the backgrounds of folder icons, the favorites bar, and wallpaper selector, and for halcyon, it now includes the folder icons, app library, search, and wallpaper selector. To accomplish this, a mask layer plugin was created to easily attach to these elements. This way, we can use a `OpacityMask` to cut out from the existing blur layer, thus hopefully keeping the performance cost low. And with my limited testing, it does at least seems to run about the same on my oneplus 6t, though it is not really a low end device, so I can not fairly judge the impact for something slower (eg. PinePhone). To be on the safe side, a third option was also added to the folio settings, allowing for the ability to toggle back to the old functionality if needed.




2025-06-27 18:27:30 +00:00
|
|
|
&& delegate.isDropPositionThis
|
2023-11-05 05:14:39 +00:00
|
|
|
|
|
|
|
|
visible: !suppressAppletReparent
|
|
|
|
|
widget: suppressAppletReparent ? null : delegate.pageDelegate.widget
|
|
|
|
|
|
|
|
|
|
onStartEditMode: (pressPoint) => {
|
2025-04-21 14:01:54 +00:00
|
|
|
// prevent editing if lock layout is enabled
|
|
|
|
|
if (folio.FolioSettings.lockLayout) return;
|
|
|
|
|
|
2023-11-05 05:14:39 +00:00
|
|
|
let mappedCoords = root.homeScreen.prepareStartDelegateDrag(delegate.pageDelegate, widgetDelegate);
|
2024-06-21 04:42:14 +00:00
|
|
|
folio.HomeScreenState.startDelegatePageDrag(
|
2023-11-05 05:14:39 +00:00
|
|
|
mappedCoords.x,
|
|
|
|
|
mappedCoords.y,
|
|
|
|
|
pressPoint.x - mappedCoords.x,
|
|
|
|
|
pressPoint.y - mappedCoords.y,
|
|
|
|
|
root.pageNum,
|
|
|
|
|
delegate.pageDelegate.row,
|
|
|
|
|
delegate.pageDelegate.column
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
widgetConfig.startOpen();
|
2025-05-01 09:04:38 +00:00
|
|
|
haptics.buttonVibrate();
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onPressReleased: {
|
|
|
|
|
// cancel the event if the delegate is not dragged
|
2024-06-21 04:42:14 +00:00
|
|
|
if (folio.HomeScreenState.swipeState === Folio.HomeScreenState.AwaitingDraggingDelegate) {
|
|
|
|
|
folio.HomeScreenState.cancelDelegateDrag();
|
2023-11-05 05:14:39 +00:00
|
|
|
widgetConfig.fullyOpen();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-21 14:01:54 +00:00
|
|
|
layer.enabled: widgetDelegate.editMode && folio.FolioSettings.lockLayout === false
|
2023-11-05 05:14:39 +00:00
|
|
|
layer.effect: DarkenEffect {}
|
|
|
|
|
|
|
|
|
|
PC3.ToolTip {
|
|
|
|
|
visible: widgetDelegate.editMode && pressed
|
2025-08-10 18:52:25 +00:00
|
|
|
text: i18n("Release to configure, drag to move")
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
WidgetDelegateConfig {
|
|
|
|
|
id: widgetConfig
|
2024-06-21 04:42:14 +00:00
|
|
|
folio: root.folio
|
2023-11-05 05:14:39 +00:00
|
|
|
homeScreen: root.homeScreen
|
|
|
|
|
|
|
|
|
|
pageModel: root.pageModel
|
|
|
|
|
pageDelegate: delegate.pageDelegate
|
|
|
|
|
widget: delegate.pageDelegate.widget
|
|
|
|
|
|
|
|
|
|
pageNum: root.pageNum
|
|
|
|
|
row: delegate.row
|
|
|
|
|
column: delegate.column
|
|
|
|
|
|
|
|
|
|
widgetWidth: widgetDelegate.widgetWidth
|
|
|
|
|
widgetHeight: widgetDelegate.widgetHeight
|
|
|
|
|
widgetX: delegate.x + root.anchors.leftMargin + root.homeScreen.leftMargin
|
|
|
|
|
widgetY: delegate.y + root.anchors.topMargin + root.homeScreen.topMargin
|
|
|
|
|
|
|
|
|
|
topWidgetBackgroundPadding: widgetDelegate.topWidgetBackgroundPadding
|
|
|
|
|
bottomWidgetBackgroundPadding: widgetDelegate.bottomWidgetBackgroundPadding
|
|
|
|
|
leftWidgetBackgroundPadding: widgetDelegate.leftWidgetBackgroundPadding
|
|
|
|
|
rightWidgetBackgroundPadding: widgetDelegate.rightWidgetBackgroundPadding
|
|
|
|
|
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
|
|
|
|
|
onRemoveRequested: {
|
|
|
|
|
if (widget.applet) {
|
|
|
|
|
widget.destroyApplet();
|
|
|
|
|
}
|
2024-03-05 03:24:44 +00:00
|
|
|
delegate.removeSelf();
|
2023-11-05 05:14:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onClosed: widgetDelegate.editMode = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-22 03:59:27 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|