diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-03-25 14:38:09 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-03-25 14:38:09 +0530 |
| commit | 8524efe76a7c0945c6c9e7113eb740817e9eb2cd (patch) | |
| tree | 07c7062453f6f61a83596257e99f423acc63283b | |
| parent | 6a01fd8aa95b403795a787588f45fb24d2bb931f (diff) | |
search bar in app launcher
| -rw-r--r-- | flake.nix | 2 | ||||
| -rwxr-xr-x | hypr/battery-notif.sh | 4 | ||||
| -rw-r--r-- | nixos/environment.nix | 1 | ||||
| -rw-r--r-- | nixos/languages/javascript.nix | 4 | ||||
| -rw-r--r-- | quickshell/AppLauncher.qml | 89 |
5 files changed, 66 insertions, 34 deletions
@@ -44,7 +44,7 @@ lua = true; python = true; - go = false; + go = true; beam = false; javascript = false; rust = false; diff --git a/hypr/battery-notif.sh b/hypr/battery-notif.sh index 40f7db3..e64442a 100755 --- a/hypr/battery-notif.sh +++ b/hypr/battery-notif.sh @@ -5,9 +5,9 @@ while true; do if [[ "$status" = "Discharging" ]]; then battery=$(cat /sys/class/power_supply/BAT1/capacity) if [[ battery -lt 16 ]]; then - notify-send -u critical "Very Low Battery" -i ~/.config/hypr/battery/battery_critical.png + notify-send -u critical "Very Low Battery" -i ~/.config/hypr/battery/battery_critical.png -t 5000 elif [[ battery -lt 31 ]]; then - notify-send -u normal "Low Battery" -i ~/.config/hypr/battery/battery_low.png + notify-send -u normal "Low Battery" -i ~/.config/hypr/battery/battery_low.png -t 5000 fi fi pid=$! diff --git a/nixos/environment.nix b/nixos/environment.nix index a185bca..196a5a0 100644 --- a/nixos/environment.nix +++ b/nixos/environment.nix @@ -1,5 +1,6 @@ { config, pkgs, ... }: { + programs.nix-ld.enable = true; environment.systemPackages = with pkgs; [ man-pages-posix fastfetch diff --git a/nixos/languages/javascript.nix b/nixos/languages/javascript.nix index ead71db..88616ff 100644 --- a/nixos/languages/javascript.nix +++ b/nixos/languages/javascript.nix @@ -1,7 +1,9 @@ { config, pkgs, ... }: { environment.systemPackages = with pkgs; [ - nodejs_20 + nodejs_24 + pnpm + bun typescript-language-server javascript-typescript-langserver ]; diff --git a/quickshell/AppLauncher.qml b/quickshell/AppLauncher.qml index 91deb1e..5feab81 100644 --- a/quickshell/AppLauncher.qml +++ b/quickshell/AppLauncher.qml @@ -13,23 +13,23 @@ Rectangle { property bool isVisible: false property int hoverIndex: 0 - property bool cleared: true + property var apps: [] signal requestClose() focus: true Keys.onEscapePressed: requestClose() - + Keys.onUpPressed: { - hoverIndex-- - if (hoverIndex < 0) hoverIndex += appListModel.count - listView.positionViewAtIndex(hoverIndex, ListView.Contain) + hoverIndex--; + if (hoverIndex < 0) hoverIndex += appListModel.count; + listView.positionViewAtIndex(hoverIndex, ListView.Contain); } Keys.onDownPressed: { - hoverIndex = (hoverIndex + 1) % appListModel.count - listView.positionViewAtIndex(hoverIndex, ListView.Contain) + hoverIndex = (hoverIndex + 1) % appListModel.count; + listView.positionViewAtIndex(hoverIndex, ListView.Contain); } Keys.onReturnPressed: { @@ -46,9 +46,9 @@ Rectangle { onIsVisibleChanged: { if (!isVisible) return; - hoverIndex = -1 - appLauncher.forceActiveFocus() - loadApps() + hoverIndex = 0; + appLauncher.forceActiveFocus(); + searchInput.forceActiveFocus(); } Process { @@ -58,40 +58,45 @@ Rectangle { stdout: SplitParser { onRead: data => { - if (!cleared) { - appListModel.clear() - cleared = true; - } - - const lines = data.split('\n') + const lines = data.split('\n'); for (const line of lines) { - if (line.trim().length === 0) continue + if (line.trim().length === 0) continue; - const parts = line.split('|') + const parts = line.split('|'); if (parts.length < 4) continue; - appListModel.append({ + apps.push({ appName: parts[0], appDescription: parts[1], appIcon: parts[2], appCommand: parts[3] - }) + }); } + + applySearch(""); } } onRunningChanged: { if (running) return; - appLoader.running = false + appLoader.running = false; } } function loadApps() { - cleared = false; - appLoader.running = true + appLoader.running = true; + } + + function applySearch(searchString) { + appListModel.clear(); + for (const app of apps) { + if (app.appName.toLowerCase().includes(searchString.toLowerCase())) { + appListModel.append(app); + } + } } Component.onCompleted: { - loadApps() + loadApps(); } Column { @@ -139,11 +144,35 @@ Rectangle { } } } + + Rectangle { + width: parent.width + height: 36 + color: shellRoot.black + border.color: shellRoot.green + border.width: 1 + + TextInput { + id: searchInput + width: parent.width + anchors.left: parent.left + anchors.right: parent.right + anchors.leftMargin: 8 + anchors.rightMargin: 8 + anchors.verticalCenter: parent.verticalCenter + color: "white" + font.pixelSize: 14 + onTextEdited: { + applySearch(searchInput.text); + hoverIndex = 0; + } + } + } ListView { id: listView width: parent.width - height: parent.height - 44 + height: parent.height - 88 spacing: 8 clip: true @@ -155,8 +184,8 @@ Rectangle { width: listView.width height: 30 color: { - if (appLauncher.hoverIndex === index) return shellRoot.lightgray - return shellRoot.gray + if (appLauncher.hoverIndex === index) return shellRoot.lightgray; + return shellRoot.gray; } Row { @@ -182,17 +211,17 @@ Rectangle { } MouseArea { - id:ouseArea + id: mouseArea anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onEntered: { - appLauncher.hoverIndex = index + appLauncher.hoverIndex = index; } onClicked: { - launchApp(model.appCommand) + launchApp(model.appCommand); } } } |
