From c8407abdf61e0340b443b7af3f5a60892f44fc7c Mon Sep 17 00:00:00 2001 From: Anima C13 <31348553+animaone@users.noreply.github.com> Date: Fri, 7 Oct 2022 11:23:59 -0300 Subject: [PATCH 1/3] Add -s auto-complete option Add -s auto-complete option. --- app/data/bash-completion/scrcpy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index 3e75cbb018..c5105c7d77 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -93,6 +93,11 @@ _scrcpy() { COMPREPLY=($(compgen -W 'verbose debug info warn error' -- "$cur")) return ;; + -s|--serial) + # Use 'adb devices' to list serial numbers. + COMPREPLY=($(compgen -W "$(adb devices | awk '/(device|recovery|sideload)$/{print $1}')" -- ${cur} ) ) + return + ;; -b|--bitrate \ |--codec-options \ |--crop \ @@ -103,7 +108,6 @@ _scrcpy() { |-m|--max-size \ |-p|--port \ |--push-target \ - |-s|--serial \ |--tunnel-host \ |--tunnel-port \ |--v4l2-buffer \ From da4c75c1de661c52eac92d194a2ac59ddab22f19 Mon Sep 17 00:00:00 2001 From: Anima C13 <31348553+animaone@users.noreply.github.com> Date: Fri, 7 Oct 2022 11:53:05 -0300 Subject: [PATCH 2/3] remove sideload and recovery options since scrcpy don't work in sideload and recovery options, I've removed them. --- app/data/bash-completion/scrcpy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index c5105c7d77..36f027b9d2 100644 --- a/app/data/bash-completion/scrcpy +++ b/app/data/bash-completion/scrcpy @@ -95,7 +95,7 @@ _scrcpy() { ;; -s|--serial) # Use 'adb devices' to list serial numbers. - COMPREPLY=($(compgen -W "$(adb devices | awk '/(device|recovery|sideload)$/{print $1}')" -- ${cur} ) ) + COMPREPLY=($(compgen -W "$(adb devices | awk '/device$/{print $1}')" -- ${cur} ) ) return ;; -b|--bitrate \ From 85270b0703cf2053a54ac829d446aa6a09f8d914 Mon Sep 17 00:00:00 2001 From: Anima C13 <31348553+animaone@users.noreply.github.com> Date: Sat, 8 Oct 2022 13:27:29 -0300 Subject: [PATCH 3/3] Add -s autocompletion for zsh Add -s autocompletion for zsh --- app/data/zsh-completion/_scrcpy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/data/zsh-completion/_scrcpy b/app/data/zsh-completion/_scrcpy index 097c80d68b..fad2049510 100644 --- a/app/data/zsh-completion/_scrcpy +++ b/app/data/zsh-completion/_scrcpy @@ -47,7 +47,7 @@ arguments=( '--record-format=[Force recording format]:format:(mp4 mkv)' '--render-driver=[Request SDL to use the given render driver]:driver name:(direct3d opengl opengles2 opengles metal software)' '--rotation=[Set the initial display rotation]:rotation values:(0 1 2 3)' - {-s,--serial=}'[The device serial number \(mandatory for multiple devices only\)]' + {-s,--serial=}'[The device serial number \(mandatory for multiple devices only\)]:serial:($(adb devices|grep -oP "\K\w+(?=\tdevice)"))' '--shortcut-mod=[\[key1,key2+key3,...\] Specify the modifiers to use for scrcpy shortcuts]:shortcut mod:(lctrl rctrl lalt ralt lsuper rsuper)' {-S,--turn-screen-off}'[Turn the device screen off immediately]' {-t,--show-touches}'[Show physical touches]'