diff --git a/spark-dwine-helper/s-wine-helper/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher b/spark-dwine-helper/s-wine-helper/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher new file mode 100755 index 0000000..887bd4d --- /dev/null +++ b/spark-dwine-helper/s-wine-helper/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher @@ -0,0 +1,48 @@ + #!/bin/bash + +# ===== Log Functions with Colors ===== +log.warn() { echo -e "[\e[33mWARN\e[0m]: \e[1m$*\e[0m"; } +log.error() { echo -e "[\e[31mERROR\e[0m]: \e[1m$*\e[0m"; } +log.info() { echo -e "[\e[96mINFO\e[0m]: \e[1m$*\e[0m"; } +log.debug() { echo -e "[\e[32mDEBUG\e[0m]: \e[1m$*\e[0m"; } + +# Zenity wrapper function +gui_dialog() { + if command -v garma &>/dev/null; then + garma "$@" + else + zenity "$@" + fi +} + +# Check if no arguments were passed +if [[ $# -eq 0 ]]; then + gui_dialog --info --text="使用方法:\nUsage:\n\nspark-wine \n\n请提供要运行的 Windows 应用程序。\nPlease provide the Windows application to run." + exit 1 +fi + +# Check if spark-wine is installed +if ! command -v spark-wine &>/dev/null; then + gui_dialog --question --text="您尚未安装 spark-wine ,是否安装以运行 Windows 应用?\nYou haven't installed spark-wine yet. Would you like to install it to run Windows applications?" + if [[ $? -ne 0 ]]; then + log.error "User refused to install. Exiting." + exit 1 + fi + + +# Install spark-wine with progress indicator +pkexec bash -c "aptss update && aptss install spark-wine spark-wine-mono -y" | gui_dialog --progress --pulsate --auto-close --no-cancel --text="正在安装,请保持网络畅通,耐心等待\nInstalling, please keep network connection and wait patiently" +INSTALL_STATUS=${PIPESTATUS[0]} + +# Check the installation status correctly +if [[ $INSTALL_STATUS -ne 0 ]]; then + gui_dialog --error --text="安装出错,请手动执行以下指令查看错误并反馈:\nError occurred during installation. Please execute the command below to view the error log:\n\nsudo aptss install spark-wine spark-wine-mono -y" + exit 1 +fi + + +fi + +# Run spark-wine with WINEPREFIX +export WINEPREFIX="$HOME/.wine" +spark-wine "$@" diff --git a/spark-dwine-helper/s-wine-helper/usr/bin/spark-wine-launcher b/spark-dwine-helper/s-wine-helper/usr/bin/spark-wine-launcher new file mode 120000 index 0000000..9ff2dd3 --- /dev/null +++ b/spark-dwine-helper/s-wine-helper/usr/bin/spark-wine-launcher @@ -0,0 +1 @@ +../../opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher \ No newline at end of file diff --git a/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-launcher.desktop b/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-launcher.desktop index 7d96b92..235ed85 100644 --- a/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-launcher.desktop +++ b/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-launcher.desktop @@ -1,12 +1,12 @@ [Desktop Entry] Categories=Utility; Encoding=UTF-8 -Exec=bash -c "/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/settings.sh" -Icon=spark-dwine-helper +Exec=bash -c "/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher %F" +Icon=spark-wine-launcher MimeType= -Name=Launch Custom Windows App -Name[zh_CN]=启动自定义Windows应用 -StartupWMClass=spark-dwine-helper +Name=Launch Windows App +Name[zh_CN]=启动Windows应用 +StartupWMClass=spark-wine-launcher Terminal=False Type=Application NoDisplay=false diff --git a/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-uninstaller.desktop b/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-uninstaller.desktop index c3d5e3d..6878fb3 100644 --- a/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-uninstaller.desktop +++ b/spark-dwine-helper/s-wine-helper/usr/share/applications/spark-dwine-helper-app-uninstaller.desktop @@ -1,12 +1,12 @@ [Desktop Entry] Categories=Utility; Encoding=UTF-8 -Exec=bash -c "/opt/spark-dwine-helper/spark-dwine-helper/wine-app-settings/settings.sh" -Icon=spark-dwine-helper +Exec=bash -c "/opt/spark-dwine-helper/spark-dwine-helper/wine-app-launcher/spark-wine-launcher uninstaller" +Icon=spark-wine-uninstaller MimeType= -Name=Uninstall Custom Windows App -Name[zh_CN]=卸载自定义Windows应用 -StartupWMClass=spark-dwine-helper +Name=Uninstall Windows App +Name[zh_CN]=卸载Windows应用 +StartupWMClass=spark-wine-uninstaller Terminal=False Type=Application NoDisplay=false diff --git a/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-launcher.svg b/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-launcher.svg new file mode 100644 index 0000000..7e15f25 --- /dev/null +++ b/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-launcher.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-uninstaller.svg b/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-uninstaller.svg new file mode 100644 index 0000000..4019458 --- /dev/null +++ b/spark-dwine-helper/s-wine-helper/usr/share/icons/hicolor/scalable/apps/spark-wine-uninstaller.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + +