Skip to content

Instantly share code, notes, and snippets.

@shalva97
Created November 6, 2020 16:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save shalva97/2f4d7bd5e17c9b7601b6dbba0335a7ff to your computer and use it in GitHub Desktop.
Save shalva97/2f4d7bd5e17c9b7601b6dbba0335a7ff to your computer and use it in GitHub Desktop.
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