quickshell-web/modules/Quickshell.Io/Process.json
2024-09-28 02:35:19 +03:00

174 lines
7.2 KiB
JSON

{
"name": "Process",
"module": "Quickshell.Io",
"type": "class",
"super": {
"type": "qt",
"module": "qml.QtQml",
"name": "QtObject"
},
"description": "Child process.",
"details": "#### Example\n```qml\nProcess {\n running: true\n command: [ \"some-command\", \"arg\" ]\n stdout: SplitParser {\n onRead: data => console.log(`line read: ${data}`)\n }\n}\n```\n",
"properties": {
"workingDirectory": {
"type": {
"type": "qt",
"module": "qml",
"name": "string"
},
"details": "The working directory of the process. Defaults to [quickshell's working directory].\n\nIf the process is already running changing this property will affect the next\nstarted process. If the property has been changed after starting a process it will\nreturn the new value, not the one for the currently running process.\n\n[quickshell's working directory]: ../../quickshell/quickshell#prop.workingDirectory\n"
},
"command": {
"type": {
"type": "qt",
"module": "qml",
"name": "list",
"of": {
"type": "qt",
"module": "qml",
"name": "string"
}
},
"details": "The command to execute. Each argument is its own string, which means you don't have\nto deal with quoting anything.\n\nIf the process is already running changing this property will affect the next\nstarted process. If the property has been changed after starting a process it will\nreturn the new value, not the one for the currently running process.\n\n> [!NOTE] You can use `[\"sh\", \"-c\", <your command>]` to execute your command with\n> the system shell.\n"
},
"manageLifetime": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If the process should be killed when the Process object is destroyed or quickshell exits.\nDefaults to true.\n\nThis property may be changed while the process is running and will affect it.\n\n> [!WARNING] If set to false the process will still be killed if the quickshell config reloads.\n> It will not be killed if quickshell exits normally or crashes.\n"
},
"environment": {
"type": {
"type": "unknown",
"module": "",
"name": ""
},
"details": "Environment of the executed process.\n\nThis is a javascript object (json). Environment variables can be added by setting\nthem to a string and removed by setting them to null (except when TYPE99VclearEnvironment99Tprop99TYPE is true,\nin which case this behavior is inverted, see TYPE99VclearEnvironment99Tprop99TYPE for details).\n\n\n```qml\nenvironment: ({\n ADDED: \"value\",\n REMOVED: null,\n \"i'm different\": \"value\",\n})\n```\n\n> [!NOTE] You need to wrap the returned object in () otherwise it won't parse due to javascript ambiguity.\n\nIf the process is already running changing this property will affect the next\nstarted process. If the property has been changed after starting a process it will\nreturn the new value, not the one for the currently running process.\n"
},
"stdinEnabled": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If stdin is enabled. Defaults to false. If this property is false the process's stdin channel\nwill be closed and TYPE99Vwrite99Tfunc99TYPE will do nothing, even if set back to true.\n"
},
"processId": {
"type": {
"type": "qt",
"module": "qml",
"name": "variant"
},
"details": "The process ID of the running process or `null` if TYPE99Vrunning99Tprop99TYPE is false.\n",
"flags": [
"readonly"
]
},
"clearEnvironment": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If the process's environment should be cleared prior to applying TYPE99Venvironment99Tprop99TYPE.\nDefaults to false.\n\nIf true, all environment variables will be removed before the TYPE99Venvironment99Tprop99TYPE\nobject is applied, meaning the variables listed will be the only ones visible to the process.\nThis changes the behavior of `null` to pass in the system value of the variable if present instead\nof removing it.\n\n```qml\nclearEnvironment: true\nenvironment: ({\n ADDED: \"value\",\n PASSED_FROM_SYSTEM: null,\n})\n```\n\nIf the process is already running changing this property will affect the next\nstarted process. If the property has been changed after starting a process it will\nreturn the new value, not the one for the currently running process.\n"
},
"stdout": {
"type": {
"type": "local",
"module": "Quickshell.Io",
"name": "DataStreamParser"
},
"details": "The parser for stdout. If the parser is null the process's stdout channel will be closed\nand no further data will be read, even if a new parser is attached.\n"
},
"stderr": {
"type": {
"type": "local",
"module": "Quickshell.Io",
"name": "DataStreamParser"
},
"details": "The parser for stderr. If the parser is null the process's stdout channel will be closed\nand no further data will be read, even if a new parser is attached.\n"
},
"running": {
"type": {
"type": "qt",
"module": "qml",
"name": "bool"
},
"details": "If the process is currently running. Defaults to false.\n\nSetting this property to true will start the process if command has at least\none element.\nSetting it to false will send SIGTERM. To immediately kill the process,\nuse TYPE99Vsignal99Tfunc99TYPE with SIGKILL. The process will be killed when\nquickshell dies.\n\nIf you want to run the process in a loop, use the onRunningChanged signal handler\nto restart the process.\n```qml\nProcess {\n running: true\n onRunningChanged: if (!running) running = true\n}\n```\n"
}
},
"functions": [
{
"ret": {
"type": "qt",
"module": "qml",
"name": "void"
},
"name": "signal",
"id": "signal",
"details": "Sends a signal to the process if TYPE99Vrunning99Tprop99TYPE is true, otherwise does nothing.\n",
"params": [
{
"name": "signal",
"type": {
"type": "qt",
"module": "qml",
"name": "int"
}
}
]
},
{
"ret": {
"type": "qt",
"module": "qml",
"name": "void"
},
"name": "write",
"id": "write",
"details": "Writes to the process's stdin. Does nothing if TYPE99Vrunning99Tprop99TYPE is false.\n",
"params": [
{
"name": "data",
"type": {
"type": "qt",
"module": "qml",
"name": "string"
}
}
]
}
],
"signals": {
"exited": {
"name": "exited",
"details": null,
"params": [
{
"name": "exitCode",
"type": {
"type": "qt",
"module": "qml",
"name": "int"
}
},
{
"name": "exitStatus",
"type": {
"type": "unknown",
"module": "",
"name": ""
}
}
]
},
"started": {
"name": "started",
"details": null,
"params": []
}
},
"variants": {}
}