diff options
Diffstat (limited to 'popups')
| -rw-r--r-- | popups/launcher/Launcher.qml | 24 | ||||
| -rw-r--r-- | popups/launcher/StandaloneLauncher.qml | 42 |
2 files changed, 60 insertions, 6 deletions
diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml index c198603..c6673b7 100644 --- a/popups/launcher/Launcher.qml +++ b/popups/launcher/Launcher.qml @@ -5,8 +5,8 @@ import QtQuick.Layouts import "components" import qs.components import qs.config +import "../.." -// TODO: currently, we're relying on the compositor to provide the animation which ig is fine, but we should use our own in the future, however it might look weird combined with the compositors's ILauncher { id: launcher @@ -16,7 +16,6 @@ ILauncher { name: "quickshell::launcher::launcher" anchors.top: true - margins.top: Launcher.topMargin aboveWindows: true exclusionMode: ExclusionMode.Ignore @@ -24,6 +23,7 @@ ILauncher { id: container property var selection: launcher.state?.selected property var mappedSelection: selection?.mapToItem(null, 0, 0) + property real openProgress: 0 onMappedSelectionChanged: { // launcher.state?.selected may be slow.. smh qt @@ -89,9 +89,15 @@ ILauncher { color: Qt.rgba(Colors.background3.r, Colors.background3.g, Colors.background3.b, Launcher.bgTransparency) radius: Launcher.borderRadius - width: Math.max(root.width, Launcher.defaultWidth) + Launcher.innerMargin + width: SharedState.centerBarWidth + (Math.max(root.width, Launcher.defaultWidth) + Launcher.innerMargin - SharedState.centerBarWidth) * openProgress height: root.height + ISpringAnimation on openProgress { + from: 0 + to: 1 + running: true + } + IRect { id: root property alias input: textInput.text @@ -132,11 +138,11 @@ ILauncher { property bool pendingUpdate: false Keys.onPressed: event => { if (event.key === Qt.Key_End || event.key === Qt.Key_Home) { - if (event.key === Qt.Key_End) { + if (event.key === Qt.Key_End) endShortcut.activated(); - } else if (event.key === Qt.Key_Home) { + else if (event.key === Qt.Key_Home) homeShortcut.activated(); - } + event.accepted = true; } } @@ -449,6 +455,12 @@ ILauncher { implicitWidth: container.width implicitHeight: container.height + ISpringAnimation on margins.top { + from: 0 + to: Launcher.topMargin + running: true + } + Connections { target: launcher?.state // launcher.state may be null diff --git a/popups/launcher/StandaloneLauncher.qml b/popups/launcher/StandaloneLauncher.qml new file mode 100644 index 0000000..e3ab641 --- /dev/null +++ b/popups/launcher/StandaloneLauncher.qml @@ -0,0 +1,42 @@ +import Quickshell +import QtQuick + +import "components" + +LazyLoader { + id: root + + required property string componentName + + // TODO: just use the same selectionState + property QtObject selectionState: QtObject { + property Item selected: null + property string input: "" + property int cursorPosition: 0 + property var priorities: [] + property int selectedPriority: 0 + property var widgets: [] + } + + readonly property list<Component> widgets: [ + Component { + Loader { + sourceComponent: Qt.createComponent(`components/${root.componentName}.qml`) + onLoaded: { + item.standalone = true; + item.state = selectionState; + item.priority = true; + item.close.connect(() => root.active = false); + } + } + } + ] + + active: true + component: Launcher { + name: "quickshell::launcher::${component}" + widgetItems: widgets + state: selectionState + parentLoader: root + } +} |
