launcher: move to drawers

This commit is contained in:
2 * r + 2 * t 2025-05-13 23:12:23 +08:00
parent ea4aedd625
commit f8eb1b69a0
12 changed files with 134 additions and 110 deletions

View file

@ -3,6 +3,10 @@ import "root:/services"
import Quickshell import Quickshell
Scope { Scope {
id: root
property bool launcherInterrupted
CustomShortcut { CustomShortcut {
name: "session" name: "session"
description: "Toggle session menu" description: "Toggle session menu"
@ -11,4 +15,23 @@ Scope {
visibilities.session = !visibilities.session; 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
}
} }

View file

@ -3,8 +3,7 @@ import "root:/config"
import "root:/modules/osd" as Osd import "root:/modules/osd" as Osd
import "root:/modules/notifications" as Notifications import "root:/modules/notifications" as Notifications
import "root:/modules/session" as Session import "root:/modules/session" as Session
import Quickshell import "root:/modules/launcher" as Launcher
import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
Shape { Shape {
@ -37,4 +36,11 @@ Shape {
startX: root.width startX: root.width
startY: (root.height - wrapper.height) / 2 startY: (root.height - wrapper.height) / 2
} }
Launcher.Background {
wrapper: panels.launcher
startX: (root.width - wrapper.width) / 2
startY: root.height
}
} }

View file

@ -2,6 +2,7 @@ import "root:/config"
import "root:/modules/osd" as Osd import "root:/modules/osd" as Osd
import "root:/modules/notifications" as Notifications import "root:/modules/notifications" as Notifications
import "root:/modules/session" as Session import "root:/modules/session" as Session
import "root:/modules/launcher" as Launcher
import Quickshell import Quickshell
import QtQuick import QtQuick
@ -14,6 +15,7 @@ Item {
readonly property Osd.Wrapper osd: osd readonly property Osd.Wrapper osd: osd
readonly property Notifications.Wrapper notifications: notifications readonly property Notifications.Wrapper notifications: notifications
readonly property Session.Wrapper session: session readonly property Session.Wrapper session: session
readonly property Launcher.Wrapper launcher: launcher
anchors.fill: parent anchors.fill: parent
anchors.margins: BorderConfig.thickness anchors.margins: BorderConfig.thickness
@ -47,4 +49,13 @@ Item {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
} }
Launcher.Wrapper {
id: launcher
visibilities: root.visibilities
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
}
} }

View file

@ -9,7 +9,7 @@ PaddedRect {
id: root id: root
required property DesktopEntry modelData required property DesktopEntry modelData
required property Scope launcher required property PersistentProperties visibilities
implicitHeight: LauncherConfig.sizes.itemHeight implicitHeight: LauncherConfig.sizes.itemHeight
padding: [Appearance.padding.smaller, Appearance.padding.normal] padding: [Appearance.padding.smaller, Appearance.padding.normal]
@ -22,7 +22,7 @@ PaddedRect {
function onClicked(): void { function onClicked(): void {
Apps.launch(root.modelData); Apps.launch(root.modelData);
root.launcher.launcherVisible = false; root.visibilities.launcher = false;
} }
} }

View file

@ -12,7 +12,7 @@ ListView {
required property int padding required property int padding
required property TextField search required property TextField search
required property Scope launcher required property PersistentProperties visibilities
property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix) property bool isAction: search.text.startsWith(LauncherConfig.actionPrefix)
@ -98,7 +98,7 @@ ListView {
id: appItem id: appItem
AppItem { AppItem {
launcher: root.launcher visibilities: root.visibilities
} }
} }

View file

@ -3,59 +3,53 @@ import "root:/config"
import QtQuick import QtQuick
import QtQuick.Shapes import QtQuick.Shapes
Shape { ShapePath {
id: root id: root
required property real wrapperWidth required property Wrapper wrapper
required property real wrapperHeight
readonly property real rounding: BorderConfig.rounding readonly property real rounding: BorderConfig.rounding
readonly property bool flatten: wrapperHeight < rounding * 2 readonly property bool flatten: wrapper.height < rounding * 2
readonly property real roundingY: flatten ? wrapperHeight / 2 : rounding readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
preferredRendererType: Shape.CurveRenderer
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
ShapePath {
strokeWidth: -1 strokeWidth: -1
fillColor: BorderConfig.colour fillColor: BorderConfig.colour
startY: root.wrapperHeight - 1
PathArc { PathArc {
relativeX: root.rounding relativeX: root.rounding
relativeY: -root.roundingY relativeY: -root.roundingY
radiusX: root.rounding radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapperHeight) radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise direction: PathArc.Counterclockwise
} }
PathLine { PathLine {
relativeX: 0 relativeX: 0
y: root.roundingY relativeY: -(root.wrapper.height - root.roundingY * 2)
} }
PathArc { PathArc {
relativeX: root.rounding relativeX: root.rounding
relativeY: -root.roundingY relativeY: -root.roundingY
radiusX: root.rounding radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapperHeight) radiusY: Math.min(root.rounding, root.wrapper.height)
} }
PathLine { PathLine {
x: root.wrapperWidth - root.rounding * 2 relativeX: root.wrapper.width - root.rounding * 4
relativeY: 0
} }
PathArc { PathArc {
relativeX: root.rounding relativeX: root.rounding
relativeY: root.roundingY relativeY: root.roundingY
radiusX: root.rounding radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapperHeight) radiusY: Math.min(root.rounding, root.wrapper.height)
} }
PathLine { PathLine {
relativeX: 0 relativeX: 0
y: (root.flatten ? root.roundingY : root.wrapperHeight - root.rounding) - 1 relativeY: root.wrapper.height - root.roundingY * 2
} }
PathArc { PathArc {
relativeX: root.rounding relativeX: root.rounding
relativeY: root.roundingY relativeY: root.roundingY
radiusX: root.rounding radiusX: root.rounding
radiusY: Math.min(root.rounding, root.wrapperHeight) radiusY: Math.min(root.rounding, root.wrapper.height)
direction: PathArc.Counterclockwise direction: PathArc.Counterclockwise
} }
@ -66,5 +60,4 @@ Shape {
easing.bezierCurve: Appearance.anim.curves.standard easing.bezierCurve: Appearance.anim.curves.standard
} }
} }
}
} }

View file

