Skip to content

Commit 27cf249

Browse files
committed
fix: icon not shown in task manager in ubuntu 24.04
1 parent 43bf9a1 commit 27cf249

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

docs/linux/installer.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ DESKTOP_APP_NAME="Phoenix Code"
1414
DESKTOP_ENTRY="$DESKTOP_DIR/$DESKTOP_ENTRY_NAME"
1515
SCRIPT_NAME="phcode" # Name of the script to invoke the binary
1616
BINARY_NAME="phoenix-code"
17+
# STARTUP_WM_CLASS is set to the binary name and used as the application's class name in the desktop file.
18+
# This class name helps the desktop environment manage application windows. If native libraries are missing
19+
# and the application needs to be launched via a script instead of directly, this variable is updated
20+
# accordingly before the desktop file is created.
21+
STARTUP_WM_CLASS=$BINARY_NAME
22+
1723

1824
declare -a MIME_TYPES=(
1925
"text/html"
@@ -384,19 +390,20 @@ create_launch_script_with_gtk() {
384390

385391
local binary_path="$1"
386392
local binary_name="$BINARY_NAME"
387-
388-
local realBin="$binary_path/$binary_name.app"
393+
local original_bin=$binary_name.app
394+
local realBin="$binary_path/$original_bin"
389395
mv "$binary_path/$binary_name" "$realBin"
390396
echo "Creating a launch script for Phoenix Code with GTK libraries..."
391397
cat > "$binary_path/$binary_name" <<EOF
392398
#!/bin/bash
393399
SCRIPT_DIR=\$(dirname "\$(readlink -f "\$0")")
394400
export LD_LIBRARY_PATH=\$SCRIPT_DIR/gtk:\$LD_LIBRARY_PATH
395-
exec \$SCRIPT_DIR/$binary_name.app "\$@"
401+
exec \$SCRIPT_DIR/$original_bin "\$@"
396402
EOF
397403
chmod +x "$binary_path/$binary_name"
398404

399405
echo -e "Launch script created at: $binary_path/$binary_name"
406+
STARTUP_WM_CLASS=$original_bin
400407
}
401408

402409
# Verify and Install Dependencies Function
@@ -557,7 +564,7 @@ Terminal=false
557564
MimeType=$MIME_TYPES_STRING;
558565
Categories=Development;IDE;Utility;TextEditor;
559566
StartupNotify=true
560-
StartupWMClass=phoenix-code
567+
StartupWMClass=$STARTUP_WM_CLASS
561568
EOF
562569
echo -e "${YELLOW}Desktop entry created at: $DESKTOP_ENTRY${RESET}"
563570
# Update the desktop database for GNOME, Unity, XFCE, etc.

0 commit comments

Comments
 (0)