diff --git a/Modules/IPC/IPCManager.qml b/Modules/IPC/IPCManager.qml index 93a1add..bcd1e3e 100644 --- a/Modules/IPC/IPCManager.qml +++ b/Modules/IPC/IPCManager.qml @@ -5,58 +5,75 @@ import qs.Services Item { id: root - + IpcHandler { target: "settings" - function toggle() { settingsPanel.toggle(Quickshell.screens[0]) } } - + IpcHandler { target: "notifications" - function toggleHistory() { notificationHistoryPanel.toggle(Quickshell.screens[0]) } - - function toggleDoNotDisturb() {// TODO + function toggleDoNotDisturb() { + // TODO } } - + IpcHandler { target: "idleInhibitor" - function toggle() { return IdleInhibitorService.manualToggle() } } - + IpcHandler { target: "appLauncher" - function toggle() { launcherPanel.toggle(Quickshell.screens[0]) } - function clipboard() { launcherPanel.toggle(Quickshell.screens[0]) - launcherPanel.searchText = ">clip " + // Use the setSearchText function to set clipboard mode + Qt.callLater(() => { + launcherPanel.setSearchText(">clip ") + }) + } + function calculator() { + launcherPanel.toggle(Quickshell.screens[0]) + // Use the setSearchText function to set calculator mode + Qt.callLater(() => { + launcherPanel.setSearchText(">calc ") + }) } } - + IpcHandler { target: "launcher" - function toggle() { launcherPanel.toggle(Quickshell.screens[0]) } + function clipboard() { + launcherPanel.toggle(Quickshell.screens[0]) + // Use the setSearchText function to set clipboard mode + Qt.callLater(() => { + launcherPanel.setSearchText(">clip ") + }) + } + function calculator() { + launcherPanel.toggle(Quickshell.screens[0]) + // Use the setSearchText function to set calculator mode + Qt.callLater(() => { + launcherPanel.setSearchText(">calc ") + }) + } } - + IpcHandler { target: "lockScreen" - function toggle() { // Only lock if not already locked (prevents the red screen issue) // Note: No unlock via IPC for security reasons @@ -65,26 +82,21 @@ Item { } } } - + IpcHandler { target: "brightness" - function increase() { BrightnessService.increaseBrightness() } - function decrease() { BrightnessService.decreaseBrightness() } } - + IpcHandler { target: "powerPanel" - function toggle() { powerPanel.toggle(Quickshell.screens[0]) } } - - -} +} \ No newline at end of file diff --git a/Modules/Launcher/Launcher.qml b/Modules/Launcher/Launcher.qml index 4679200..f90963c 100644 --- a/Modules/Launcher/Launcher.qml +++ b/Modules/Launcher/Launcher.qml @@ -24,10 +24,28 @@ NPanel { panelAnchorLeft: launcherPosition !== "center" && (launcherPosition.endsWith("_left")) panelAnchorRight: launcherPosition !== "center" && (launcherPosition.endsWith("_right")) + // Properties + property string searchText: "" + + // Add function to set search text programmatically + function setSearchText(text) { + searchText = text + if (searchInput) { + searchInput.text = text + searchInput.cursorPosition = text.length + searchInput.forceActiveFocus() + } + } + onOpened: { // Reset state when panel opens to avoid sticky modes - searchText = "" - selectedIndex = 0 + if (searchText === "") { + searchText = "" + selectedIndex = 0 + } + if (searchInput) { + searchInput.forceActiveFocus() + } } // Import modular components @@ -50,7 +68,6 @@ NPanel { // Properties property var desktopEntries: DesktopEntries.applications.values - property string searchText: "" property int selectedIndex: 0 // Refresh clipboard when user starts typing clipboard commands @@ -141,15 +158,11 @@ NPanel { // Command execution functions function executeCalcCommand() { - searchText = ">calc " - searchInput.text = searchText - searchInput.cursorPosition = searchText.length + setSearchText(">calc ") } function executeClipCommand() { - searchText = ">clip " - searchInput.text = searchText - searchInput.cursorPosition = searchText.length + setSearchText(">clip ") } // Navigation functions @@ -252,8 +265,12 @@ NPanel { anchors.leftMargin: Style.marginS * scaling anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter + text: searchText onTextChanged: { - searchText = text + // Update the parent searchText property + if (searchText !== text) { + searchText = text + } // Defer selectedIndex reset to avoid binding loops Qt.callLater(() => selectedIndex = 0) } @@ -504,4 +521,4 @@ NPanel { } } } -} +} \ No newline at end of file diff --git a/README.md b/README.md index 7895371..019fcf0 100644 --- a/README.md +++ b/README.md @@ -101,10 +101,13 @@ mkdir -p ~/.config/quickshell && curl -sL https://github.com/noctalia-dev/noctal qs # Launcher -qs ipc call appLauncher toggle +qs ipc call launcher toggle # Clipboard History -qs ipc call appLauncher clipboard +qs ipc call launcher clipboard + +# Calculator +qs ipc call launcher calculator # Brightness qs ipc call brightness increase