Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

情景模式condition bash集成 #1144

Open
gfhdhytghd opened this issue Jan 24, 2025 · 0 comments
Open

情景模式condition bash集成 #1144

gfhdhytghd opened this issue Jan 24, 2025 · 0 comments

Comments

@gfhdhytghd
Copy link

目前的情景模式某些时候任然会出现condition难以完全满足需求的问题,故提出此解决方案

示例如下

[
  {
    "name": "Start app process",
    "description": "检测到应用被杀死时,启动该应用进程",
    "priority": 1,
    "condition": "pkgKilled == true && bash == 1"",
    "bash_variable_in":"a=pkgName"
    "bash_code": if [[ a -eq com.abc ]];then;echo 1;fi"
    "actions": [
      "ui.showShortToast(\"启动XXX...\");",
      "activity.launchProcessForPackage(\"com.xx.xx\")"
    ]
  }
]

解释:当pkgKilled=true时运行bash
传入变量a=pkgName
bash输出结果为1则执行action
也可以允许用户不填写action,直接拿bash当action

bash执行环境直接使用裸环境,至于用户自己要不要调python或者外部包随他

bash不做检查,让用户自己debug去

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant