Last active
March 11, 2025 19:44
-
-
Save cjamcu/a0a0e0ea1848e77517daabbc37583382 to your computer and use it in GitHub Desktop.
Cursor Remove Double window header on Gnome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Exit on error, print commands | |
set -e | |
# Color codes for logging | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
YELLOW='\033[1;33m' | |
NC='\033[0m' # No Color | |
# URLs and paths | |
DEFAULT_CURSOR_URL="https://downloader.cursor.sh/linux/appImage/x64" | |
APPIMAGETOOL_URL="https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" | |
TARGET_PATH="/opt/cursor.appimage" | |
TEMP_CURSOR="./Cursor_orig.AppImage" | |
TEMP_APPIMAGETOOL="./appimagetool-x86_64.AppImage" | |
EXTRACT_DIR="squashfs-root" | |
# Logging functions | |
log_info() { | |
echo -e "${GREEN}[INFO]${NC} $1" | |
} | |
log_warn() { | |
echo -e "${YELLOW}[WARNING]${NC} $1" | |
} | |
log_error() { | |
echo -e "${RED}[ERROR]${NC} $1" | |
} | |
# Check if custom URL is provided | |
CURSOR_URL="${1:-$DEFAULT_CURSOR_URL}" | |
# Main installation process | |
main() { | |
log_info "Starting Cursor IDE installation process..." | |
log_info "Using Cursor download URL: $CURSOR_URL" | |
# Download Cursor IDE | |
log_info "Downloading Cursor IDE..." | |
sudo wget "$CURSOR_URL" -O "$TEMP_CURSOR" | |
sudo chmod +x "$TEMP_CURSOR" | |
# Extract the AppImage | |
log_info "Extracting AppImage..." | |
sudo "./$TEMP_CURSOR" --appimage-extract | |
sudo rm "$TEMP_CURSOR" | |
# Fix window frame settings | |
log_info "Applying window frame fix..." | |
sudo find "$EXTRACT_DIR/" -type f -name '*.js' \ | |
-exec grep -l ,minHeight {} \; \ | |
-exec sed -i 's/,minHeight/,frame:false,minHeight/g' {} \; | |
# Download and prepare appimagetool | |
log_info "Downloading appimagetool..." | |
sudo wget "$APPIMAGETOOL_URL" -O "$TEMP_APPIMAGETOOL" | |
sudo chmod +x "$TEMP_APPIMAGETOOL" | |
# Repackage the AppImage | |
log_info "Repackaging the AppImage..." | |
sudo "./$TEMP_APPIMAGETOOL" "$EXTRACT_DIR/" | |
# Install to target location | |
log_info "Installing to $TARGET_PATH..." | |
sudo mv Cursor-x86_64.AppImage "$TARGET_PATH" | |
sudo chmod +x "$TARGET_PATH" | |
# Cleanup | |
log_info "Cleaning up temporary files..." | |
sudo rm "$TEMP_APPIMAGETOOL" | |
sudo rm -rf "$EXTRACT_DIR/" | |
log_info "Installation completed successfully!" | |
} | |
# Error handling | |
trap 'log_error "An error occurred during execution. Cleaning up..."; cleanup' ERR | |
cleanup() { | |
log_info "Performing cleanup..." | |
[ -f "$TEMP_CURSOR" ] && sudo rm "$TEMP_CURSOR" | |
[ -f "$TEMP_APPIMAGETOOL" ] && sudo rm "$TEMP_APPIMAGETOOL" | |
[ -d "$EXTRACT_DIR" ] && sudo rm -rf "$EXTRACT_DIR/" | |
exit 1 | |
} | |
# Execute main function | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment