Created
November 6, 2020 16:46
-
-
Save shalva97/2f4d7bd5e17c9b7601b6dbba0335a7ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adb-layout-bounds | |
if test $argv[1] != false; and test $argv[1] != true; | |
echo wrong arguments, use true or false | |
return 1 | |
end | |
switch (__number_of_connected_devices) | |
case 0 | |
echo no devices connected | |
return 1 | |
case 1 | |
__enable-layout-bounds $argv[1] | |
case '*' | |
__more-than-one-device $argv[1] | |
end | |
end | |
function __enable-layout-bounds | |
adb shell setprop debug.layout $argv[1] | |
adb shell service call activity 1599295570 | |
echo bounds enabled | |
end | |
function __more-than-one-device | |
set chosenDevice (__choose_device) | |
adb -s $chosenDevice shell setprop debug.layout $argv[1] | |
adb -s $chosenDevice shell service call activity 1599295570 | |
echo bounds enabled for $chosenDevice | |
end | |
function __number_of_connected_devices | |
echo (adb devices | tail -n +2 | string match -r '.+'| wc -l) | |
end | |
function __choose_device | |
echo (adb devices | tail -n +2 | fzf | awk '{print $1}') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment