dispatch qts
This commit is contained in:
1 parent
9472f380be
commit
70a6437c7f
4 files changed
+31
-4
No files matched your search
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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",
|
||||
|
||||
Reference in new issue
Block a user