diff --git a/TeXmacs/misc/images/texmacs-128.png b/TeXmacs/misc/images/texmacs-128.png
deleted file mode 100644
index b88db3e68a..0000000000
Binary files a/TeXmacs/misc/images/texmacs-128.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-16.png b/TeXmacs/misc/images/texmacs-16.png
deleted file mode 100644
index 967c5c619e..0000000000
Binary files a/TeXmacs/misc/images/texmacs-16.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-192.png b/TeXmacs/misc/images/texmacs-192.png
deleted file mode 100644
index 0839ce5742..0000000000
Binary files a/TeXmacs/misc/images/texmacs-192.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-20.png b/TeXmacs/misc/images/texmacs-20.png
deleted file mode 100644
index 1a7f5be2fb..0000000000
Binary files a/TeXmacs/misc/images/texmacs-20.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-22.png b/TeXmacs/misc/images/texmacs-22.png
deleted file mode 100644
index de1fc47c2c..0000000000
Binary files a/TeXmacs/misc/images/texmacs-22.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-24.png b/TeXmacs/misc/images/texmacs-24.png
deleted file mode 100644
index a899d0baaf..0000000000
Binary files a/TeXmacs/misc/images/texmacs-24.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-256.png b/TeXmacs/misc/images/texmacs-256.png
deleted file mode 100644
index 77c0092a7f..0000000000
Binary files a/TeXmacs/misc/images/texmacs-256.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-32.png b/TeXmacs/misc/images/texmacs-32.png
deleted file mode 100644
index 80a3fe314b..0000000000
Binary files a/TeXmacs/misc/images/texmacs-32.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-36.png b/TeXmacs/misc/images/texmacs-36.png
deleted file mode 100644
index 63ad487120..0000000000
Binary files a/TeXmacs/misc/images/texmacs-36.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-40.png b/TeXmacs/misc/images/texmacs-40.png
deleted file mode 100644
index 389d740697..0000000000
Binary files a/TeXmacs/misc/images/texmacs-40.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-48.png b/TeXmacs/misc/images/texmacs-48.png
deleted file mode 100644
index 5fca674c5a..0000000000
Binary files a/TeXmacs/misc/images/texmacs-48.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-512.png b/TeXmacs/misc/images/texmacs-512.png
deleted file mode 100644
index 3e3604c626..0000000000
Binary files a/TeXmacs/misc/images/texmacs-512.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-64.png b/TeXmacs/misc/images/texmacs-64.png
deleted file mode 100644
index aced89a8f2..0000000000
Binary files a/TeXmacs/misc/images/texmacs-64.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-72.png b/TeXmacs/misc/images/texmacs-72.png
deleted file mode 100644
index bfc573ea41..0000000000
Binary files a/TeXmacs/misc/images/texmacs-72.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-96.png b/TeXmacs/misc/images/texmacs-96.png
deleted file mode 100644
index 248e963055..0000000000
Binary files a/TeXmacs/misc/images/texmacs-96.png and /dev/null differ
diff --git a/TeXmacs/misc/images/texmacs-document-128.png b/TeXmacs/misc/images/texmacs-document-128.png
new file mode 100644
index 0000000000..35e3cc32fd
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-128.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-16.png b/TeXmacs/misc/images/texmacs-document-16.png
new file mode 100644
index 0000000000..ac77fda111
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-16.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-192.png b/TeXmacs/misc/images/texmacs-document-192.png
new file mode 100644
index 0000000000..8ef3e8f203
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-192.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-20.png b/TeXmacs/misc/images/texmacs-document-20.png
new file mode 100644
index 0000000000..78cc4b98ae
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-20.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-22.png b/TeXmacs/misc/images/texmacs-document-22.png
new file mode 100644
index 0000000000..eb2b6ee292
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-22.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-24.png b/TeXmacs/misc/images/texmacs-document-24.png
new file mode 100644
index 0000000000..0a4f8c264f
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-24.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-256.png b/TeXmacs/misc/images/texmacs-document-256.png
new file mode 100644
index 0000000000..109cfb8a87
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-256.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-32.png b/TeXmacs/misc/images/texmacs-document-32.png
new file mode 100644
index 0000000000..2f4d55b5da
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-32.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-36.png b/TeXmacs/misc/images/texmacs-document-36.png
new file mode 100644
index 0000000000..d9a5e6b4af
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-36.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-40.png b/TeXmacs/misc/images/texmacs-document-40.png
new file mode 100644
index 0000000000..f7763a9463
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-40.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-48.png b/TeXmacs/misc/images/texmacs-document-48.png
new file mode 100644
index 0000000000..2a56a0839a
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-48.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-512.png b/TeXmacs/misc/images/texmacs-document-512.png
new file mode 100644
index 0000000000..9a5c6d6f60
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-512.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-64.png b/TeXmacs/misc/images/texmacs-document-64.png
new file mode 100644
index 0000000000..b70b4790c0
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-64.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-72.png b/TeXmacs/misc/images/texmacs-document-72.png
new file mode 100644
index 0000000000..e01cbac676
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-72.png differ
diff --git a/TeXmacs/misc/images/texmacs-document-96.png b/TeXmacs/misc/images/texmacs-document-96.png
new file mode 100644
index 0000000000..b84a08aade
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document-96.png differ
diff --git a/TeXmacs/misc/images/texmacs-document.png b/TeXmacs/misc/images/texmacs-document.png
new file mode 100644
index 0000000000..95fa58b411
Binary files /dev/null and b/TeXmacs/misc/images/texmacs-document.png differ
diff --git a/TeXmacs/misc/images/texmacs-document.svg b/TeXmacs/misc/images/texmacs-document.svg
new file mode 100644
index 0000000000..cfc8a49549
--- /dev/null
+++ b/TeXmacs/misc/images/texmacs-document.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/TeXmacs/misc/images/text-x-texmacs-128.png b/TeXmacs/misc/images/text-x-texmacs-128.png
deleted file mode 100644
index aff208a07e..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-128.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-16.png b/TeXmacs/misc/images/text-x-texmacs-16.png
deleted file mode 100644
index a6f24cf36b..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-16.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-192.png b/TeXmacs/misc/images/text-x-texmacs-192.png
deleted file mode 100644
index 28b0dfb0a2..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-192.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-20.png b/TeXmacs/misc/images/text-x-texmacs-20.png
deleted file mode 100644
index 4aad9e4166..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-20.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-22.png b/TeXmacs/misc/images/text-x-texmacs-22.png
deleted file mode 100644
index 835de460ab..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-22.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-24.png b/TeXmacs/misc/images/text-x-texmacs-24.png
deleted file mode 100644
index 5de60f1590..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-24.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-256.png b/TeXmacs/misc/images/text-x-texmacs-256.png
deleted file mode 100644
index 6571bea4dc..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-256.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-32.png b/TeXmacs/misc/images/text-x-texmacs-32.png
deleted file mode 100644
index 86467fae21..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-32.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-36.png b/TeXmacs/misc/images/text-x-texmacs-36.png
deleted file mode 100644
index 9ee495ffa6..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-36.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-40.png b/TeXmacs/misc/images/text-x-texmacs-40.png
deleted file mode 100644
index 9eaa2fc8e2..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-40.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-48.png b/TeXmacs/misc/images/text-x-texmacs-48.png
deleted file mode 100644
index 1aaed72184..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-48.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-512.png b/TeXmacs/misc/images/text-x-texmacs-512.png
deleted file mode 100644
index 113fc894b0..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-512.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-64.png b/TeXmacs/misc/images/text-x-texmacs-64.png
deleted file mode 100644
index 238b02e2a1..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-64.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-72.png b/TeXmacs/misc/images/text-x-texmacs-72.png
deleted file mode 100644
index 060c9df321..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-72.png and /dev/null differ
diff --git a/TeXmacs/misc/images/text-x-texmacs-96.png b/TeXmacs/misc/images/text-x-texmacs-96.png
deleted file mode 100644
index d3b2e092ea..0000000000
Binary files a/TeXmacs/misc/images/text-x-texmacs-96.png and /dev/null differ
diff --git a/TeXmacs/misc/mime/texmacs.xml b/TeXmacs/misc/mime/texmacs.xml
index 8803a7b9f7..e5af5cd11c 100644
--- a/TeXmacs/misc/mime/texmacs.xml
+++ b/TeXmacs/misc/mime/texmacs.xml
@@ -48,8 +48,8 @@
-
-
+
+
TeXmacs document
@@ -94,12 +94,17 @@
-
-
+
+
TMU document
TMU文档
-
+
+
+
+
+
+
diff --git a/devel/200_47.md b/devel/200_47.md
new file mode 100644
index 0000000000..60fd264427
--- /dev/null
+++ b/devel/200_47.md
@@ -0,0 +1,28 @@
+# [200_47] 修改软件专用后缀文件的图标
+## 如何测试
+- macos
+ - 本地打包
+ - 安装
+ - 清理Dock和Finder缓存
+ - `sudo rm -rf /Library/Caches/com.apple.iconservices.store`
+ - `killall Dock`
+ - `killall Finder`
+ - 将tmu文件默认打开方式更换为 mogan
+- windows
+ - 本地打包
+ - 安装
+- linux
+ - 本地打包
+ - 安装
+
+## 完成情况
+- [x] macos
+- [x] windows
+- [x] linux
+
+
+## 2026/02/05 更换图标文件,增加linux文档图标,macos 磁盘宗卷图标
+What?
+- 更新了图片资源
+- linux打包脚本优化
+
diff --git a/packages/debian/package.sh b/packages/debian/package.sh
index 76c579b055..8d4e4505e4 100755
--- a/packages/debian/package.sh
+++ b/packages/debian/package.sh
@@ -3,7 +3,7 @@
# ================= 配置部分 =================
APP_NAME="mogan-stem"
BINARY_NAME="moganstem"
-ARCH="amd64"
+ARCH=$(dpkg --print-architecture)
INSTALL_PREFIX="/opt/$APP_NAME"
# 图标源路径 (相对于项目根目录)
@@ -11,7 +11,7 @@ ICON_SOURCE_REL="3rdparty/qwindowkitty/src/styles/app/stem.png"
# 尝试获取 VERSION
if [ -z "$VERSION" ]; then
- VERSION="2025.2.3"
+ VERSION="2026.2.0"
else
echo "✅ 检测到版本号: $VERSION"
fi
@@ -44,44 +44,83 @@ if [ ! -f "$APP_DIR/usr/bin/$BINARY_NAME" ]; then
exit 1
fi
-# ================= 2. 处理图标 (直接复制 PNG) =================
+# ================= 2. 处理图标 (应用程序图标和 MIME 类型图标) =================
echo "🎨 [2/6] 处理图标文件..."
+
+# 2.1 应用程序图标
ICON_SRC="$APP_HOME/$ICON_SOURCE_REL"
-# 这里假设图标足够清晰,放入 256x256 目录(如果图标尺寸不同,Linux 也能显示,只是目录归类不太规范)
-ICON_DEST_DIR="$APP_DIR/usr/share/icons/hicolor/256x256/apps"
-mkdir -p "$ICON_DEST_DIR"
-
-if [ -f "$ICON_SRC" ]; then
- echo " -> 复制图标: $ICON_SRC"
- # 将图标重命名为 包名.png (mogan-stem.png)
- cp "$ICON_SRC" "$ICON_DEST_DIR/$APP_NAME.png"
- ICON_FINAL_NAME="$APP_NAME" # .desktop 文件里通常不需要写 .png 后缀
+# 只复制关键尺寸,减少不必要的复制
+KEY_ICON_SIZES="16 32 48 64 128 256 512"
+for size in $KEY_ICON_SIZES; do
+ ICON_DEST_DIR="$APP_DIR/usr/share/icons/hicolor/${size}x${size}/apps"
+ mkdir -p "$ICON_DEST_DIR"
+
+ if [ -f "$ICON_SRC" ]; then
+ echo " -> 复制应用程序图标 ${size}x${size}"
+ cp "$ICON_SRC" "$ICON_DEST_DIR/$APP_NAME.png"
+ else
+ echo "⚠️ 警告: 未找到应用程序图标源文件: $ICON_SRC"
+ touch "$ICON_DEST_DIR/$APP_NAME.png"
+ fi
+done
+
+# 2.2 MIME 类型图标 (用于 .tm, .tmu, .ts 文件)
+echo " -> 处理 MIME 类型图标..."
+MIME_ICON_SRC_DIR="$APP_HOME/TeXmacs/misc/images"
+MIME_ICON_NAME="texmacs-document"
+MIME_PNG_SRC="$MIME_ICON_SRC_DIR/$MIME_ICON_NAME.png"
+MIME_SVG_SRC="$MIME_ICON_SRC_DIR/$MIME_ICON_NAME.svg"
+
+if [ -f "$MIME_PNG_SRC" ] || [ -f "$MIME_SVG_SRC" ]; then
+ echo " -> 找到 MIME 类型图标源文件"
+
+ # 复制 PNG 图标到关键尺寸
+ if [ -f "$MIME_PNG_SRC" ]; then
+ for size in $KEY_ICON_SIZES; do
+ MIME_ICON_DEST_DIR="$APP_DIR/usr/share/icons/hicolor/${size}x${size}/mimetypes"
+ mkdir -p "$MIME_ICON_DEST_DIR"
+ cp "$MIME_PNG_SRC" "$MIME_ICON_DEST_DIR/$MIME_ICON_NAME.png"
+ done
+ fi
+
+ # 复制 SVG 图标
+ if [ -f "$MIME_SVG_SRC" ]; then
+ MIME_ICON_DEST_DIR="$APP_DIR/usr/share/icons/hicolor/scalable/mimetypes"
+ mkdir -p "$MIME_ICON_DEST_DIR"
+ cp "$MIME_SVG_SRC" "$MIME_ICON_DEST_DIR/$MIME_ICON_NAME.svg"
+ fi
+
+ echo " -> MIME 类型图标复制完成"
+else
+ echo "⚠️ 警告: 未找到 MIME 类型图标源文件: $MIME_ICON_SRC_DIR/$MIME_ICON_NAME.{png,svg}"
+fi
+
+# ================= 3. 确保 .desktop 文件存在并正确 =================
+DESKTOP_PATH="$APP_DIR/usr/share/applications/$APP_NAME.desktop"
+if [ ! -f "$DESKTOP_PATH" ]; then
+ echo "📄 [3/6] 生成 .desktop 文件..."
+ mkdir -p "$(dirname "$DESKTOP_PATH")"
+ cat > "$DESKTOP_PATH" < "$DESKTOP_PATH" < 更新现有 .desktop 文件的图标设置..."
-# sed -i "s|^Icon=.*|Icon=$ICON_FINAL_NAME|" "$DESKTOP_PATH"
-# fi
+ # 强制修正 Icon 字段,确保它使用我们刚才复制进去的图标名
+ echo " -> 更新现有 .desktop 文件的图标设置..."
+ sed -i "s|^Icon=.*|Icon=$APP_NAME|" "$DESKTOP_PATH"
+ # 确保Exec路径正确
+ sed -i "s|^Exec=.*|Exec=$BINARY_NAME|" "$DESKTOP_PATH"
+fi
# ================= 4. 准备工具 =================
@@ -140,10 +179,46 @@ mkdir -p "$DEB_BUILD_DIR$INSTALL_PREFIX"
# 移动内容到 /opt/mogan-stem
cp -r "$APP_DIR/usr/"* "$DEB_BUILD_DIR$INSTALL_PREFIX/"
-# 修正 Exec 路径为绝对路径
-TARGET_DESKTOP=$(find "$DEB_BUILD_DIR$INSTALL_PREFIX/share/applications" -name "*.desktop" | head -n 1)
-if [ -f "$TARGET_DESKTOP" ]; then
- sed -i "s|^Exec=.*|Exec=$INSTALL_PREFIX/bin/$BINARY_NAME|" "$TARGET_DESKTOP"
+# 移动 .desktop 文件到 /usr/share/applications/
+DESKTOP_SRC=$(find "$DEB_BUILD_DIR$INSTALL_PREFIX/share/applications" -name "*.desktop" | head -n 1)
+if [ -f "$DESKTOP_SRC" ]; then
+ mkdir -p "$DEB_BUILD_DIR/usr/share/applications"
+ DESKTOP_DEST="$DEB_BUILD_DIR/usr/share/applications/$(basename "$DESKTOP_SRC")"
+ cp "$DESKTOP_SRC" "$DESKTOP_DEST"
+ # 修正 Exec 路径为绝对路径
+ sed -i "s|^Exec=.*|Exec=$INSTALL_PREFIX/bin/$BINARY_NAME|" "$DESKTOP_DEST"
+ # 删除原始位置的文件
+ rm "$DESKTOP_SRC"
+fi
+
+# 移动图标文件到 /usr/share/icons/
+ICON_SRC_DIR="$DEB_BUILD_DIR$INSTALL_PREFIX/share/icons"
+if [ -d "$ICON_SRC_DIR" ]; then
+ mkdir -p "$DEB_BUILD_DIR/usr/share/icons"
+ # 只复制hicolor目录,保留MIME图标
+ if [ -d "$ICON_SRC_DIR/hicolor" ]; then
+ cp -r "$ICON_SRC_DIR/hicolor" "$DEB_BUILD_DIR/usr/share/icons/"
+ fi
+ rm -rf "$ICON_SRC_DIR"
+fi
+
+# 移动 MIME 文件到 /usr/share/mime/
+MIME_SRC_DIR="$DEB_BUILD_DIR$INSTALL_PREFIX/share/mime"
+if [ -d "$MIME_SRC_DIR" ]; then
+ mkdir -p "$DEB_BUILD_DIR/usr/share/mime"
+ cp -r "$MIME_SRC_DIR/"* "$DEB_BUILD_DIR/usr/share/mime/"
+ rm -rf "$MIME_SRC_DIR"
+else
+ # 如果 xmake install 没有安装 MIME 文件,手动复制
+ echo " -> 手动复制 MIME 类型定义文件..."
+ MIME_SRC_FILE="$APP_HOME/TeXmacs/misc/mime/texmacs.xml"
+ if [ -f "$MIME_SRC_FILE" ]; then
+ mkdir -p "$DEB_BUILD_DIR/usr/share/mime/packages"
+ cp "$MIME_SRC_FILE" "$DEB_BUILD_DIR/usr/share/mime/packages/"
+ echo " -> 已复制 MIME 类型定义文件"
+ else
+ echo "⚠️ 警告: 未找到 MIME 类型定义文件: $MIME_SRC_FILE"
+ fi
fi
# 生成 Control
@@ -161,7 +236,109 @@ Description: Mogan Stem
Installed in $INSTALL_PREFIX.
EOF
+# 生成 post-install 脚本,更新 MIME 数据库和创建命令行别名
+cat > "$DEB_BUILD_DIR/DEBIAN/postinst" </dev/null 2>&1; then
+ if ! update-mime-database /usr/share/mime; then
+ echo "Error: Failed to update MIME database" >&2
+ else
+ echo "MIME database updated"
+ fi
+else
+ echo "Warning: update-mime-database command not found"
+fi
+
+echo "Updating desktop icon cache..."
+if command -v gtk-update-icon-cache >/dev/null 2>&1; then
+ if ! gtk-update-icon-cache -f /usr/share/icons/hicolor; then
+ echo "Error: Failed to update GTK icon cache" >&2
+ else
+ echo "GTK icon cache updated"
+ fi
+else
+ echo "Warning: gtk-update-icon-cache command not found"
+fi
+
+if command -v kbuildsycoca5 >/dev/null 2>&1; then
+ if ! kbuildsycoca5 --noincremental; then
+ echo "Error: Failed to update KDE system configuration cache" >&2
+ else
+ echo "KDE system configuration cache updated"
+ fi
+elif command -v kbuildsycoca6 >/dev/null 2>&1; then
+ if ! kbuildsycoca6 --noincremental; then
+ echo "Error: Failed to update KDE system configuration cache" >&2
+ else
+ echo "KDE system configuration cache updated"
+ fi
+fi
+
+echo "Creating command-line alias..."
+# Create command-line alias so users can run mogan-stem directly
+BINARY_PATH="/opt/mogan-stem/bin/moganstem"
+ALIAS_NAME="mogan-stem"
+TARGET_LINK="/usr/local/bin/\$ALIAS_NAME"
+
+if [ -f "\$BINARY_PATH" ] && [ -x "\$BINARY_PATH" ]; then
+ # Create symbolic link in /usr/local/bin
+ if [ -d "/usr/local/bin" ]; then
+ if [ -L "\$TARGET_LINK" ]; then
+ # 如果是符号链接,安全覆盖
+ ln -sf "\$BINARY_PATH" "\$TARGET_LINK"
+ echo " -> Updated existing symlink: mogan-stem"
+ echo " (symlink: /usr/local/bin/mogan-stem -> /opt/mogan-stem/bin/moganstem)"
+ elif [ -e "\$TARGET_LINK" ]; then
+ # 如果是普通文件,警告用户
+ echo " -> Warning: \$TARGET_LINK already exists and is not a symlink"
+ echo " Skipping alias creation to avoid overwriting user file"
+ echo " You can manually create symlink: ln -s /opt/mogan-stem/bin/moganstem /usr/local/bin/mogan-stem"
+ else
+ # 文件不存在,安全创建
+ ln -s "\$BINARY_PATH" "\$TARGET_LINK"
+ echo " -> Created command-line alias: mogan-stem"
+ echo " (symlink: /usr/local/bin/mogan-stem -> /opt/mogan-stem/bin/moganstem)"
+ fi
+ else
+ echo " -> Warning: /usr/local/bin directory does not exist"
+ fi
+else
+ echo " -> Error: Binary not found or not executable: \$BINARY_PATH" >&2
+fi
+
+echo "Installation complete! You can now:"
+echo " 1. Run from terminal: mogan-stem (if alias was created)"
+echo " 2. Launch from application menu: Mogan Stem"
+echo " 3. Double-click .tm, .tmu, .ts files to open with Mogan Stem"
+EOF
+
+chmod 755 "$DEB_BUILD_DIR/DEBIAN/postinst"
+
+# 生成 pre-remove 脚本,清理符号链接
+cat > "$DEB_BUILD_DIR/DEBIAN/prerm" < Removed command-line alias: mogan-stem"
+fi
+EOF
+
+chmod 755 "$DEB_BUILD_DIR/DEBIAN/prerm"
+
OUTPUT_DEB="${APP_HOME}/../${APP_NAME}_${VERSION}_${ARCH}.deb"
dpkg-deb --build "$DEB_BUILD_DIR" "$OUTPUT_DEB"
-echo "✅ 打包完成: $OUTPUT_DEB"
\ No newline at end of file
+# 设置适当的权限,避免安装时出现 _apt 用户权限警告
+chmod 644 "$OUTPUT_DEB"
+
+echo "✅ 打包完成: $OUTPUT_DEB"
+echo "💡 安装命令: sudo dpkg -i \"$OUTPUT_DEB\""
diff --git a/packages/macos/TeXmacs-document.icns b/packages/macos/TeXmacs-document.icns
index 22fbd8ef71..529b2b053f 100644
Binary files a/packages/macos/TeXmacs-document.icns and b/packages/macos/TeXmacs-document.icns differ
diff --git a/packages/macos/TeXmacs-document.psd b/packages/macos/TeXmacs-document.psd
deleted file mode 100644
index ed3ecfe367..0000000000
Binary files a/packages/macos/TeXmacs-document.psd and /dev/null differ
diff --git a/packages/macos/driver.icns b/packages/macos/driver.icns
new file mode 100644
index 0000000000..03d7ae308b
Binary files /dev/null and b/packages/macos/driver.icns differ
diff --git a/packages/windows/TeXmacs.ico b/packages/windows/TeXmacs.ico
index 8ef7fb2066..406034281d 100644
Binary files a/packages/windows/TeXmacs.ico and b/packages/windows/TeXmacs.ico differ
diff --git a/packages/windows/generate_ico.sh b/packages/windows/generate_ico.sh
deleted file mode 100644
index f8dda24a58..0000000000
--- a/packages/windows/generate_ico.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/bash
-
-# convert TeXmacs/misc/images/xmacs-256.png -define icon:auto-resize=256,64,48,32,16 packages/windows/Xmacs.ico
-convert TeXmacs/misc/images/new-mogan-512.png -define icon:auto-resize=256,64,48,32,16 packages/windows/Xmacs.ico
-convert TeXmacs/misc/images/texmacs-512.png -define icon:auto-resize=256,64,48,32,16 packages/windows/TeXmacs.ico
diff --git a/packages/windows/research.nsis b/packages/windows/research.nsis
index faa7df9d65..70b2851065 100644
--- a/packages/windows/research.nsis
+++ b/packages/windows/research.nsis
@@ -352,6 +352,10 @@ Function CleanupOldVersionRegistry
; Clean up file associations
DeleteRegKey HKCR "Applications\MGResearch.exe"
DeleteRegKey HKCR "Applications\${PACKAGE_NAME}.exe"
+ DeleteRegKey HKCR ".tmu"
+ DeleteRegKey HKCR ".tm"
+ DeleteRegKey HKCR ".ts"
+ DeleteRegKey HKCR "TeXmacs.Document"
FunctionEnd
Section "${PACKAGE_NAME} (required)" InstallExecutable
@@ -436,6 +440,11 @@ Section "Uninstall"
DeleteRegKey HKCR "Applications\MGResearch.exe"
; delete register key for Mogan Research
DeleteRegKey HKCR "Applications\${PACKAGE_NAME}.exe"
+ ; delete file extension registrations
+ DeleteRegKey HKCR ".tmu"
+ DeleteRegKey HKCR ".tm"
+ DeleteRegKey HKCR ".ts"
+ DeleteRegKey HKCR "TeXmacs.Document"
; add uninstall commands
${PACKAGE_UNINSTALLCMDS}
@@ -463,6 +472,15 @@ SectionEnd
Section "File Associations" SEC02
WriteRegExpandStr HKCR "Applications\${PACKAGE_NAME}.exe\shell\open\command" "" '"$INSTDIR\bin\${PACKAGE_NAME}.exe" "%1"'
+
+ ; Register file extensions with TeXmacs.ico icon
+ WriteRegStr HKCR ".tmu" "" "TeXmacs.Document"
+ WriteRegStr HKCR ".tm" "" "TeXmacs.Document"
+ WriteRegStr HKCR ".ts" "" "TeXmacs.Document"
+
+ WriteRegStr HKCR "TeXmacs.Document" "" "TeXmacs Document"
+ WriteRegStr HKCR "TeXmacs.Document\DefaultIcon" "" "$INSTDIR\TeXmacs.ico"
+ WriteRegStr HKCR "TeXmacs.Document\shell\open\command" "" '"$INSTDIR\bin\${PACKAGE_NAME}.exe" "%1"'
SectionEnd
Section "Check and Install Visual C++ Redistributables" SEC03
diff --git a/xmake.lua b/xmake.lua
index 23bd246d44..fb4456a5b9 100644
--- a/xmake.lua
+++ b/xmake.lua
@@ -876,6 +876,9 @@ if is_plat("windows") then
add_configfiles("$(projectdir)/packages/windows/Xmacs.ico", {
onlycopy = true
})
+ add_configfiles("$(projectdir)/packages/windows/TeXmacs.ico", {
+ onlycopy = true
+ })
add_files("$(buildir)/resource.rc")
end
end
@@ -909,6 +912,7 @@ target("stem") do
if is_plat("windows") then
add_installfiles(stem_files)
+ add_installfiles(path.join(os.projectdir(), "packages/windows/TeXmacs.ico"), {prefixdir = ""})
else
add_installfiles(stem_files, {prefixdir=stem_prefix_dir})
end
@@ -920,10 +924,18 @@ target("stem") do
end
if is_plat("linux") then
- -- add_installfiles("$(projectdir)/TeXmacs/misc/images/text-x-mogan.svg", {prefixdir="share/icons/hicolor/scalable/mimetypes"})
add_installfiles("$(projectdir)/TeXmacs/misc/mime/" .. stem_binary_name .. ".desktop", {prefixdir="share/applications"})
add_installfiles("$(projectdir)/TeXmacs/misc/images/" .. stem_binary_name .. ".png", {prefixdir="share/icons/hicolor/512x512/apps"})
- -- add_installfiles("$(projectdir)/TeXmacs/misc/mime/mogan.xml", {prefixdir="share/mime/packages"})
+
+ add_installfiles("$(projectdir)/TeXmacs/misc/images/texmacs-document.svg", {prefixdir="share/icons/hicolor/scalable/mimetypes"})
+
+ local mime_icon_sizes = {"16", "20", "22", "24", "32", "36", "40", "48", "64", "72", "96", "128", "192", "256", "512"}
+ for _, size in ipairs(mime_icon_sizes) do
+ add_installfiles("$(projectdir)/TeXmacs/misc/images/texmacs-document-" .. size .. ".png",
+ {prefixdir="share/icons/hicolor/" .. size .. "x" .. size .. "/mimetypes"})
+ end
+
+ add_installfiles("$(projectdir)/TeXmacs/misc/mime/texmacs.xml", {prefixdir="share/mime/packages"})
end
@@ -1058,7 +1070,34 @@ target("stem") do
target:add("forceincludes", path.absolute("src/System/config.h"))
target:add("forceincludes", path.absolute("src/System/tm_configure.hpp"))
end)
-end
+
+ -- After install callback for Linux to rename MIME icon files
+ after_install(function (target, opt)
+ if is_plat("linux") then
+ local install_dir = target:installdir()
+ local mime_icon_sizes = {"16", "20", "22", "24", "32", "36", "40", "48", "64", "72", "96", "128", "192", "256", "512"}
+
+ -- Rename texmacs-document-{size}.png to texmacs-document.png in each size directory
+ for _, size in ipairs(mime_icon_sizes) do
+ local src_file = path.join(install_dir, "share/icons/hicolor", size .. "x" .. size, "mimetypes", "texmacs-document-" .. size .. ".png")
+ local dst_file = path.join(install_dir, "share/icons/hicolor", size .. "x" .. size, "mimetypes", "texmacs-document.png")
+
+ if os.isfile(src_file) then
+ os.cp(src_file, dst_file)
+ os.rm(src_file)
+ print("Renamed MIME icon: " .. src_file .. " -> " .. dst_file)
+ end
+ end
+
+ -- Also rename the SVG file if needed (should already be correct name)
+ local svg_src = path.join(install_dir, "share/icons/hicolor/scalable/mimetypes", "texmacs-document.svg")
+ if os.isfile(svg_src) then
+ -- SVG file should already have correct name
+ print("SVG MIME icon installed at: " .. svg_src)
+ end
+ end
+ end)
+end
function add_target_integration_test(filepath, INSTALL_DIR, RUN_ENVS)
local testname = path.basename(filepath)
@@ -1146,6 +1185,8 @@ target("stem_packager") do
local resources_dir = app_dir .. "/Contents/Resources"
os.cp(path.join(project_dir, "packages", "macos", "stem.icns"), resources_dir)
os.cp(path.join(project_dir, "packages", "macos", "TeXmacs-document.icns"), resources_dir)
+ -- 复制DMG相关的图标到build目录,供create-dmg使用
+ os.cp(path.join(project_dir, "packages", "macos", "driver.icns"), build_dir)
print("Copied icon files to: " .. resources_dir)
os.execv("codesign", {"--force", "--deep", "--sign", "-", app_dir})
@@ -1206,6 +1247,7 @@ target("stem_packager") do
-- 检查背景图片
local background_image = path.join(project_dir, "packages", "macos", stem_dmg_bg_name_local)
local args_with_bg = {
+ "--volicon", "driver.icns",
"--background", background_image,
"--volname", stem_project_name_local,
"--window-pos", "200", "120",
@@ -1217,6 +1259,7 @@ target("stem_packager") do
app_path
}
local args_no_bg = {
+ "--volicon", "driver.icns",
"--volname", stem_project_name_local,
"--window-pos", "200", "120",
"--window-size", "720", "480",
@@ -1284,8 +1327,10 @@ xpack("stem") do
set_iconfile(path.join(os.projectdir(), "packages/windows/Xmacs.ico"))
set_bindir("bin")
add_installfiles(path.join(os.projectdir(), "build/packages/stem/data/bin/(**)|" .. stem_binary_windows), {prefixdir = "bin"})
+ add_installfiles(path.join(os.projectdir(), "packages/windows/TeXmacs.ico"), {prefixdir = "."})
end
+
set_basename(stem_binary_name)
add_targets("stem")