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-03-15 06:40:48 +08:00
|
|
|
--audio-buffer=
|
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-05-31 03:29:05 +08:00
|
|
|
--audio-source=
|
2023-03-13 16:23:02 +08:00
|
|
|
--audio-output-buffer=
|
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
|
2023-06-01 15:52:35 +08:00
|
|
|
-f --fullscreen
|
2022-02-22 05:38:53 +08:00
|
|
|
--force-adb-forward
|
|
|
|
--forward-all-clicks
|
|
|
|
-h --help
|
2023-06-06 01:48:21 +08:00
|
|
|
--kill-adb-on-close
|
2023-06-06 01:44:15 +08:00
|
|
|
-K --hid-keyboard
|
2022-02-22 05:38:53 +08:00
|
|
|
--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=
|
|
|
|
-m --max-size=
|
2023-06-01 15:52:35 +08:00
|
|
|
-M --hid-mouse
|
|
|
|
--max-fps=
|
|
|
|
-n --no-control
|
|
|
|
-N --no-playback
|
2023-02-03 23:27:34 +08:00
|
|
|
--no-audio
|
2023-05-25 03:22:31 +08:00
|
|
|
--no-audio-playback
|
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
|
|
|
|
--no-key-repeat
|
|
|
|
--no-mipmaps
|
2022-04-23 21:08:30 +08:00
|
|
|
--no-power-on
|
2023-05-07 18:08:50 +08:00
|
|
|
--no-video
|
2023-05-25 03:22:31 +08:00
|
|
|
--no-video-playback
|
2022-02-22 05:38:53 +08:00
|
|
|
--otg
|
|
|
|
-p --port=
|
|
|
|
--power-off-on-close
|
|
|
|
--prefer-text
|
|
|
|
--print-fps
|
|
|
|
--push-target=
|
|
|
|
-r --record=
|
2023-06-01 15:52:35 +08:00
|
|
|
--raw-key-events
|
2022-02-22 05:38:53 +08:00
|
|
|
--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=
|
|
|
|
-S --turn-screen-off
|
2023-06-01 15:52:35 +08:00
|
|
|
--shortcut-mod=
|
2022-02-22 05:38:53 +08:00
|
|
|
-t --show-touches
|
|
|
|
--tcpip
|
|
|
|
--tcpip=
|
2023-06-02 00:46:50 +08:00
|
|
|
--time-limit=
|
2022-02-22 05:38:53 +08:00
|
|
|
--tunnel-host=
|
|
|
|
--tunnel-port=
|
|
|
|
--v4l2-buffer=
|
|
|
|
--v4l2-sink=
|
|
|
|
-v --version
|
2023-06-01 15:52:35 +08:00
|
|
|
-V --verbosity=
|
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
|
|
|
|
;;
|
2023-05-31 03:29:05 +08:00
|
|
|
--audio-source)
|
|
|
|
COMPREPLY=($(compgen -W 'output mic' -- "$cur"))
|
|
|
|
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-03-15 06:45:08 +08:00
|
|
|
--audio-bit-rate \
|
|
|
|
|--audio-buffer \
|
|
|
|
|-b|--video-bit-rate \
|
|
|
|
|--audio-codec-options \
|
|
|
|
|--audio-encoder \
|
2023-03-13 16:23:02 +08:00
|
|
|
|--audio-output-buffer \
|
2022-02-22 05:38:53 +08:00
|
|
|
|--crop \
|
|
|
|
|--display \
|
|
|
|
|--display-buffer \
|
|
|
|
|--max-fps \
|
|
|
|
|-m|--max-size \
|
|
|
|
|-p|--port \
|
|
|
|
|--push-target \
|
2023-03-15 06:45:08 +08:00
|
|
|
|--rotation \
|
2022-02-22 05:38:53 +08:00
|
|
|
|--tunnel-host \
|
|
|
|
|--tunnel-port \
|
|
|
|
|--v4l2-buffer \
|
|
|
|
|--v4l2-sink \
|
2023-03-15 06:45:08 +08:00
|
|
|
|--video-codec-options \
|
|
|
|
|--video-encoder \
|
2022-02-22 05:38:53 +08:00
|
|
|
|--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
|