tools/nav-mode.ps1 (1364 bytes)
1 # PowerShell twin of tools/nav-mode. See that file for what and why. 2 # .\tools\nav-mode.ps1 buttons nogestures 3 # .\tools\nav-mode.ps1 status 4 param([string]$Buttons = "", [string]$Gestures = "") 5 6 function Show-Status { 7 $mode = (adb shell settings get secure navigation_mode).Trim() 8 $gest = (adb shell settings get system disable_gesture_bottom).Trim() 9 "button bar: " + $(if ($mode -eq "2") { "hidden" } else { "showing" }) 10 "swipe-up gesture: " + $(if ($gest -eq "1") { "off" } else { "on" }) 11 } 12 13 if ($Buttons -eq "status") { Show-Status; exit 0 } 14 $cat = switch ($Buttons) { "buttons" { "threebutton" } "nobuttons" { "gestural" } default { $null } } 15 $off = switch ($Gestures) { "gestures" { 0 } "nogestures" { 1 } default { $null } } 16 if ($null -eq $cat -or $null -eq $off) { "usage: nav-mode.ps1 buttons|nobuttons gestures|nogestures (or: status)"; exit 2 } 17 $scale = if ($off -eq 1) { "0" } else { "0.6" } 18 19 adb shell cmd overlay enable-exclusive --category "com.android.internal.systemui.navbar.$cat" 20 Start-Sleep -Seconds 5 21 adb shell settings put system disable_gesture_bottom (1 - $off) 22 Start-Sleep -Seconds 1 23 adb shell settings put system disable_gesture_bottom $off 24 adb shell settings put secure back_gesture_inset_scale_left $scale 25 adb shell settings put secure back_gesture_inset_scale_right $scale 26 Start-Sleep -Seconds 1 27 Show-Status