aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src-tauri/scripts/fix-appimage.sh
blob: 6bb375be613537f440c473f99b0c536f36bf75a8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# fix AppImage for Wayland compatibility
# This script modifies the AppImage bundle created by Tauri to ensure compatibility with Wayland
# It specifically targets the GTK backend settings to avoid forcing X11

set -e

echo "Fixing AppImage for Wayland compatibility..."

# Tauri sets the APPIMAGE_BUNDLE_PATH environment variable during the build process
APPDIR_PATH="${APPIMAGE_BUNDLE_PATH:-}"

if [ -z "$APPDIR_PATH" ]; then
    echo "No AppImage bundle path found, skipping fix"
    exit 0
fi

# Check for the presence of the GTK hook file
if [ -d "$APPDIR_PATH/apprun-hooks" ]; then
    HOOK_FILE="$APPDIR_PATH/apprun-hooks/linuxdeploy-plugin-gtk.sh"
    
    if [ -f "$HOOK_FILE" ]; then
        echo "Found GTK hook file, patching..."
        
        # Comment out the line that forces GDK_BACKEND to x11
        sed -i 's/^export GDK_BACKEND=x11.*$/# export GDK_BACKEND=x11  # Disabled for Wayland compatibility/' "$HOOK_FILE"
        
        echo "Successfully patched $HOOK_FILE"
    fi
fi

echo "AppImage Wayland fix completed!"