Thanox 情景模式

Thanox 情景模式

情景模式简单理解:

什么时候,干什么。

  • 什么时候就是触发条件(condition)

  • 干什么就是动作(actions)

本文分享自用的情景模式,不定期更新~

官方文档:

https://tornaco.github.io/Thanox/6-Profile/

1、GPS 相关

GPS自动开关

GPS自动开启 >folded
1
2
3
4
5
6
7
name: "GPS自动开启"
description: "打开应用打开GPS,全局变量 gps"
priority: 2
condition: "frontPkgChanged && globalVarOf$gps.contains(to) && !hw.isLocationEnabled()"
actions:
- "hw.enableLocation()"
- 'ui.showShortToast("🎉打开GPS")'
GPS自动关闭 >folded
1
2
3
4
5
6
7
name: "GPS自动关闭"
description: "停止应用关闭GPS,全局变量 gps"
priority: 2
condition: "pkgKilled && globalVarOf$gps.contains(pkgName) && hw.isLocationEnabled()"
actions:
- "hw.disableLocation()"
- 'ui.showShortToast("🎉关闭GPS")'

微信小程序开关GPS

小程序自动打开GPS >folded
1
2
3
4
5
6
7
name: "小程序自动打开GPS"
description: "顾名思义"
priority: 2
condition: '(activityResumed || frontPkgChanged) && !hw.isLocationEnabled() && componentNameAsString.contains("com.tencent.mm/com.tencent.mm.plugin.appbrand.ui.AppBrandUI")'
actions:
- "hw.enableLocation()"
- 'ui.showShortToast("🎉打开GPS")'
小程序自动关闭GPS >folded
1
2
3
4
5
6
7
name: "小程序自动关闭GPS"
description: "顾名思义"
priority: 2
condition: 'frontPkgChanged && hw.isLocationEnabled() && from == "com.tencent.mm"'
actions:
- "hw.disableLocation()"
- 'ui.showShortToast("🎉关闭GPS")'

微信网页开关GPS

微信网页打开GPS >folded
1
2
3
4
5
6
7
name: "微信网页打开GPS"
description: "顾名思义"
priority: 2
condition: '(activityResumed || frontPkgChanged) && !hw.isLocationEnabled() && componentNameAsString.contains("com.tencent.mm/com.tencent.mm.plugin.webview.ui.tools.WebViewUI")'
actions:
- "hw.enableLocation()"
- 'ui.showShortToast("🎉打开GPS")'
微信网页关闭GPS >folded
1
2
3
4
5
6
7
name: "微信网页关闭GPS"
description: "顾名思义"
priority: 2
condition: '(activityResumed || frontPkgChanged) && hw.isLocationEnabled() && !componentNameAsString.contains("com.tencent.mm/com.tencent.mm.plugin.webview.ui.tools.WebViewUI")'
actions:
- "hw.disableLocation()"
- 'ui.showShortToast("🎉关闭GPS")'

2、NFC 相关

NFC自动开关

NFC自动开启 >folded
1
2
3
4
5
6
7
name: "NFC自动开启"
description: "打开应用打开NFC,全局变量 nfc"
priority: 2
condition: "frontPkgChanged && globalVarOf$nfc.contains(to) && !hw.isNfcEnabled()"
actions:
- "hw.enableNfc()"
- 'ui.showShortToast("🎉打开NFC")'
NFC自动关闭 >folded
1
2
3
4
5
6
7
name: "NFC自动关闭"
description: "停止应用关闭NFC,全局变量 nfc"
priority: 2
condition: "pkgKilled && globalVarOf$nfc.contains(pkgName) && hw.isNfcEnabled()"
actions:
- "hw.disableNfc()"
- 'ui.showShortToast("🎉关闭NFC")'

3、冻结相关

蓝牙开关冻结

BT冻结 >folded
1
2
3
4
5
6
7
name: "BT冻结"
description: "蓝牙关闭冻结指定应用,全局变量 btkill"
priority: 2
condition: "btStateChanged && btStateOff"
actions:
- "for (String s : globalVarOf$btkill) { if (pkg.isApplicationEnabled(s)) pkg.disableApplication(s) }"
- 'ui.showShortToast("🎉BT冻结")'
BT解冻 >folded
1
2
3
4
5
6
7
name: "BT解冻"
description: "蓝牙打开解冻指定应用,全局变量 btkill"
priority: 2
condition: "btStateChanged && btStateOn"
actions:
- "for (String s : globalVarOf$btkill) { if (!pkg.isApplicationEnabled(s)) pkg.enableApplication(s) }"
- 'ui.showShortToast("🎉BT解冻")'

