summaryrefslogtreecommitdiff
path: root/popups/launcher/components
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-08-23 11:59:36 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-08-23 11:59:59 +0800
commit04d4670f933431f5deaad4b2045baeccc2a4494e (patch)
tree0b3a065a7391c6df5a39e2c0bbd3324674743556 /popups/launcher/components
parenta41ab9ad95b4f8e053af82741a45f747e77ff37a (diff)
fix: don't set priority to -1 when indexOf returns that
Diffstat (limited to 'popups/launcher/components')
-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
6 files changed, 22 insertions, 24 deletions
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);
});
}