Skip to content

Commit

Permalink
Use the new scrcpy icon
Browse files Browse the repository at this point in the history
Use the new icon designed by @varlesh:
<#1987 (comment)>

Attempt to use the SVG, and fallback to PNG.
  • Loading branch information
rom1v committed Oct 22, 2021
1 parent 1345788 commit 4fc8bdb
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 7 deletions.
6 changes: 6 additions & 0 deletions app/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ executable('scrcpy', src,
c_args: [])

install_man('scrcpy.1')
install_data('../data/icon.svg',
rename: 'scrcpy.svg',
install_dir: 'share/icons/hicolor/scalable/apps')
install_data('../data/icon_256x256.png',
rename: 'scrcpy.png',
install_dir: 'share/icons/hicolor/256x256/apps')


### TESTS
Expand Down
6 changes: 4 additions & 2 deletions app/src/icon.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

static const char *const scrcpy_icons[] = {
#ifdef PORTABLE
NULL, // TODO
"icon.svg",
"icon.png",
#else
NULL, // TODO
PREFIX "/share/icons/hicolor/scalable/apps/scrcpy.svg"
PREFIX "/share/icons/hicolor/256x256/apps/scrcpy.png"
#endif
};

Expand Down
7 changes: 3 additions & 4 deletions app/src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
#include <SDL2/SDL.h>

#include "events.h"
#include "icon.xpm"
#include "icon.h"
#include "scrcpy.h"
#include "tiny_xpm.h"
#include "video_buffer.h"
#include "util/log.h"

Expand Down Expand Up @@ -405,10 +404,10 @@ screen_init(struct screen *screen, const struct screen_params *params) {
LOGD("Trilinear filtering disabled (not an OpenGL renderer)");
}

SDL_Surface *icon = read_xpm(icon_xpm);
SDL_Surface *icon = scrcpy_icon_load();
if (icon) {
SDL_SetWindowIcon(screen->window, icon);
SDL_FreeSurface(icon);
scrcpy_icon_destroy(icon);
} else {
LOGW("Could not load icon");
}
Expand Down
16 changes: 16 additions & 0 deletions data/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icon_256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ dist-win32: build-server build-win32
cp "$(WIN32_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN32_TARGET_DIR)/"
cp data/scrcpy-console.bat "$(DIST)/$(WIN32_TARGET_DIR)"
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN32_TARGET_DIR)"
cp data/icon_256x256.png "$(DIST)/$(WIN32_TARGET_DIR)/icon.png"
cp data/icon.svg "$(DIST)/$(WIN32_TARGET_DIR)"
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avutil-56.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avcodec-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
cp prebuilt-deps/ffmpeg-4.3.1-win32-shared/bin/avformat-58.dll "$(DIST)/$(WIN32_TARGET_DIR)/"
Expand All @@ -110,6 +112,8 @@ dist-win64: build-server build-win64
cp "$(WIN64_BUILD_DIR)"/app/scrcpy.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
cp data/scrcpy-console.bat "$(DIST)/$(WIN64_TARGET_DIR)"
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
cp data/icon_256x256.png "$(DIST)/$(WIN64_TARGET_DIR)/icon.png"
cp data/icon.svg "$(DIST)/$(WIN64_TARGET_DIR)"
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avcodec-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avformat-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
Expand Down
4 changes: 3 additions & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ then
exit 1
fi

SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" "$BUILDDIR/app/scrcpy" "$@"
SCRCPY_ICON_PATH="data/icon.svg" \
SCRCPY_SERVER_PATH="$BUILDDIR/server/scrcpy-server" \
"$BUILDDIR/app/scrcpy" "$@"

0 comments on commit 4fc8bdb

Please sign in to comment.