游戏开关冻结

自行修改以下 com.oneplus.gamespace 包名

Game冻结 >folded
1
2
3
4
5
6
7
8
name: "Game冻结"
description: "关闭游戏冻结游戏空间,全局变量 game"
# 一加专属
priority: 2
condition: 'taskRemoved && globalVarOf$game.contains(pkgName) && pkg.isApplicationEnabled("com.oneplus.gamespace")'
actions:
- 'pkg.disableApplication("com.oneplus.gamespace")'
- 'ui.showShortToast("🎉冻结游戏空间")'
Game解冻 >folded
1
2
3
4
5
6
7
8
name: "Game解冻"
description: "打开游戏解冻游戏空间,全局变量 game"
# 一加专属
priority: 2
condition: 'frontPkgChanged && globalVarOf$game.contains(to) && !pkg.isApplicationEnabled("com.oneplus.gamespace")'
actions:
- 'pkg.enableApplication("com.oneplus.gamespace")'
- 'ui.showShortToast("🎉解冻游戏空间")'

4、应用相关

APP保活

推荐用乖巧模式的规则来 KEEP 想保持的服务

以下貌似没用,可以开启电池不优化试试

APP保活 >folded
1
2
3
4
5
6
7
8
name: "APP保活"
description: "应用停止运行时重启应用进程,全局变量 apps"
# APP 后台不优化
priority: 2
condition: "pkgKilled && globalVarOf$apps.contains(pkgName)"
actions:
- "activity.launchProcessForPackage(pkgName)"
- 'ui.showShortToast("🎉保活app")'

APP休眠

APP休眠 >folded
1
2
3
4
5
6
name: "APP休眠"
description: "后台应用休眠,全局变量 idle"
priority: 2
condition: "frontPkgChanged && globalVarOf$idle.contains(from)"
actions:
- "activity.setInactive(from)"

5、Data 相关

Data自动开启

Data自动开启 >folded
1
2
3
4
5
6
7
name: "Data自动开启"
description: "打开应用打开移动数据,全局变量 data"
priority: 2
condition: "frontPkgChanged && globalVarOf$data.contains(to) && !hw.isWifiEnabled() && !data.isDataEnabled()"
actions:
- "data.setDataEnabled(true)"
- 'ui.showShortToast("🎉打开移动数据")'

6、亮度相关

自动亮度关闭

自动亮度关闭 >folded
1
2
3
4
5
6
7
name: "自动亮度关闭"
description: "打开应用关闭自动亮度,全局变量 bright"
priority: 2
condition: "frontPkgChanged && globalVarOf$bright.contains(to) && power.isAutoBrightnessEnabled()"
actions:
- "power.setAutoBrightnessEnabled(false)"
- 'ui.showShortToast("🎉关闭自动亮度")'

自动亮度开启

自动亮度开启 >folded
1
2
3
4
5
6
7
8
9
name: "自动亮度开启"
description: "停止应用打开自动亮度,全局变量 bright"
priority: 2
condition: "pkgKilled && globalVarOf$bright.contains(pkgName) && !power.isAutoBrightnessEnabled()"
actions:
- "power.setAutoBrightnessEnabled(true)"
- "power.setBrightness(power.getBrightness())"
- 'ui.showShortToast("🎉开启自动亮度")'

7、状态栏图标相关

隐藏状态栏图标的 shell 命令:

settings put secure icon_blacklist 「args」

自行修改 「args」 参数

状态栏图标隐藏

状态栏图标隐藏 >folded
1
2
3
4
5
6
7
name: "状态栏图标隐藏"
description: "打开应用隐藏状态栏图标,全局变量 bar"
priority: 2
condition: "frontPkgChanged && globalVarOf$bar.contains(to)"
actions:
- 'sh.exe("settings put secure icon_blacklist volte,vowifi,rotate,zen,clock,battery,vpn")'
- 'ui.showShortToast("🎉隐藏状态栏图标")'

状态栏图标显示

状态栏图标显示 >folded
1
2
3
4
5
6
7
name: "状态栏图标显示"
description: "停止应用显示状态栏图标,全局变量 bar"
priority: 2
condition: "pkgKilled && globalVarOf$bar.contains(pkgName)"
actions:
- 'sh.exe("settings put secure icon_blacklist volte,vowifi,rotate,zen,battery,vpn")'
- 'ui.showShortToast("🎉显示状态栏图标")'
作者

SukiEva

发布于

2021-11-17

更新于

2021-12-02

许可协议

CC BY-NC-SA 4.0

评论
Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×