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
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
}
}

View file

@ -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
}
}

View file

@ -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
}
}

View file

@ -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;
}
}

View file

@ -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
}
}

View file

@ -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
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
}
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
}
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
}
}
}

View file

@ -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 = "";

View file

@ -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
}
}

View file

@ -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;
}
}

View file

@ -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 {

View file

@ -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
}
}

View file

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