feat: launcher keyboard nav
Using currentitem and highlight Also fix not closing launcher when clicking app Apps service use only one process
This commit is contained in:
parent
6b848b0f56
commit
587c3a7bc9
3 changed files with 20 additions and 15 deletions
|
|
@ -10,6 +10,7 @@ ListView {
|
||||||
|
|
||||||
required property int padding
|
required property int padding
|
||||||
required property string search
|
required property string search
|
||||||
|
required property Scope launcher
|
||||||
|
|
||||||
model: ScriptModel {
|
model: ScriptModel {
|
||||||
values: Apps.fuzzyQuery(root.search)
|
values: Apps.fuzzyQuery(root.search)
|
||||||
|
|
@ -26,10 +27,16 @@ ListView {
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.margins: root.padding
|
anchors.margins: root.padding
|
||||||
|
|
||||||
|
highlightMoveDuration: Appearance.anim.durations.normal
|
||||||
|
|
||||||
|
highlight: StyledRect {
|
||||||
|
radius: Appearance.rounding.normal
|
||||||
|
color: Appearance.alpha(Appearance.colours.m3surfaceContainerHighest, true)
|
||||||
|
}
|
||||||
|
|
||||||
delegate: AppItem {
|
delegate: AppItem {
|
||||||
launcher: root.launcher
|
launcher: root.launcher
|
||||||
}
|
}
|
||||||
// TODO highlight
|
|
||||||
|
|
||||||
ScrollBar.vertical: StyledScrollBar {
|
ScrollBar.vertical: StyledScrollBar {
|
||||||
// Move half out
|
// Move half out
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ Item {
|
||||||
|
|
||||||
padding: root.padding
|
padding: root.padding
|
||||||
search: search.text
|
search: search.text
|
||||||
|
launcher: root.launcher
|
||||||
}
|
}
|
||||||
|
|
||||||
EmptyIndicator {
|
EmptyIndicator {
|
||||||
|
|
@ -73,6 +74,9 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onUpPressed: list.decrementCurrentIndex()
|
||||||
|
Keys.onDownPressed: list.incrementCurrentIndex()
|
||||||
|
|
||||||
Keys.onEscapePressed: root.launcher.launcherVisible = false
|
Keys.onEscapePressed: root.launcher.launcherVisible = false
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
|
|
@ -81,8 +85,10 @@ Item {
|
||||||
function onLauncherVisibleChanged(): void {
|
function onLauncherVisibleChanged(): void {
|
||||||
if (root.launcher.launcherVisible)
|
if (root.launcher.launcherVisible)
|
||||||
search.forceActiveFocus();
|
search.forceActiveFocus();
|
||||||
else
|
else {
|
||||||
search.text = "";
|
search.text = "";
|
||||||
|
list.currentIndex = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import "root:/widgets"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
@ -24,22 +23,15 @@ Singleton {
|
||||||
}
|
}
|
||||||
|
|
||||||
function launch(entry: DesktopEntry): void {
|
function launch(entry: DesktopEntry): void {
|
||||||
launchProc.createObject(root, {
|
launchProc.entry = entry;
|
||||||
entry
|
launchProc.startDetached();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
Process {
|
||||||
id: launchProc
|
id: launchProc
|
||||||
|
|
||||||
Process {
|
property DesktopEntry entry
|
||||||
required property DesktopEntry entry
|
|
||||||
|
|
||||||
command: ["app2unit", "--", `${entry.id}.desktop`]
|
command: ["app2unit", "--", `${entry.id}.desktop`]
|
||||||
Component.onCompleted: {
|
|
||||||
startDetached();
|
|
||||||
destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue