diff --git a/app-carousel/AppButton.qml b/app-carousel/AppButton.qml index eff418d..4b6a843 100644 --- a/app-carousel/AppButton.qml +++ b/app-carousel/AppButton.qml @@ -32,6 +32,7 @@ Rectangle { height: root.theme.cardHeight anchors.fill: parent anchors.margins: root.theme.cardPadding + Image { fillMode: Image.PreserveAspectFit Layout.alignment: Qt.AlignCenter diff --git a/app-carousel/AppConfig.qml b/app-carousel/AppConfig.qml index 422bff4..08c0b3a 100644 --- a/app-carousel/AppConfig.qml +++ b/app-carousel/AppConfig.qml @@ -61,8 +61,16 @@ Item { } else { elm.dims = [100, 100]; } - testIt(Array.isArray(elm.exec) && elm.exec.length > 0, `expected exec to be a non-empty array, got ${elm.exec}`) - testIt(elm.exec.every(arg => typeof arg === 'string'), 'expected all exec entries to be strings') + const hasExec = elm.exec !== undefined + const hasDispatch = elm.hyprlandDispatch !== undefined + testIt(hasExec !== hasDispatch, 'specify exactly one of exec or hyprlandDispatch') + if (hasExec) { + testIt(Array.isArray(elm.exec) && elm.exec.length > 0, `expected exec to be a non-empty array, got ${elm.exec}`) + testIt(elm.exec.every(arg => typeof arg === 'string'), 'expected all exec entries to be strings') + } else { + isString('hyprlandDispatch', elm.hyprlandDispatch) + testIt(elm.hyprlandDispatch.length > 0, 'expected hyprlandDispatch to be a non-empty string') + } if (!elm.isIcon) elm.image = resolveImagePath(elm.image) } diff --git a/app-carousel/LauncherWindow.qml b/app-carousel/LauncherWindow.qml index 7160abb..6d0431e 100644 --- a/app-carousel/LauncherWindow.qml +++ b/app-carousel/LauncherWindow.qml @@ -2,6 +2,7 @@ import QtQuick import Quickshell import Quickshell.Wayland import Quickshell.Hyprland +import Quickshell.Io PanelWindow { id: root @@ -55,10 +56,27 @@ PanelWindow { root.requestClose(); return; } - Quickshell.execDetached(app.exec); + if (app.hyprlandDispatch) { + Hyprland.dispatch(app.hyprlandDispatch); + } else { + launcher.running = false; + launcher.command = app.exec; + launcher.running = true; + } root.requestClose(); } + Process { + id: launcher + running: false + stdout: SplitParser { + onRead: (line) => { + console.log(launcher.command) + console.log("Captured Output: " + line) + } + } + } + onVisibleChanged: { if (root.visible) { root.selectedIndex = 0; diff --git a/example.json b/example.json index 815fd58..d23e369 100644 --- a/example.json +++ b/example.json @@ -11,7 +11,7 @@ { "name": "Netflix", "image": "https://assets.nflxext.com/us/ffe/siteui/common/icons/nficon2023.ico", - "exec": ["chromium", "--app=https://www.netflix.com"] + "hyprlandDispatch": "exec chromium --app=https://www.netflix.com" }, { "name": "Settings",