diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 23:12:23 +0800 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-05-13 23:12:23 +0800 |
| commit | f8eb1b69a034f4aa2833271a0c6b999cfe2a477e (patch) | |
| tree | 012e14e3e6fbb890a7fbabc70e19e9f65d160400 /modules | |
| parent | session: show/hide on drag (diff) | |
| download | caelestia-shell-f8eb1b69a034f4aa2833271a0c6b999cfe2a477e.tar.gz caelestia-shell-f8eb1b69a034f4aa2833271a0c6b999cfe2a477e.tar.bz2 caelestia-shell-f8eb1b69a034f4aa2833271a0c6b999cfe2a477e.zip | |
launcher: move to drawers
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/Shortcuts.qml | 23 | ||||
| -rw-r--r-- | modules/drawers/Backgrounds.qml | 10 | ||||
| -rw-r--r-- | modules/drawers/Panels.qml | 11 | ||||
| -rw-r--r-- | modules/launcher/AppItem.qml | 4 | ||||
| -rw-r--r-- | modules/launcher/AppList.qml | 4 | ||||
| -rw-r--r-- | modules/launcher/Background.qml | 105 | ||||
| -rw-r--r-- | modules/launcher/Content.qml | 16 | ||||
| -rw-r--r-- | modules/launcher/ContentList.qml | 6 | ||||
| -rw-r--r-- | modules/launcher/WallpaperItem.qml | 4 | ||||
| -rw-r--r-- | modules/launcher/WallpaperList.qml | 4 | ||||
| -rw-r--r-- | modules/launcher/Wrapper.qml | 55 |
11 files changed, 134 insertions, 108 deletions
diff --git a/modules/Shortcuts.qml b/modules/Shortcuts.qml index f97f825..f6cc9e3 100644 --- a/modules/Shortcuts.qml +++ b/modules/Shortcuts.qml @@ -3,6 +3,10 @@ import "root:/services" import Quickshell Scope { + id: root + + property bool launcherInterrupted + CustomShortcut { name: "session" description: "Toggle session menu" @@ -11,4 +15,23 @@ Scope { visibilities.session = !visibilities.session; } } + + CustomShortcut { + name: "launcher" + description: "Toggle launcher" + onPressed: root.launcherInterrupted = false + onReleased: { + if (!root.launcherInterrupted) { + const visibilities = Visibilities.getForActive(); + visibilities.launcher = !visibilities.launcher; + } + root.launcherInterrupted = false; + } + } + + CustomShortcut { + name: "launcherInterrupt" + description: "Interrupt launcher keybind" + onPressed: root.launcherInterrupted = true + } } diff --git a/modules/drawers/Backgrounds.qml b/modules/drawers/Backgrounds.qml index 017b883..3e0156f 100644 --- a/modules/drawers/Backgrounds.qml +++ b/modules/drawers/Backgrounds.qml @@ -3,8 +3,7 @@ import "root:/config" import "root:/modules/osd" as Osd import "root:/modules/notifications" as Notifications import "root:/modules/session" as Session -import Quickshell -import QtQuick +import "root:/modules/launcher" as Launcher import QtQuick.Shapes Shape { @@ -37,4 +36,11 @@ Shape { startX: root.width startY: (root.height - wrapper.height) / 2 } + + Launcher.Background { + wrapper: panels.launcher + + startX: (root.width - wrapper.width) / 2 + startY: root.height + } } diff --git a/modules/drawers/Panels.qml b/modules/drawers/Panels.qml index c903fff..ab5f8de 100644 --- a/modules/drawers/Panels.qml +++ b/modules/drawers/Panels.qml @@ -2,6 +2,7 @@ import "root:/config" import "root:/modules/osd" as Osd import "root:/modules/notifications" as Notifications import "root:/modules/session" as Session +import "root:/modules/launcher" as Launcher import Quickshell import QtQuick @@ -14,6 +15,7 @@ Item { readonly property Osd.Wrapper osd: osd readonly property Notifications.Wrapper notifications: notifications readonly property Session.Wrapper session: session + readonly property Launcher.Wrapper launcher: launcher anchors.fill: parent anchors.margins: BorderConfig.thickness @@ -47,4 +49,13 @@ Item { anchors.verticalCenter: parent.verticalCenter anchors.right: parent.right } + + Launcher.Wrapper { + id: launcher + + visibilities: root.visibilities + + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + } } diff --git a/modules/launcher/AppItem.qml b/modules/launcher/AppItem.qml index 6335dd0..514185c 100644 --- a/modules/launcher/AppItem.qml +++ b/modules/launcher/AppItem.qml @@ -9,7 +9,7 @@ PaddedRect { id: root required property DesktopEntry modelData - required property Scope launcher + required property PersistentProperties visibilities implicitHeight: LauncherConfig.sizes.itemHeight padding: [Appearance.padding.smaller, Appearance.padding.normal] @@ -22,7 +22,7 @@ PaddedRect { function onClicked(): void { Apps.launch(root.modelData); - root.launcher.launcherVisible = false; + root.visibilities.launcher = false; } } diff --git a/modules/launcher/AppList.qml b/modules/launcher/AppList.qml index b119ee8..a431395 100644 --- a/modules/launcher/AppList.qml +++ b/modules/launcher/AppList.qml @@ -12,7 +12,7 @@ ListView { required property int padding required property TextField search - required property Scope launcher + required property PersistentProperties visibilities property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix) @@ -98,7 +98,7 @@ ListView { id: appItem AppItem { - launcher: root.launcher + visibilities: root.visibilities } } diff --git a/modules/launcher/Background.qml b/modules/launcher/Background.qml index c74adbd..672b153 100644 --- a/modules/launcher/Background.qml +++ b/modules/launcher/Background.qml @@ -3,68 +3,61 @@ import "root:/config" import QtQuick import QtQuick.Shapes -Shape { +ShapePath { id: root - required property real wrapperWidth - required property real wrapperHeight + required property Wrapper wrapper readonly property real rounding: BorderConfig.rounding - readonly property bool flatten: wrapperHeight < rounding * 2 - readonly property real roundingY: flatten ? wrapperHeight / 2 : rounding + readonly property bool flatten: wrapper.height < rounding * 2 + readonly property real roundingY: flatten ? wrapper.height / 2 : rounding - preferredRendererType: Shape.CurveRenderer - opacity: Colours.transparency.enabled ? Colours.transparency.base : 1 + strokeWidth: -1 + fillColor: BorderConfig.colour - ShapePath { - strokeWidth: -1 - fillColor: BorderConfig.colour - - startY: root.wrapperHeight - 1 - - PathArc { - relativeX: root.rounding - relativeY: -root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - direction: PathArc.Counterclockwise - } - PathLine { - relativeX: 0 - y: root.roundingY - } - PathArc { - relativeX: root.rounding - relativeY: -root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - } - PathLine { - x: root.wrapperWidth - root.rounding * 2 - } - PathArc { - relativeX: root.rounding - relativeY: root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - } - PathLine { - relativeX: 0 - y: (root.flatten ? root.roundingY : root.wrapperHeight - root.rounding) - 1 - } - PathArc { - relativeX: root.rounding - relativeY: root.roundingY - radiusX: root.rounding - radiusY: Math.min(root.rounding, root.wrapperHeight) - direction: PathArc.Counterclockwise - } + PathArc { + relativeX: root.rounding + relativeY: -root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + direction: PathArc.Counterclockwise + } + PathLine { + relativeX: 0 + relativeY: -(root.wrapper.height - root.roundingY * 2) + } + PathArc { + relativeX: root.rounding + relativeY: -root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + } + PathLine { + relativeX: root.wrapper.width - root.rounding * 4 + relativeY: 0 + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + } + PathLine { + relativeX: 0 + relativeY: root.wrapper.height - root.roundingY * 2 + } + PathArc { + relativeX: root.rounding + relativeY: root.roundingY + radiusX: root.rounding + radiusY: Math.min(root.rounding, root.wrapper.height) + direction: PathArc.Counterclockwise + } - Behavior on fillColor { - ColorAnimation { - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standard - } + Behavior on fillColor { + ColorAnimation { + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standard } } } diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 51e59f8..be3667d 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -9,7 +9,7 @@ import QtQuick Item { id: root - required property Scope launcher + required property PersistentProperties visibilities readonly property int padding: Appearance.padding.large readonly property int rounding: Appearance.rounding.large @@ -32,7 +32,7 @@ Item { ContentList { id: list - launcher: root.launcher + visibilities: root.visibilities search: search padding: root.padding rounding: root.rounding @@ -80,12 +80,12 @@ Item { if (currentItem) { if (list.showWallpapers) { Wallpapers.setWallpaper(currentItem.modelData.path); - root.launcher.launcherVisible = false; + root.visibilities.launcher = false; } else if (text.startsWith(LauncherConfig.actionPrefix)) { currentItem.modelData.onClicked(list.currentList); } else { Apps.launch(currentItem.modelData); - root.launcher.launcherVisible = false; + root.visibilities.launcher = false; } } } @@ -93,13 +93,13 @@ Item { Keys.onUpPressed: list.currentList?.decrementCurrentIndex() Keys.onDownPressed: list.currentList?.incrementCurrentIndex() - Keys.onEscapePressed: root.launcher.launcherVisible = false + Keys.onEscapePressed: root.visibilities.launcher = false Connections { - target: root.launcher + target: root.visibilities - function onLauncherVisibleChanged(): void { - if (root.launcher.launcherVisible) + function onLauncherChanged(): void { + if (root.visibilities.launcher) search.forceActiveFocus(); else { search.text = ""; diff --git a/modules/launcher/ContentList.qml b/modules/launcher/ContentList.qml index 3cd4f3e..b15daa6 100644 --- a/modules/launcher/ContentList.qml +++ b/modules/launcher/ContentList.qml @@ -10,7 +10,7 @@ import QtQuick.Controls Item { id: root - required property Scope launcher + required property PersistentProperties visibilities required property TextField search required property int padding required property int rounding @@ -101,7 +101,7 @@ Item { sourceComponent: AppList { padding: root.padding search: root.search - launcher: root.launcher + visibilities: root.visibilities } } @@ -117,7 +117,7 @@ Item { sourceComponent: WallpaperList { search: root.search - launcher: root.launcher + visibilities: root.visibilities } } diff --git a/modules/launcher/WallpaperItem.qml b/modules/launcher/WallpaperItem.qml index 22f8eda..fd8ce9d 100644 --- a/modules/launcher/WallpaperItem.qml +++ b/modules/launcher/WallpaperItem.qml @@ -9,7 +9,7 @@ StyledRect { id: root required property Wallpapers.Wallpaper modelData - required property Scope launcher + required property PersistentProperties visibilities scale: 0.5 opacity: 0 @@ -28,7 +28,7 @@ StyledRect { function onClicked(): void { Wallpapers.setWallpaper(root.modelData.path); - root.launcher.launcherVisible = false; + root.visibilities.launcher = false; } } diff --git a/modules/launcher/WallpaperList.qml b/modules/launcher/WallpaperList.qml index b3a0fd7..9a7c552 100644 --- a/modules/launcher/WallpaperList.qml +++ b/modules/launcher/WallpaperList.qml @@ -9,7 +9,7 @@ PathView { id: root required property TextField search - required property Scope launcher + required property PersistentProperties visibilities model: ScriptModel { readonly property string search: root.search.text.split(" ").slice(1).join(" ") @@ -42,7 +42,7 @@ PathView { highlightMoveDuration: Appearance.anim.durations.short delegate: WallpaperItem { - launcher: root.launcher + visibilities: root.visibilities } path: Path { diff --git a/modules/launcher/Wrapper.qml b/modules/launcher/Wrapper.qml index 2782d1b..c997781 100644 --- a/modules/launcher/Wrapper.qml +++ b/modules/launcher/Wrapper.qml @@ -1,23 +1,22 @@ import "root:/config" +import Quickshell import QtQuick Item { id: root - required property bool launcherVisible - required property real contentHeight - property bool shouldBeVisible + required property PersistentProperties visibilities visible: height > 0 - height: 0 + implicitHeight: 0 + implicitWidth: content.width + BorderConfig.rounding * 2 states: State { name: "visible" - when: root.launcherVisible + when: root.visibilities.launcher PropertyChanges { - root.height: contentHeight - root.shouldBeVisible: true + root.implicitHeight: content.height } } @@ -26,37 +25,31 @@ Item { from: "" to: "visible" - SequentialAnimation { - PropertyAction { - target: root - property: "shouldBeVisible" - } - NumberAnimation { - target: root - property: "height" - duration: Appearance.anim.durations.large - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedDecel - } + NumberAnimation { + target: root + property: "implicitHeight" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel } }, Transition { from: "visible" to: "" - SequentialAnimation { - NumberAnimation { - target: root - property: "height" - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.emphasizedAccel - } - PropertyAction { - target: root - property: "shouldBeVisible" - } + NumberAnimation { + target: root + property: "implicitHeight" + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedAccel } } ] + + Content { + id: content + + visibilities: root.visibilities + } } |