From 9f217c535bbf8a2c869762dbba94d7bfc6a45d06 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 27 Jun 2022 12:15:37 +0200 Subject: [PATCH 1/4] Replace hardcoded 'share/' by datadir variable Meson defines a variable for the data directory. PR #3351 --- app/meson.build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/meson.build b/app/meson.build index f5d76c61dd..64459bfd29 100644 --- a/app/meson.build +++ b/app/meson.build @@ -223,14 +223,17 @@ executable('scrcpy', src, install: true, c_args: []) +# +datadir = get_option('datadir') # by default 'share' + install_man('scrcpy.1') install_data('data/icon.png', rename: 'scrcpy.png', - install_dir: 'share/icons/hicolor/256x256/apps') + install_dir: join_paths(datadir, 'icons/hicolor/256x256/apps')) install_data('data/zsh-completion/_scrcpy', - install_dir: 'share/zsh/site-functions') + install_dir: join_paths(datadir, 'zsh/site-functions')) install_data('data/bash-completion/scrcpy', - install_dir: 'share/bash-completion/completions') + install_dir: join_paths(datadir, 'bash-completion/completions')) ### TESTS From 6eb8dcbd2205b7242b93d99ed67e65f15e1da46f Mon Sep 17 00:00:00 2001 From: Addison Snelling Date: Sun, 14 Oct 2018 03:50:35 -0500 Subject: [PATCH 2/4] Add desktop entry file for Linux app launchers Refs PR #3351 Replaces PR #296 Fixes #295 Fixes #748 Fixes #1636 Co-authored-by: Addison Snelling Co-authored-by: Chih-Hsuan Yen Co-authored-by: Romain Vimont Signed-off-by: Romain Vimont --- app/data/scrcpy.desktop | 10 ++++++++++ app/meson.build | 7 +++++++ 2 files changed, 17 insertions(+) create mode 100644 app/data/scrcpy.desktop diff --git a/app/data/scrcpy.desktop b/app/data/scrcpy.desktop new file mode 100644 index 0000000000..5933272d24 --- /dev/null +++ b/app/data/scrcpy.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=scrcpy +GenericName=Android Remote Control +Comment=Display and control your Android device +Exec=scrcpy +Icon=scrcpy +Terminal=false +Type=Application +Categories=Utility;RemoteAccess; +StartupNotify=false diff --git a/app/meson.build b/app/meson.build index 64459bfd29..74c6d0e655 100644 --- a/app/meson.build +++ b/app/meson.build @@ -235,6 +235,13 @@ install_data('data/zsh-completion/_scrcpy', install_data('data/bash-completion/scrcpy', install_dir: join_paths(datadir, 'bash-completion/completions')) +# Desktop entry file for application launchers +if host_machine.system() == 'linux' + # Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop) + install_data('data/scrcpy.desktop', + install_dir: join_paths(datadir, 'applications')) +endif + ### TESTS From 953531fc39bb7e3ae3869c3fa57cea6fd5da2f54 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sat, 11 Dec 2021 11:47:57 +0800 Subject: [PATCH 3/4] Use shell environment to execute launcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make Exec= compatible with $PATH configured in .bashrc/ or .zshrc/… PR #3351 Refs #296 Co-authored-by: Romain Vimont Signed-off-by: Romain Vimont --- app/data/scrcpy.desktop | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/data/scrcpy.desktop b/app/data/scrcpy.desktop index 5933272d24..082b75e0f0 100644 --- a/app/data/scrcpy.desktop +++ b/app/data/scrcpy.desktop @@ -2,7 +2,10 @@ Name=scrcpy GenericName=Android Remote Control Comment=Display and control your Android device -Exec=scrcpy +# For some users, the PATH or ADB environment variables are set from the shell +# startup file, like .bashrc or .zshrc… Run an interactive shell to get +# environment correctly initialized. +Exec=/bin/sh -c '"$SHELL" -i -c scrcpy' Icon=scrcpy Terminal=false Type=Application From 49ae16262d4b4279acca60feee32be42645904b2 Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Mon, 27 Jun 2022 13:32:40 +0200 Subject: [PATCH 4/4] Add scrcpy-console.desktop Add a launcher which opens a terminal, and keep it open in case of errors (so that the user has time to read error messages). The behavior is the same as scrcpy-console.bat on Windows. PR #3351 --- app/data/scrcpy-console.desktop | 13 +++++++++++++ app/meson.build | 2 ++ 2 files changed, 15 insertions(+) create mode 100644 app/data/scrcpy-console.desktop diff --git a/app/data/scrcpy-console.desktop b/app/data/scrcpy-console.desktop new file mode 100644 index 0000000000..47a63ec99e --- /dev/null +++ b/app/data/scrcpy-console.desktop @@ -0,0 +1,13 @@ +[Desktop Entry] +Name=scrcpy (console) +GenericName=Android Remote Control +Comment=Display and control your Android device +# For some users, the PATH or ADB environment variables are set from the shell +# startup file, like .bashrc or .zshrc… Run an interactive shell to get +# environment correctly initialized. +Exec=/bin/bash --norc --noprofile -i -c '"$SHELL" -i -c scrcpy || read -p "Press any key to quit..."' +Icon=scrcpy +Terminal=true +Type=Application +Categories=Utility;RemoteAccess; +StartupNotify=false diff --git a/app/meson.build b/app/meson.build index 74c6d0e655..a7ba4009e4 100644 --- a/app/meson.build +++ b/app/meson.build @@ -240,6 +240,8 @@ if host_machine.system() == 'linux' # Install a launcher (ex: /usr/local/share/applications/scrcpy.desktop) install_data('data/scrcpy.desktop', install_dir: join_paths(datadir, 'applications')) + install_data('data/scrcpy-console.desktop', + install_dir: join_paths(datadir, 'applications')) endif