2023-10-22 03:59:27 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: LGPL-2.0-or-later
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Window
|
|
|
|
|
import QtQuick.Layouts
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PC3
|
2025-05-01 09:04:38 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2023-10-22 03:59:27 +00:00
|
|
|
import org.kde.kirigami 2.10 as Kirigami
|
2025-07-16 17:02:18 +00:00
|
|
|
import plasma.applet.org.kde.plasma.mobile.homescreen.folio as Folio
|
2023-07-25 01:13:52 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
MouseArea {
|
|
|
|
|
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
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
property var homeScreen
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2024-06-21 04:42:14 +00:00
|
|
|
readonly property real verticalMargin: Math.round((folio.HomeScreenState.pageHeight - folio.HomeScreenState.pageContentHeight) / 2)
|
|
|
|
|
readonly property real horizontalMargin: Math.round((folio.HomeScreenState.pageWidth - folio.HomeScreenState.pageContentWidth) / 2)
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
onPressAndHold: {
|
|
|
|
|
folio.HomeScreenState.openSettingsView()
|
|
|
|
|
haptics.buttonVibrate();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onDoubleClicked: {
|
|
|
|
|
if (folio.FolioSettings.doubleTapToLock) {
|
|
|
|
|
deviceLock.triggerLock();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-08-11 20:04:35 +00:00
|
|
|
onActiveFocusChanged: {
|
|
|
|
|
if (activeFocus) {
|
|
|
|
|
// When this component is focused, move focus to current page (keyboard navigation)
|
|
|
|
|
focusCurrentPageForKeyboardNav();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function focusCurrentPageForKeyboardNav() {
|
|
|
|
|
const currentPage = pageRepeater.itemAt(folio.HomeScreenState.currentPage);
|
|
|
|
|
if (currentPage) {
|
|
|
|
|
currentPage.forceActiveFocus();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-01 09:04:38 +00:00
|
|
|
MobileShell.HapticsEffect {
|
|
|
|
|
id: haptics
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-27 04:14:26 +00:00
|
|
|
MobileShell.DeviceLock {
|
|
|
|
|
id: deviceLock
|
2025-05-01 09:04:38 +00:00
|
|
|
}
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
Repeater {
|
2025-08-11 20:04:35 +00:00
|
|
|
id: pageRepeater
|
2024-06-21 04:42:14 +00:00
|
|
|
model: folio.PageListModel
|
2021-03-26 16:21:30 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
delegate: HomeScreenPage {
|
|
|
|
|
id: homeScreenPage
|
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
|
2023-10-22 03:59:27 +00:00
|
|
|
pageNum: model.index
|
|
|
|
|
pageModel: model.delegate
|
|
|
|
|
homeScreen: root.homeScreen
|
2021-12-31 00:49:08 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
anchors.fill: root
|
|
|
|
|
anchors.leftMargin: root.horizontalMargin
|
|
|
|
|
anchors.rightMargin: root.horizontalMargin
|
|
|
|
|
anchors.topMargin: root.verticalMargin
|
|
|
|
|
anchors.bottomMargin: root.verticalMargin
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// animation so that full opacity is only when the page is in view
|
2026-02-19 03:43:13 +00:00
|
|
|
readonly property real distanceToCenter: Math.abs(-folio.HomeScreenState.pageViewX - folio.HomeScreenState.pageWidth * pageNum)
|
|
|
|
|
readonly property real positionX: folio.HomeScreenState.pageWidth * index + folio.HomeScreenState.pageViewX
|
|
|
|
|
readonly property real progressToCenter: 1 - Math.min(1, Math.max(0, distanceToCenter / folio.HomeScreenState.pageWidth))
|
|
|
|
|
|
|
|
|
|
// Use layer to render all page items together in one texture
|
|
|
|
|
layer.enabled: Math.abs(index - folio.HomeScreenState.currentPage) <= 1
|
|
|
|
|
&& !folio.HomeScreenState.isDraggingDelegate
|
|
|
|
|
layer.smooth: true
|
2023-10-22 19:34:02 +00:00
|
|
|
|
2023-10-23 03:41:44 +00:00
|
|
|
visible: opacity > 0
|
|
|
|
|
opacity: {
|
2024-06-21 04:42:14 +00:00
|
|
|
switch (folio.FolioSettings.pageTransitionEffect) {
|
2023-10-23 03:41:44 +00:00
|
|
|
case Folio.FolioSettings.StackTransition:
|
|
|
|
|
return (positionX < 0) ? progressToCenter :
|
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
|
|
|
((progressToCenter < 0.3) ? 0 : ((1 / 0.7) * (progressToCenter - 0.3)))
|
2023-10-23 03:41:44 +00:00
|
|
|
default:
|
|
|
|
|
return progressToCenter;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-19 16:30:43 +00:00
|
|
|
|
2023-10-22 03:59:27 +00:00
|
|
|
// x position of page
|
2023-10-23 03:41:44 +00:00
|
|
|
transform: {
|
2024-06-21 04:42:14 +00:00
|
|
|
switch (folio.FolioSettings.pageTransitionEffect) {
|
2023-10-23 03:41:44 +00:00
|
|
|
case Folio.FolioSettings.SlideTransition:
|
|
|
|
|
return [translate];
|
|
|
|
|
case Folio.FolioSettings.CubeTransition:
|
|
|
|
|
return [translate, cubeTransitionRotation];
|
|
|
|
|
case Folio.FolioSettings.FadeTransition:
|
|
|
|
|
return [];
|
|
|
|
|
case Folio.FolioSettings.StackTransition:
|
|
|
|
|
return [stackScale, stackTranslate];
|
|
|
|
|
case Folio.FolioSettings.RotationTransition:
|
|
|
|
|
return [translate, rotationTransitionRotation];
|
|
|
|
|
default:
|
|
|
|
|
return [translate];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Translate {
|
|
|
|
|
id: translate
|
|
|
|
|
x: homeScreenPage.positionX
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Scale {
|
|
|
|
|
id: stackScale
|
2024-06-21 04:42:14 +00:00
|
|
|
origin.x: folio.HomeScreenState.pageWidth / 2
|
|
|
|
|
origin.y: folio.HomeScreenState.pageHeight / 2
|
2023-10-23 03:41:44 +00:00
|
|
|
xScale: (homeScreenPage.positionX < 0) ? 1 : 0.5 + homeScreenPage.progressToCenter * 0.5
|
|
|
|
|
yScale: (homeScreenPage.positionX < 0) ? 1 : 0.5 + homeScreenPage.progressToCenter * 0.5
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Translate {
|
|
|
|
|
id: stackTranslate
|
|
|
|
|
x: Math.min(0, homeScreenPage.positionX)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rotation {
|
|
|
|
|
id: cubeTransitionRotation
|
|
|
|
|
origin.x: (positionX < 0) ?
|
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
|
|
|
(folio.HomeScreenState.pageWidth / 2) * homeScreenPage.progressToCenter :
|
|
|
|
|
(folio.HomeScreenState.pageWidth / 2) + (folio.HomeScreenState.pageWidth / 2) * (1 - homeScreenPage.progressToCenter);
|
2024-07-14 02:36:17 +00:00
|
|
|
origin.y: folio.HomeScreenState.pageHeight / 2;
|
2023-10-23 03:41:44 +00:00
|
|
|
axis { x: 0; y: 1; z: 0 }
|
|
|
|
|
angle: {
|
|
|
|
|
return Math.min(1, Math.max(0, distanceToCenter / root.width)) * 90 * ((positionX > 0) ? 1 : -1)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Rotation {
|
|
|
|
|
id: rotationTransitionRotation
|
|
|
|
|
origin.x: (positionX < 0) ?
|
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
|
|
|
(folio.HomeScreenState.pageWidth / 2) * homeScreenPage.progressToCenter :
|
|
|
|
|
(folio.HomeScreenState.pageWidth / 2) + (folio.HomeScreenState.pageWidth / 2) * (1 - homeScreenPage.progressToCenter);
|
2023-10-23 03:41:44 +00:00
|
|
|
origin.y: 0
|
|
|
|
|
axis { x: -0.2; y: 0.3; z: 0.5 }
|
|
|
|
|
angle: {
|
|
|
|
|
return Math.min(1, Math.max(0, distanceToCenter / root.width)) * 90 * ((positionX > 0) ? 1 : -1)
|
2023-10-22 19:34:02 +00:00
|
|
|
}
|
2023-10-23 03:41:44 +00:00
|
|
|
}
|
2021-03-24 13:48:56 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-03-19 16:30:43 +00:00
|
|
|
}
|