Display and control your Android device
Add --no-terminal-title
zxmpg415ea75b8b06bf
diff --git a/app/data/bash-completion/scrcpy b/app/data/bash-completion/scrcpyindex 3fedc681..cf0c97a8 100644--- a/app/data/bash-completion/scrcpy+++ b/app/data/bash-completion/scrcpy@@ -64,6 +64,7 @@ _scrcpy() {--no-mipmaps--no-mouse-hover--no-power-on+ --no-terminal-title--no-vd-destroy-content--no-vd-system-decorations--no-videodiff --git a/app/data/zsh-completion/_scrcpy b/app/data/zsh-completion/_scrcpyindex f4a65658..bef79279 100644--- a/app/data/zsh-completion/_scrcpy+++ b/app/data/zsh-completion/_scrcpy@@ -70,6 +70,7 @@ arguments=('--no-mipmaps[Disable the generation of mipmaps]''--no-mouse-hover[Do not forward mouse hover events]''--no-power-on[Do not power on the device on start]'+ '--no-terminal-title[Disable terminal title updates]''--no-vd-destroy-content[Disable virtual display "destroy content on removal" flag]''--no-vd-system-decorations[Disable virtual display system decorations flag]''--no-video[Disable video forwarding]'diff --git a/app/scrcpy.1 b/app/scrcpy.1index 6c00c984..d65ffdd7 100644--- a/app/scrcpy.1+++ b/app/scrcpy.1@@ -428,6 +428,10 @@ Do not forward mouse hover (mouse motion without any clicks) events..B \-\-no\-power\-onDo not power on the device on start.+.TP+.B \-\-no\-terminal\-title+Disable terminal title updates.+.TP.B \-\-no\-vd\-destroy\-contentDisable virtual display "destroy content on removal" flag.diff --git a/app/src/cli.c b/app/src/cli.cindex 1fbc7bae..1624c293 100644--- a/app/src/cli.c+++ b/app/src/cli.c@@ -110,6 +110,7 @@ enum {OPT_BACKGROUND_COLOR,OPT_RENDER_FIT,OPT_IGNORE_VIDEO_ENCODER_CONSTRAINTS,+ OPT_NO_TERMINAL_TITLE,};struct sc_option {@@ -667,6 +668,11 @@ static const struct sc_option options[] = {.longopt = "no-power-on",.text = "Do not power on the device on start.",},+ {+ .longopt_id = OPT_NO_TERMINAL_TITLE,+ .longopt = "no-terminal-title",+ .text = "Disable terminal title updates.",+ },{.longopt_id = OPT_NO_VD_DESTROY_CONTENT,.longopt = "no-vd-destroy-content",@@ -2936,6 +2942,9 @@ parse_args_with_getopt(struct scrcpy_cli_args *args, int argc, char *argv[],case OPT_IGNORE_VIDEO_ENCODER_CONSTRAINTS:opts->ignore_video_encoder_constraints = true;break;+ case OPT_NO_TERMINAL_TITLE:+ opts->update_terminal_title = false;+ break;default:// getopt prints the error message on stderrreturn false;diff --git a/app/src/main.c b/app/src/main.cindex f5012d33..ea33e6f1 100644--- a/app/src/main.c+++ b/app/src/main.c@@ -33,8 +33,6 @@ main_scrcpy(int argc, char *argv[]) {setbuf(stderr, NULL);#endif- sc_term_set_title("scrcpy");-printf("scrcpy " SCRCPY_VERSION" <https://github.com/Genymobile/scrcpy>\n");@@ -58,6 +56,10 @@ main_scrcpy(int argc, char *argv[]) {sc_set_log_level(args.opts.log_level);+ if (args.opts.update_terminal_title) {+ sc_term_set_title("scrcpy");+ }+if (args.help) {scrcpy_print_usage(argv[0]);ret = SCRCPY_EXIT_SUCCESS;@@ -111,7 +113,9 @@ end:getchar();}- sc_term_set_title("");+ if (args.opts.update_terminal_title) {+ sc_term_set_title("");+ }return ret;}diff --git a/app/src/options.c b/app/src/options.cindex 0788ac7e..c7e9a3fd 100644--- a/app/src/options.c+++ b/app/src/options.c@@ -122,6 +122,7 @@ const struct scrcpy_options scrcpy_options_default = {.keep_active = false,.flex_display = false,.ignore_video_encoder_constraints = false,+ .update_terminal_title = true,};enum sc_orientationdiff --git a/app/src/options.h b/app/src/options.hindex 2acd4620..5b84c2ea 100644--- a/app/src/options.h+++ b/app/src/options.h@@ -345,6 +345,7 @@ struct scrcpy_options {bool keep_active;bool flex_display;bool ignore_video_encoder_constraints;+ bool update_terminal_title;};extern const struct scrcpy_options scrcpy_options_default;diff --git a/app/src/scrcpy.c b/app/src/scrcpy.cindex 6fa4ba7e..304c5303 100644--- a/app/src/scrcpy.c+++ b/app/src/scrcpy.c@@ -511,7 +511,9 @@ scrcpy(struct scrcpy_options *options) {options->window_title ? options->window_title : info->device_name;assert(window_title);- set_terminal_title_with_prefix(window_title);+ if (options->update_terminal_title) {+ set_terminal_title_with_prefix(window_title);+ }const char *serial = s->server.serial;assert(serial);diff --git a/app/src/usb/scrcpy_otg.c b/app/src/usb/scrcpy_otg.cindex de1d9fd6..c4987c24 100644--- a/app/src/usb/scrcpy_otg.c+++ b/app/src/usb/scrcpy_otg.c@@ -196,7 +196,9 @@ scrcpy_otg(struct scrcpy_options *options) {}if (window_title) {- set_terminal_title_with_prefix(window_title);+ if (options->update_terminal_title) {+ set_terminal_title_with_prefix(window_title);+ }} else {window_title = "scrcpy";}diff --git a/doc/window.md b/doc/window.mdindex b5dd4f2f..b8a8d2cf 100644--- a/doc/window.md+++ b/doc/window.md@@ -17,6 +17,8 @@ By default, the window title is the device model. It can be changed:scrcpy --window-title='My device'```+It also updates the terminal title, unless `--no-terminal-title` is set.+## Position and sizeThe initial window position and size may be specified: