Add dynamic App Shortcuts for external automation (Tasker/Samsung Routines) (#676)

Register toggle/start/stop shortcuts via ShortcutManagerCompat on app launch,
enabling Samsung Routines and other launchers to control the Clash service
through long-press app icon shortcuts.

Use launcher icon for shortcut display; suppress activity transitions and
exclude ExternalControlActivity from recents for seamless background control.
This commit is contained in:
sleshep
2026-03-06 09:39:31 +08:00
committed by GitHub
parent 406e4004f2
commit 83261bb3f9
5 changed files with 76 additions and 0 deletions

View File

@@ -262,4 +262,11 @@
<string name="external_control_stopped">Clash.Meta 服务已停止</string>
<string name="import_from_qr_no_permission">相机权限受限,请前往设置开启。</string>
<string name="import_from_qr_exception">发生系统未知异常,操作失败。</string>
<string name="shortcut_toggle_short">切换 Clash</string>
<string name="shortcut_toggle_long">切换 Clash 服务启停</string>
<string name="shortcut_start_short">启动 Clash</string>
<string name="shortcut_start_long">启动 Clash 服务</string>
<string name="shortcut_stop_short">停止 Clash</string>
<string name="shortcut_stop_long">停止 Clash 服务</string>
</resources>

View File

@@ -350,4 +350,11 @@
<string name="hide_from_recents_desc">Hide app from the Recent apps screen</string>
<string name="import_from_qr_no_permission">Camera access is restricted. Please enable it in Settings.</string>
<string name="import_from_qr_exception">An unhandled system exception occurred.</string>
<string name="shortcut_toggle_short">Toggle Clash</string>
<string name="shortcut_toggle_long">Toggle Clash service on/off</string>
<string name="shortcut_start_short">Start Clash</string>
<string name="shortcut_start_long">Start Clash service</string>
<string name="shortcut_stop_short">Stop Clash</string>
<string name="shortcut_stop_long">Stop Clash service</string>
</resources>