Skip to content

Scripting

thejaustin edited this page Sep 19, 2026 · 1 revision

Scripting

The Scripting screen lets you save named shell-script snippets and run them on demand — or automatically each time the privileged service starts. It's a lightweight way to keep your frequently-used pm, settings, cmd, and other shell one-liners a single tap away, without wiring up a full automation app.

Open it from the Scripting home card.


Snippets

Each snippet has three fields:

Field Notes
Title A short label shown in the list and in the output dialog. Required.
Script The shell command(s) to run. Multi-line is supported; the list preview shows the first line. Required.
Auto-run When checked, this snippet runs automatically every time the service comes up (see below). Shown as a badge on the snippet row.

Tap a snippet to edit it, tap its run button to execute it, and long-press to delete it (with confirmation). The "+" action is available from the empty-state button when you have no snippets yet, and moves to a floating button once at least one snippet exists.


How snippets run

Scripts execute through Shizuku's privileged process API:

ShizukuProcessUtils.runPrivilegedCapture(["sh", "-c", <your script>])

That means they run at the shell UID (2000, ADB-level) — the same privilege the rest of Shizuku+ uses — not root. Anything the shell user can do (pm, settings, cmd, dumpsys, svc, am, …) works; anything that genuinely needs root does not. If the SU Bridge feature is enabled, su-prefixed commands inside your snippet are transparently rerouted/translated the same way they are for any other app.

After a run, a dialog shows the exit code, stdout, and stderr (if any), with a Copy output button. Execution has a 5-second join timeout on collecting output.


Auto-run

Snippets flagged Auto-run execute automatically whenever the Shizuku state machine transitions to RUNNING — i.e. every time the privileged service (re)connects, including after a reboot or a watchdog restart. Each auto-run snippet runs independently; if one fails it's logged and the rest still run.

This is useful for re-applying settings that don't survive a reboot, e.g. disabling an animation scale, forcing a display density, or re-blocking a background app. Because auto-run fires on every service start, keep these snippets idempotent — safe to run repeatedly.

Auto-run scripts run unattended with no output dialog. Test a snippet manually first and confirm its exit code before enabling Auto-run on it.

Clone this wiki locally