增加Linux图标功能,增加Linux下批量打包功能

This commit is contained in:
Tlntin
2022-11-18 18:32:19 +08:00
parent 0a157bea04
commit 6939518c2d
46 changed files with 76 additions and 2 deletions

38
build.sh Executable file
View File

@@ -0,0 +1,38 @@
#!/bin/bash
if [ ! -d "node_modules" ]; then
npm i
fi
# 依次填入app名称链接
# Fill in the app name and link in turn
app_list=(
"weRead weread.qq.com"
"aliyuque www.yuque.com"
"flomo flomoapp.com"
"weRead weread.qq.com"
)
old_name="weRead"
old_url="weread.qq.com"
for app_info in "${app_list[@]}"; do
array=($app_info)
package_name=${array[0]}
url=${array[1]}
echo "update package name and url"
# replace package info
sed -i "s/${old_url}/${url}/g" src-tauri/tauri.conf.json
sed -i "s/${old_name}/${package_name}/g" src-tauri/tauri.conf.json
# update package info
old_name=${package_name}
old_url=${url}
echo "update ico with 32x32 pictue"
cp "src-tauri/png/${package_name}_32.png" "src-tauri/icons/icon.ico"
echo "build deb/appImage package for Linux x86-64"
echo "package name is ${package_name}"
npm run build:linux
echo "package build success!"
done

35
icns2png.py Normal file
View File

@@ -0,0 +1,35 @@
"""
批量将icns文件转成png文件
Batch convert ICNS files to PNG files
"""
import os
try:
from PIL import Image
except ImportError:
os.system("pip install Pillow")
from PIL import Image
if __name__ == "__main__":
now_dir = os.path.dirname(os.path.abspath(__file__))
icons_dir = os.path.join(now_dir, "src-tauri", "icons")
png_dir = os.path.join(now_dir, "src-tauri", "png")
if not os.path.exists(png_dir):
os.mkdir(png_dir)
file_list = os.listdir(icons_dir)
file_list = [file for file in file_list if file.endswith(".icns")]
for file in file_list:
icns_path = os.path.join(icons_dir, file)
image = Image.open(icns_path)
image_512 = image.copy().resize((512, 512))
image_32 = image.copy().resize((32, 32))
image_name = os.path.splitext(file)[0]
image_512_path = os.path.join(png_dir, image_name + "_512.png")
image_32_path = os.path.join(png_dir, image_name + "_32.png")
image_512.save(image_512_path, "PNG")
image_32.save(image_32_path, "PNG")
print("png file write success.")
print(f"There are {len(os.listdir(png_dir))} png picture in ", png_dir)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
src-tauri/png/code_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src-tauri/png/code_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

BIN
src-tauri/png/fanfou_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

BIN
src-tauri/png/flomo_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src-tauri/png/flomo_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

BIN
src-tauri/png/fone_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src-tauri/png/fone_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
src-tauri/png/jdread_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src-tauri/png/jike_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 B

BIN
src-tauri/png/jike_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
src-tauri/png/notion_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 874 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

BIN
src-tauri/png/roam_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
src-tauri/png/roam_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

BIN
src-tauri/png/tool_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
src-tauri/png/tool_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
src-tauri/png/v2ex_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
src-tauri/png/v2ex_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

BIN
src-tauri/png/vercel_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

BIN
src-tauri/png/weRead_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
src-tauri/png/yuque_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
src-tauri/png/yuque_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

View File

@@ -1,6 +1,6 @@
{
"package": {
"productName": "WeRead",
"productName": "weRead",
"version": "0.2.0"
},
"tauri": {
@@ -20,7 +20,8 @@
"bundle": {
"icon": [
"icons/weRead.icns",
"icons/icon.ico"
"icons/icon.ico",
"png/weRead_512.png"
],
"identifier": "com.tw93.weRead",
"active": true,