-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cursor: add cursor instalation script
- Loading branch information
operez
committed
Jan 8, 2025
1 parent
2dac6e8
commit bf97f02
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
# Function to print status messages | ||
print_status() { | ||
echo "===> $1" | ||
} | ||
|
||
# Function to handle errors | ||
handle_error() { | ||
echo "ERROR: $1" | ||
exit 1 | ||
} | ||
|
||
# Create temporary directory for download | ||
print_status "Creating temporary directory" | ||
TEMP_DIR=$(mktemp -d) | ||
cd "$TEMP_DIR" || handle_error "Failed to create/enter temporary directory" | ||
|
||
# Download Cursor | ||
print_status "Downloading Cursor AppImage" | ||
wget https://downloader.cursor.sh/linux/appImage/x64 -O cursor.AppImage || handle_error "Failed to download Cursor" | ||
|
||
# Make AppImage executable | ||
print_status "Making AppImage executable" | ||
chmod +x cursor.AppImage || handle_error "Failed to make AppImage executable" | ||
|
||
# Move to /usr/bin (requires sudo) | ||
print_status "Moving Cursor to /usr/bin (requires sudo)" | ||
sudo mv cursor.AppImage /usr/bin/cursor || handle_error "Failed to move Cursor to /usr/bin" | ||
|
||
# Create desktop entry | ||
print_status "Creating desktop entry" | ||
cat << EOF | sudo tee /usr/share/applications/cursor.desktop | ||
[Desktop Entry] | ||
Name=Cursor | ||
Comment=AI-first code editor | ||
Exec=/usr/bin/cursor | ||
Icon=cursor | ||
Type=Application | ||
Categories=Development;TextEditor; | ||
StartupWMClass=Cursor | ||
EOF | ||
|
||
# Download icon | ||
print_status "Downloading and installing icon" | ||
wget https://raw.githubusercontent.com/getcursor/cursor/main/icons/cursor.png -O cursor.png || handle_error "Failed to download icon" | ||
sudo mv cursor.png /usr/share/icons/cursor.png || handle_error "Failed to install icon" | ||
|
||
# Clean up | ||
print_status "Cleaning up temporary files" | ||
cd || handle_error "Failed to leave temporary directory" | ||
rm -rf "$TEMP_DIR" | ||
|
||
print_status "Installation completed successfully!" | ||
print_status "You can now launch Cursor from your application menu or run 'cursor' in terminal" |