clean up launcher, make it guuud

This commit is contained in:
Benjamin Palko 2025-09-07 12:52:53 -04:00
parent ea86cc575d
commit 25e313e31b

View file

@ -11,30 +11,30 @@ import Quickshell.Wayland
import Quickshell.Widgets import Quickshell.Widgets
StyledPanelWindow { StyledPanelWindow {
id: root id: window
name: "launcher" name: "launcher"
visible: Visibility.launcher visible: Visibility.launcher
onVisibleChanged: {
if (!visible) {
list.currentIndex = 0;
search.clear();
}
}
implicitWidth: rect.width implicitWidth: rect.width
implicitHeight: rect.height implicitHeight: rect.height
WlrLayershell.layer: WlrLayer.Top WlrLayershell.layer: WlrLayer.Top
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None WlrLayershell.keyboardFocus: window.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
HyprlandFocusGrab { HyprlandFocusGrab {
active: root.visible active: Visibility.launcher
windows: [search] windows: [window]
onCleared: { onCleared: {
root.reset(); Visibility.launcher = false;
} }
} }
function reset() {
Visibility.launcher = false;
list.currentIndex = 0;
search.clear();
}
WrapperItem { WrapperItem {
id: rect id: rect
@ -46,13 +46,11 @@ StyledPanelWindow {
Layout.fillWidth: true Layout.fillWidth: true
Layout.alignment: Qt.AlignTop Layout.alignment: Qt.AlignTop
margin: 4
color: Styling.theme.base200 color: Styling.theme.base200
RowLayout { RowLayout {
LucideIcon { LucideIcon {
id: icon
Layout.leftMargin: 8 Layout.leftMargin: 8
text: Styling.lucide.icons.search text: Styling.lucide.icons.search
} }
@ -63,19 +61,19 @@ StyledPanelWindow {
Layout.fillWidth: true Layout.fillWidth: true
implicitHeight: 40 implicitHeight: 40
cursorVisible: true cursorVisible: true
focus: root.visible focus: window.visible
placeholderText: "Applications" placeholderText: "Applications"
placeholderTextColor: "grey" placeholderTextColor: "grey"
Keys.onEscapePressed: event => { Keys.onEscapePressed: event => {
event.accepted = true; event.accepted = true;
root.reset(); Visibility.launcher = false;
} }
Keys.onReturnPressed: event => { Keys.onReturnPressed: event => {
event.accepted = true; event.accepted = true;
Apps.launch(list.currentItem.modelData); Apps.launch(list.currentItem.modelData);
root.reset(); Visibility.launcher = false;
} }
Keys.onUpPressed: event => { Keys.onUpPressed: event => {
event.accepted = true; event.accepted = true;