Skip to content

Instantly share code, notes, and snippets.

@aKamrani
Created January 5, 2026 10:46
Show Gist options
  • Select an option

  • Save aKamrani/040998782e8190457a7fdd776f641376 to your computer and use it in GitHub Desktop.

Select an option

Save aKamrani/040998782e8190457a7fdd776f641376 to your computer and use it in GitHub Desktop.
WindTerm install script to set as knwon system app and add it to MintOS start menu
Put it next to the WindTerm extracted files, then make it excutable and run it:
@aKamrani
Copy link
Author

aKamrani commented Jan 5, 2026

#!/bin/bash

# Script to install WindTerm desktop entry for Linux Mint
# This will make WindTerm appear in the start menu

set -e  # Exit on error

# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color

# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WINDTERM_DIR="$SCRIPT_DIR"
DESKTOP_FILE="$WINDTERM_DIR/windterm.desktop"
EXECUTABLE="$WINDTERM_DIR/WindTerm"
ICON_FILE="$WINDTERM_DIR/windterm.png"
TARGET_DIR="$HOME/.local/share/applications"
TARGET_FILE="$TARGET_DIR/windterm.desktop"

echo -e "${GREEN}Installing WindTerm to Linux Mint start menu...${NC}"

# Check if WindTerm executable exists
if [ ! -f "$EXECUTABLE" ]; then
    echo -e "${RED}Error: WindTerm executable not found at $EXECUTABLE${NC}"
    exit 1
fi

# Check if icon exists
if [ ! -f "$ICON_FILE" ]; then
    echo -e "${YELLOW}Warning: Icon file not found at $ICON_FILE${NC}"
    echo -e "${YELLOW}The desktop entry will work but may not have an icon.${NC}"
fi

# Check if desktop file exists
if [ ! -f "$DESKTOP_FILE" ]; then
    echo -e "${RED}Error: Desktop file not found at $DESKTOP_FILE${NC}"
    exit 1
fi

# Create applications directory if it doesn't exist
mkdir -p "$TARGET_DIR"
echo -e "${GREEN}✓ Created applications directory${NC}"

# Create a temporary desktop file with correct paths
TEMP_FILE=$(mktemp)
cat > "$TEMP_FILE" << EOF
[Desktop Entry]
Name=WindTerm
Comment=A professional cross-platform SSH/Sftp/Shell/Telnet/Serial terminal
GenericName=Connect Client
Exec=$EXECUTABLE
Type=Application
Icon=$ICON_FILE
StartupNotify=false
StartupWMClass=Code
Categories=TerminalEmulator;Network;
Actions=new-empty-window
Keywords=windterm

[Desktop Action new-empty-window]
Name=New Empty Window
Icon=$ICON_FILE
Exec=$EXECUTABLE
EOF

# Convert line endings to Unix format (remove any CR characters)
sed -i 's/\r$//' "$TEMP_FILE" 2>/dev/null || sed -i '' 's/\r$//' "$TEMP_FILE" 2>/dev/null || true

# Copy to target location
cp "$TEMP_FILE" "$TARGET_FILE"
rm "$TEMP_FILE"

# Make it executable
chmod +x "$TARGET_FILE"
echo -e "${GREEN}✓ Installed desktop file to $TARGET_FILE${NC}"

# Update desktop database
if command -v update-desktop-database &> /dev/null; then
    update-desktop-database "$TARGET_DIR" 2>/dev/null || true
    echo -e "${GREEN}✓ Updated desktop database${NC}"
else
    echo -e "${YELLOW}Note: update-desktop-database not found, but the entry should still work${NC}"
fi

echo ""
echo -e "${GREEN}✓ WindTerm has been successfully installed to your start menu!${NC}"
echo -e "${GREEN}You can now find it by searching for 'WindTerm' in your menu.${NC}"
echo ""
echo -e "${YELLOW}Note: You may need to log out and back in, or restart your session${NC}"
echo -e "${YELLOW}for the changes to take full effect.${NC}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment