Improve tray icon images (#1736)

This commit is contained in:
ns6089 2023-10-15 20:18:11 +03:00 committed by GitHub
parent adcf2cd5a3
commit a003f02ec3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 67 additions and 6 deletions

View File

@ -69,7 +69,7 @@ source_suffix = ['.rst', '.md']
# -- Options for HTML output -------------------------------------------------
# images
html_favicon = os.path.join(root_dir, 'src_assets', 'common', 'assets', 'web', 'images', 'favicon.ico')
html_favicon = os.path.join(root_dir, 'src_assets', 'common', 'assets', 'web', 'images', 'sunshine.ico')
html_logo = os.path.join(root_dir, 'sunshine.png')
# Add any paths that contain custom static files (such as style sheets) here,

View File

@ -0,0 +1,61 @@
#!/bin/bash
if ! [ -x "$(command -v ./go-png2ico)" ]; then
echo "./go-png2ico not found"
echo "download the executable from https://github.com/J-Siu/go-png2ico"
echo "and drop it in this folder"
exit 1
fi
if ! [ -x "$(command -v ./oxipng)" ]; then
echo "./oxipng executable not found"
echo "download the executable from https://github.com/shssoichiro/oxipng"
echo "and drop it in this folder"
exit 1
fi
if ! [ -x "$(command -v inkscape)" ]; then
echo "inkscape executable not found"
exit 1
fi
icon_base_sizes=(16 64)
icon_sizes_keys=() # associative array to prevent duplicates
icon_sizes_keys[256]=1
for icon_base_size in ${icon_base_sizes[@]}; do
# increment in 25% till 400%
icon_size_increment=$((icon_base_size / 4))
for ((i = 0; i <= 12; i++)); do
icon_sizes_keys[$((icon_base_size + i * icon_size_increment))]=1
done
done
# convert to normal array
icon_sizes=${!icon_sizes_keys[@]}
echo "using icon sizes:"
echo ${icon_sizes[@]}
src_vectors=("../../src_assets/common/assets/web/images/sunshine-locked.svg"
"../../src_assets/common/assets/web/images/sunshine-pausing.svg"
"../../src_assets/common/assets/web/images/sunshine-playing.svg"
"../../sunshine.svg")
echo "using sources vectors:"
echo ${src_vectors[@]}
for src_vector in ${src_vectors[@]}; do
file_name=`basename "$src_vector" .svg`
png_files=()
for icon_size in ${icon_sizes[@]}; do
png_file="${file_name}${icon_size}.png"
echo "converting ${png_file}"
inkscape -w $icon_size -h $icon_size "$src_vector" --export-filename "${png_file}" &&
./oxipng -o max --strip safe --alpha "${png_file}" &&
png_files+=("${png_file}")
done
echo "packing ${file_name}.ico"
./go-png2ico "${png_files[@]}" "${file_name}.ico"
done

View File

@ -267,7 +267,7 @@ namespace confighttp {
// todo - use mime_types map
print_req(request);
std::ifstream in(WEB_DIR "images/favicon.ico", std::ios::binary);
std::ifstream in(WEB_DIR "images/sunshine.ico", std::ios::binary);
SimpleWeb::CaseInsensitiveMultimap headers;
headers.emplace("Content-Type", "image/x-icon");
response->write(SimpleWeb::StatusCode::success_ok, in, headers);
@ -755,7 +755,7 @@ namespace confighttp {
server.resource["^/api/clients/unpair$"]["POST"] = unpairAll;
server.resource["^/api/apps/close$"]["POST"] = closeApp;
server.resource["^/api/covers/upload$"]["POST"] = uploadCover;
server.resource["^/images/favicon.ico$"]["GET"] = getFaviconImage;
server.resource["^/images/sunshine.ico$"]["GET"] = getFaviconImage;
server.resource["^/images/logo-sunshine-45.png$"]["GET"] = getSunshineLogoImage;
server.resource["^/node_modules\\/.+$"]["GET"] = getNodeModules;
server.config.reuse_address = true;

View File

@ -9,7 +9,7 @@
#define WIN32_LEAN_AND_MEAN
#include <accctrl.h>
#include <aclapi.h>
#define TRAY_ICON WEB_DIR "images/favicon.ico"
#define TRAY_ICON WEB_DIR "images/sunshine.ico"
#define TRAY_ICON_PLAYING WEB_DIR "images/sunshine-playing.ico"
#define TRAY_ICON_PAUSING WEB_DIR "images/sunshine-pausing.ico"
#define TRAY_ICON_LOCKED WEB_DIR "images/sunshine-locked.ico"

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sunshine</title>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico">
<link rel="icon" type="image/x-icon" href="/images/sunshine.ico">
<link href="/node_modules/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
<script src="/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

2
third-party/tray vendored

@ -1 +1 @@
Subproject commit 0b1aa15dbc7bdfaeb2c3a7551e0117f603fa4d0f
Subproject commit 2664388b0ed88234674a37f8cd569747522247b4