SCRCPY_ICON_DIR

This commit is contained in:
Romain Vimont
2026-01-17 22:06:09 +01:00
parent d9669a2610
commit 72a2ae3224
5 changed files with 16 additions and 14 deletions

View File

@@ -1249,8 +1249,8 @@ static const struct sc_envvar envvars[] = {
"--tcpip=<addr>) is specified",
},
{
.name = "SCRCPY_ICON_PATH",
.text = "Path to the program icon",
.name = "SCRCPY_ICON_DIR",
.text = "Path to the icon directory",
},
{
.name = "SCRCPY_SERVER_PATH",

View File

@@ -14,21 +14,23 @@
#include "config.h"
#include "util/env.h"
#ifdef PORTABLE
# include "util/file.h"
#endif
#include "util/file.h"
#include "util/log.h"
#define SCRCPY_PORTABLE_ICON_FILENAME "scrcpy.png"
#define SCRCPY_ICON_FILENAME "scrcpy.png"
#define SCRCPY_DEFAULT_ICON_PATH \
PREFIX "/share/icons/hicolor/256x256/apps/scrcpy.png"
static char *
get_icon_path(void) {
char *icon_path = sc_get_env("SCRCPY_ICON_PATH");
if (icon_path) {
char *icon_path;
char *icon_dir = sc_get_env("SCRCPY_ICON_DIR");
if (icon_dir) {
// if the envvar is set, use it
LOGD("Using SCRCPY_ICON_PATH: %s", icon_path);
icon_path = sc_file_build_path(icon_dir, SCRCPY_ICON_FILENAME);
free(icon_dir);
LOGD("Using icon from SCRCPY_ICON_DIR: %s", icon_path);
return icon_path;
}
@@ -40,7 +42,7 @@ get_icon_path(void) {
return NULL;
}
#else
icon_path = sc_file_get_local_path(SCRCPY_PORTABLE_ICON_FILENAME);
icon_path = sc_file_get_local_path(SCRCPY_ICON_FILENAME);
if (!icon_path) {
LOGE("Could not get icon path");
return NULL;