@ -9,7 +9,7 @@ import QtQuick
Item { Item {
id: root id: root
required property Scope launcher required property PersistentProperties visibilities
readonly property int padding: Appearance.padding.large readonly property int padding: Appearance.padding.large
readonly property int rounding: Appearance.rounding.large readonly property int rounding: Appearance.rounding.large
@ -32,7 +32,7 @@ Item {
ContentList { ContentList {
id: list id: list
launcher: root.launcher visibilities: root.visibilities
search: search search: search
padding: root.padding padding: root.padding
rounding: root.rounding rounding: root.rounding
@ -80,12 +80,12 @@ Item {
if (currentItem) { if (currentItem) {
if (list.showWallpapers) { if (list.showWallpapers) {
Wallpapers.setWallpaper(currentItem.modelData.path); Wallpapers.setWallpaper(currentItem.modelData.path);
root.launcher.launcherVisible = false; root.visibilities.launcher = false;
} else if (text.startsWith(LauncherConfig.actionPrefix)) { } else if (text.startsWith(LauncherConfig.actionPrefix)) {
currentItem.modelData.onClicked(list.currentList); currentItem.modelData.onClicked(list.currentList);
} else { } else {
Apps.launch(currentItem.modelData); Apps.launch(currentItem.modelData);
root.launcher.launcherVisible = false; root.visibilities.launcher = false;
} }
} }
} }
@ -93,13 +93,13 @@ Item {
Keys.onUpPressed: list.currentList?.decrementCurrentIndex() Keys.onUpPressed: list.currentList?.decrementCurrentIndex()
Keys.onDownPressed: list.currentList?.incrementCurrentIndex() Keys.onDownPressed: list.currentList?.incrementCurrentIndex()
Keys.onEscapePressed: root.launcher.launcherVisible = false Keys.onEscapePressed: root.visibilities.launcher = false
Connections { Connections {
target: root.launcher target: root.visibilities
function onLauncherVisibleChanged(): void { function onLauncherChanged(): void {
if (root.launcher.launcherVisible) if (root.visibilities.launcher)
search.forceActiveFocus(); search.forceActiveFocus();
else { else {
search.text = ""; search.text = "";

View file

@ -10,7 +10,7 @@ import QtQuick.Controls
Item { Item {
id: root id: root
required property Scope launcher required property PersistentProperties visibilities
required property TextField search required property TextField search
required property int padding required property int padding
required property int rounding required property int rounding
@ -101,7 +101,7 @@ Item {
sourceComponent: AppList { sourceComponent: AppList {
padding: root.padding padding: root.padding
search: root.search search: root.search
launcher: root.launcher visibilities: root.visibilities
} }
} }
@ -117,7 +117,7 @@ Item {
sourceComponent: WallpaperList { sourceComponent: WallpaperList {
search: root.search search: root.search
launcher: root.launcher visibilities: root.visibilities
} }
} }

View file

@ -9,7 +9,7 @@ StyledRect {
id: root id: root
required property Wallpapers.Wallpaper modelData required property Wallpapers.Wallpaper modelData
required property Scope launcher required property PersistentProperties visibilities
scale: 0.5 scale: 0.5
opacity: 0 opacity: 0
@ -28,7 +28,7 @@ StyledRect {
function onClicked(): void { function onClicked(): void {
Wallpapers.setWallpaper(root.modelData.path); Wallpapers.setWallpaper(root.modelData.path);
root.launcher.launcherVisible = false; root.visibilities.launcher = false;
} }
} }

View file

@ -9,7 +9,7 @@ PathView {
id: root id: root
required property TextField search required property TextField search
required property Scope launcher required property PersistentProperties visibilities
model: ScriptModel { model: ScriptModel {
readonly property string search: root.search.text.split(" ").slice(1).join(" ") readonly property string search: root.search.text.split(" ").slice(1).join(" ")
@ -42,7 +42,7 @@ PathView {
highlightMoveDuration: Appearance.anim.durations.short highlightMoveDuration: Appearance.anim.durations.short
delegate: WallpaperItem { delegate: WallpaperItem {
launcher: root.launcher visibilities: root.visibilities
} }
path: Path { path: Path {

View file

@ -1,23 +1,22 @@
import "root:/config" import "root:/config"
import Quickshell
import QtQuick import QtQuick
Item { Item {
id: root id: root
required property bool launcherVisible required property PersistentProperties visibilities
required property real contentHeight
property bool shouldBeVisible
visible: height > 0 visible: height > 0
height: 0 implicitHeight: 0
implicitWidth: content.width + BorderConfig.rounding * 2
states: State { states: State {
name: "visible" name: "visible"
when: root.launcherVisible when: root.visibilities.launcher
PropertyChanges { PropertyChanges {
root.height: contentHeight root.implicitHeight: content.height
root.shouldBeVisible: true
} }
} }
@ -26,37 +25,31 @@ Item {
from: "" from: ""
to: "visible" to: "visible"
SequentialAnimation {
PropertyAction {
target: root
property: "shouldBeVisible"
}
NumberAnimation { NumberAnimation {
target: root target: root
property: "height" property: "implicitHeight"
duration: Appearance.anim.durations.large duration: Appearance.anim.durations.large
easing.type: Easing.BezierSpline easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
} }
}
}, },
Transition { Transition {
from: "visible" from: "visible"
to: "" to: ""
SequentialAnimation {
NumberAnimation { NumberAnimation {
target: root target: root
property: "height" property: "implicitHeight"
duration: Appearance.anim.durations.normal duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
} }
PropertyAction {
target: root
property: "shouldBeVisible"
}
}
} }
] ]
Content {
id: content
visibilities: root.visibilities
}
} }

View file

@ -1,13 +1,11 @@
import "modules" import "modules"
import "modules/bar" import "modules/bar"
import "modules/launcher"
import "modules/drawers" import "modules/drawers"
import "modules/background" import "modules/background"
import Quickshell import Quickshell
ShellRoot { ShellRoot {
Bar {} Bar {}
Launcher {}
Background {} Background {}
Drawers {} Drawers {}