summaryrefslogtreecommitdiff
path: root/popups/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'popups/launcher')
-rw-r--r--popups/launcher/Launcher.qml44
-rw-r--r--popups/launcher/components/App.qml2
-rw-r--r--popups/launcher/components/Clip.qml6
-rw-r--r--popups/launcher/components/Emoji.qml4
-rw-r--r--popups/launcher/components/IComponent.qml20
-rw-r--r--popups/launcher/components/SelectionState.qml12
-rw-r--r--popups/launcher/components/Spell.qml2
7 files changed, 49 insertions, 41 deletions
diff --git a/popups/launcher/Launcher.qml b/popups/launcher/Launcher.qml
index f59722c..fdc14c6 100644
--- a/popups/launcher/Launcher.qml
+++ b/popups/launcher/Launcher.qml
@@ -15,15 +15,6 @@ ILauncher {
name: "quickshell::launcher::launcher"
- Connections {
- target: parentLoader
- function onActiveChanged() {
- if (!parentLoader.active && launcher.state) {
- launcher.state.selected = null;
- }
- }
- }
-
anchors.top: true
margins.top: Launcher.topMargin
aboveWindows: true
@@ -65,16 +56,31 @@ ILauncher {
radius: Launcher.borderRadius
color: Qt.rgba(Colors.background1.r, Colors.background1.g, Colors.background1.b, Launcher.bgTransparency)
Behavior on x {
- ISpringAnimation {}
+ ISpringAnimation {
+ id: springAnim
+ speed: 1.5
+ }
}
Behavior on y {
- ISpringAnimation {}
+ ISpringAnimation {
+ speed: 1.5
+ }
}
Behavior on implicitWidth {
- ISpringAnimation {}
+ NumberAnimation {
+ duration: springAnim.duration
+ easing.type: Easing.BezierSpline
+ // fast slow
+ easing.bezierCurve: [0.33, 0.8, 0, 1]
+ }
}
- Behavior on height {
- ISpringAnimation {}
+ Behavior on implicitHeight {
+ NumberAnimation {
+ duration: springAnim.duration
+ easing.type: Easing.BezierSpline
+ // fast slow
+ easing.bezierCurve: [0.33, 0.8, 0, 1]
+ }
}
}
color: Qt.rgba(Colors.background3.r, Colors.background3.g, Colors.background3.b, Launcher.bgTransparency)
@@ -375,7 +381,7 @@ ILauncher {
// 2 = up
// -2 = down
function changePos(direction: int) {
- const item = launcher.state?.priorities[launcher.state.selectedPriority] || null;
+ const item = launcher.state?.priorities[launcher.state.selectedPriority];
if (!item)
return;
@@ -418,12 +424,16 @@ ILauncher {
switch (set) {
case 1:
- if (launcher.state.selectedPriority < launcher.state.priorities.length - 1)
+ if (launcher.state.selectedPriority < launcher.state.priorities.length - 1) {
launcher.state.selectedPriority++;
+ launcher.state.priorities[launcher.state.selectedPriority].home();
+ }
break;
case -1:
- if (launcher.state.selectedPriority > 0)
+ if (launcher.state.selectedPriority > 0) {
launcher.state.selectedPriority--;
+ launcher.state.priorities[launcher.state.selectedPriority].end();
+ }
break;
}
}
diff --git a/popups/launcher/components/App.qml b/popups/launcher/components/App.qml
index a6616c4..964211d 100644
--- a/popups/launcher/components/App.qml
+++ b/popups/launcher/components/App.qml
@@ -111,7 +111,7 @@ IComponent {
if (selectedIndex < 0 || selectedIndex >= listView.count || !root.visible)
return;
- state.selectedPriority = root.getSelfPriority();
+ trySetSelfPriority();
state.selected = listView.itemAtIndex(selectedIndex);
});
}
diff --git a/popups/launcher/components/Clip.qml b/popups/launcher/components/Clip.qml
index 2552b60..ebcc8c4 100644
--- a/popups/launcher/components/Clip.qml
+++ b/popups/launcher/components/Clip.qml
@@ -65,11 +65,11 @@ IComponent {
}
onSelectedIndexChanged: {
- if (selectedIndex >= 0 && selectedIndex < listView.count) {
+ if (selectedIndex >= 0 && selectedIndex < listView.count)
Qt.callLater(() => {
listView.positionViewAtIndex(selectedIndex, ListView.Contain);
});
- }
+
syncSelectionState();
}
@@ -78,7 +78,7 @@ IComponent {
if (!root.visible || selectedIndex < 0 || selectedIndex >= listView.count)
return;
- state.selectedPriority = root.getSelfPriority();
+ trySetSelfPriority();
state.selected = listView.itemAtIndex(selectedIndex);
});
}
diff --git a/popups/launcher/components/Emoji.qml b/popups/launcher/components/Emoji.qml
index 62412d7..36aacb0 100644
--- a/popups/launcher/components/Emoji.qml
+++ b/popups/launcher/components/Emoji.qml
@@ -95,7 +95,7 @@ IComponent {
if (!loader.view || selectedIndex < 0 || selectedIndex >= loader.view.count || !root.visible)
return;
- state.selectedPriority = root.getSelfPriority();
+ trySetSelfPriority();
state.selected = loader.view.itemAtIndex(selectedIndex);
});
}
@@ -134,7 +134,7 @@ IComponent {
required property int index
width: grid.cellWidth
height: chipContent.implicitHeight + Launcher.innerMargin * 2
- scale: index === selectedIndex ? 1.03 : 0.97
+ scale: index === root.selectedIndex ? 1.03 : 0.97
IRect {
anchors.fill: parent
diff --git a/popups/launcher/components/IComponent.qml b/popups/launcher/components/IComponent.qml
index 4333998..e06ed98 100644
--- a/popups/launcher/components/IComponent.qml
+++ b/popups/launcher/components/IComponent.qml
@@ -64,6 +64,13 @@ IRect {
return state.priorities.indexOf(root);
}
+ function trySetSelfPriority() {
+ let self = getSelfPriority();
+ // ??? why tf is it -1 not null or undefined this is why rust is better
+ if (self !== -1)
+ state.selectedPriority = self;
+ }
+
// this doesn't change launcher size but only hides the actual content but the outside still think the content is there
visible: active
opacity: valid ? 1 : 0
@@ -98,13 +105,14 @@ IRect {
HoverHandler {
onHoveredChanged: {
if (hovered)
- root.state.selectedPriority = root.getSelfPriority();
+ root.trySetSelfPriority();
}
}
- Component.onCompleted: {
- Qt.callLater(() => {
- syncSelectionState();
- });
- }
+ // causes all of them fighting for selection state
+ // Component.onCompleted: {
+ // Qt.callLater(() => {
+ // syncSelectionState();
+ // });
+ // }
}
diff --git a/popups/launcher/components/SelectionState.qml b/popups/launcher/components/SelectionState.qml
index d999baa..4231234 100644
--- a/popups/launcher/components/SelectionState.qml
+++ b/popups/launcher/components/SelectionState.qml
@@ -27,17 +27,7 @@ Singleton {
signal syncSelectionState
onSelectedPriorityChanged: {
- // so it won't mess w/ if we changed it via mouse
- if (Math.abs(selectedPriority - previousSelectedPriority) == 1) {
- if (selectedPriority > previousSelectedPriority) {
- priorities[selectedPriority].home();
- } else {
- priorities[selectedPriority].end();
- }
- }
- priorities[selectedPriority].syncSelectionState();
-
- previousSelectedPriority = selectedPriority;
+ priorities[selectedPriority]?.syncSelectionState();
}
// order them based on widgets(which came from order from config)
diff --git a/popups/launcher/components/Spell.qml b/popups/launcher/components/Spell.qml
index 5bb128d..5e62ae8 100644
--- a/popups/launcher/components/Spell.qml
+++ b/popups/launcher/components/Spell.qml
@@ -118,7 +118,7 @@ IComponent {
if (!loader.view || selectedIndex < 0 || selectedIndex >= loader.view.count || !root.visible)
return;
- state.selectedPriority = root.getSelfPriority();
+ trySetSelfPriority();
state.selected = loader.view.itemAtIndex(selectedIndex);
});
}