2022-02-22 05:38:53 +08:00
|
|
|
_scrcpy() {
|
|
|
|
local cur prev words cword
|
|
|
|
local opts="
|
|
|
|
--always-on-top
|
2023-02-19 01:32:43 +08:00
|
|
|
--audio-bit-rate=
|
2023-02-19 02:05:43 +08:00
|
|
|
--audio-codec=
|
2023-02-23 05:48:23 +08:00
|
|
|
--audio-codec-options=
|
2023-02-20 03:20:29 +08:00
|
|
|
--audio-encoder=
|
2023-02-22 02:56:44 +08:00
|
|
|
-b --video-bit-rate=
|
2022-02-22 05:38:53 +08:00
|
|
|
--crop=
|
|
|
|
-d --select-usb
|
|
|
|
--disable-screensaver
|
|
|
|
--display=
|
|
|
|
--display-buffer=
|
|
|
|
-e --select-tcpip
|
|
|
|
--force-adb-forward
|
|
|
|
--forward-all-clicks
|
|
|
|
-f --fullscreen
|
|
|
|
-K --hid-keyboard
|
|
|
|
-h --help
|
|
|
|
--legacy-paste
|
2023-02-24 06:10:15 +08:00
|
|
|
--list-displays
|
2023-02-23 06:15:15 +08:00
|
|
|
--list-encoders
|
2022-02-22 05:38:53 +08:00
|
|
|
--lock-video-orientation
|
|
|
|
--lock-video-orientation=
|
|
|
|
--max-fps=
|
|
|
|
-M --hid-mouse
|
|
|
|
-m --max-size=
|
2023-02-03 23:27:34 +08:00
|
|
|
--no-audio
|
2022-02-22 05:38:53 +08:00
|
|
|
--no-cleanup
|
2023-02-23 02:08:24 +08:00
|
|
|
--no-clipboard-autosync
|
2022-02-22 05:38:53 +08:00
|
|
|
--no-downsize-on-error
|
|
|
|
-n --no-control
|
|
|
|
-N --no-display
|
|
|
|
--no-key-repeat
|
|
|
|
--no-mipmaps
|
2022-04-23 21:08:30 +08:00
|
|
|
--no-power-on
|
2022-02-22 05:38:53 +08:00
|
|
|
--otg
|
|
|
|
-p --port=
|
|
|
|
--power-off-on-close
|
|
|
|
--prefer-text
|
|
|
|
--print-fps
|
|
|
|
--push-target=
|
|
|
|
--raw-key-events
|
|
|
|
-r --record=
|
|
|
|
--record-format=
|
|
|
|
--render-driver=
|
2023-03-01 04:19:43 +08:00
|
|
|
--require-audio
|
2022-02-22 05:38:53 +08:00
|
|
|
--rotation=
|
|
|
|
-s --serial=
|
|
|
|
--shortcut-mod=
|
|
|
|
-S --turn-screen-off
|
|
|
|
-t --show-touches
|
|
|
|
--tcpip
|
|
|
|
--tcpip=
|
|
|
|
--tunnel-host=
|
|
|
|
--tunnel-port=
|
|
|
|
--v4l2-buffer=
|
|
|
|
--v4l2-sink=
|
|
|
|
-V --verbosity=
|
|
|
|
-v --version
|
2023-02-21 04:19:36 +08:00
|
|
|
--video-codec=
|
2023-02-22 04:46:34 +08:00
|
|
|
--video-codec-options=
|
2023-02-23 05:44:01 +08:00
|
|
|
--video-encoder=
|
2022-02-22 05:38:53 +08:00
|
|
|
-w --stay-awake
|
|
|
|
--window-borderless
|
|
|
|
--window-title=
|
|
|
|
--window-x=
|
|
|
|
--window-y=
|
|
|
|
--window-width=
|
|
|
|
--window-height="
|
|
|
|
|
|
|
|
_init_completion -s || return
|
|
|
|
|
|
|
|
case "$prev" in
|
2023-02-21 04:19:36 +08:00
|
|
|
--video-codec)
|
2023-02-22 02:48:28 +08:00
|
|
|
COMPREPLY=($(compgen -W 'h264 h265 av1' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
2023-02-19 02:05:43 +08:00
|
|
|
--audio-codec)
|
2023-03-04 04:19:37 +08:00
|
|
|
COMPREPLY=($(compgen -W 'opus aac raw' -- "$cur"))
|
2023-02-19 02:05:43 +08:00
|
|
|
return
|
|
|
|
;;
|
2022-02-22 05:38:53 +08:00
|
|
|
--lock-video-orientation)
|
|
|
|
COMPREPLY=($(compgen -W 'unlocked initial 0 1 2 3' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
-r|--record)
|
|
|
|
COMPREPLY=($(compgen -f -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
--record-format)
|
|
|
|
COMPREPLY=($(compgen -W 'mkv mp4' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
--render-driver)
|
|
|
|
COMPREPLY=($(compgen -W 'direct3d opengl opengles2 opengles metal software' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
--rotation)
|
|
|
|
COMPREPLY=($(compgen -W '0 1 2 3' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
--shortcut-mod)
|
|
|
|
# Only auto-complete a single key
|
|
|
|
COMPREPLY=($(compgen -W 'lctrl rctrl lalt ralt lsuper rsuper' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
-V|--verbosity)
|
|
|
|
COMPREPLY=($(compgen -W 'verbose debug info warn error' -- "$cur"))
|
|
|
|
return
|
|
|
|
;;
|
2022-10-07 22:23:59 +08:00
|
|
|
-s|--serial)
|
|
|
|
# Use 'adb devices' to list serial numbers
|
|
|
|
COMPREPLY=($(compgen -W "$("${ADB:-adb}" devices | awk '$2 == "device" {print $1}')" -- ${cur}))
|
|
|
|
return
|
|
|
|
;;
|
2023-02-22 02:56:44 +08:00
|
|
|
-b|--video-bit-rate \
|
2022-02-22 05:38:53 +08:00
|
|
|
|--codec-options \
|
|
|
|
|--crop \
|
|
|
|
|--display \
|
|
|
|
|--display-buffer \
|
|
|
|
|--encoder \
|
|
|
|
|--max-fps \
|
|
|
|
|-m|--max-size \
|
|
|
|
|-p|--port \
|
|
|
|
|--push-target \
|
|
|
|
|--tunnel-host \
|
|
|
|
|--tunnel-port \
|
|
|
|
|--v4l2-buffer \
|
|
|
|
|--v4l2-sink \
|
|
|
|
|--tcpip \
|
|
|
|
|--window-*)
|
|
|
|
# Option accepting an argument, but nothing to auto-complete
|
|
|
|
return
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
COMPREPLY=($(compgen -W "$opts" -- "$cur"))
|
|
|
|
[[ $COMPREPLY == *= ]] && compopt -o nospace
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _scrcpy scrcpy
|