AppLauncher

This commit is contained in:
quadbyte 2025-08-20 11:01:06 -04:00
parent 524135800e
commit c0a068ddc0
3 changed files with 15 additions and 22 deletions

View file

@ -12,15 +12,12 @@ import qs.Widgets
import "../../Helpers/FuzzySort.js" as Fuzzysort import "../../Helpers/FuzzySort.js" as Fuzzysort
NLoader {
id: appLauncher
isLoaded: false
content: Component {
NPanel { NPanel {
id: appLauncherPanel id: root
panelWidth: Math.min(700 * scaling, screen?.width * 0.75)
panelHeight: Math.min(550 * scaling, screen?.height * 0.8)
panelAnchorCentered: true
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
// Import modular components // Import modular components
Calculator { Calculator {
@ -158,7 +155,7 @@ NLoader {
} else { } else {
modelData.execute() modelData.execute()
} }
appLauncherPanel.hide() root.close()
} }
} }
@ -174,14 +171,7 @@ NLoader {
} }
// Main content container // Main content container
Rectangle { panelContent: Rectangle {
anchors.centerIn: parent
width: Math.min(700 * scaling, parent.width * 0.75)
height: Math.min(550 * scaling, parent.height * 0.8)
radius: Style.radiusL * scaling
color: Color.mSurface
border.color: Color.mOutline
border.width: Style.borderS * scaling
// Subtle gradient background // Subtle gradient background
gradient: Gradient { gradient: Gradient {
@ -262,7 +252,7 @@ NLoader {
Keys.onUpPressed: selectPrev() Keys.onUpPressed: selectPrev()
Keys.onEnterPressed: activateSelected() Keys.onEnterPressed: activateSelected()
Keys.onReturnPressed: activateSelected() Keys.onReturnPressed: activateSelected()
Keys.onEscapePressed: appLauncherPanel.hide() Keys.onEscapePressed: root.close()
} }
} }
@ -453,5 +443,3 @@ NLoader {
} }
} }
} }
}
}

View file

@ -134,6 +134,10 @@ Rectangle {
function open() { function open() {
visible = true visible = true
// Register into the panel service
// so this will autoclose if we open another panel
PanelService.registerOpen(trayPanel)
} }
function close() { function close() {

View file

@ -1,4 +1,5 @@
import QtQuick import QtQuick
import Quickshell
import Quickshell.Io import Quickshell.Io
import qs.Services import qs.Services
@ -9,7 +10,7 @@ Item {
target: "settings" target: "settings"
function toggle() { function toggle() {
settingsPanel.isLoaded = !settingsPanel.isLoaded settingsPanel.toggle(Quickshell.screens[0])
} }
} }
@ -17,7 +18,7 @@ Item {
target: "notifications" target: "notifications"
function toggleHistory() { function toggleHistory() {
notificationHistoryPanel.isLoaded = !notificationHistoryPanel.isLoaded notificationHistoryPanel.toggle(Quickshell.screens[0])
} }
function toggleDoNotDisturb() {// TODO function toggleDoNotDisturb() {// TODO
@ -36,7 +37,7 @@ Item {
target: "appLauncher" target: "appLauncher"
function toggle() { function toggle() {
appLauncherPanel.isLoaded = !appLauncherPanel.isLoaded appLauncherPanel.toggle(Quickshell.screens[0])
} }
} }