diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpy index 3e75cbb018..36f027b9d2 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$/{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 \ 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]'