Skip to content

Instantly share code, notes, and snippets.

@arpagon
Created August 31, 2023 21:51
Show Gist options
  • Save arpagon/5fe19a2cdfe82ed138d4ba2689221db4 to your computer and use it in GitHub Desktop.
Save arpagon/5fe19a2cdfe82ed138d4ba2689221db4 to your computer and use it in GitHub Desktop.
Cursor-Desktop-AutoUpdate-Handler.sh
#!/bin/bash
# Step 1: Confirm the path to the .AppImage file
APPIMAGE_PATH="$HOME/Applications/cursor-0.8.6.AppImage"
echo "Using AppImage path: $APPIMAGE_PATH"
# Step 1.5: Download the Cursor logo
ICON_PATH="$HOME/.local/share/icons/cursor-icon.svg"
curl -o $ICON_PATH "https://www.cursor.so/brand/icon.svg"
echo "Downloaded logo to: $ICON_PATH"
# Step 2: Create a .desktop file with necessary fields
DESKTOP_FILE_CONTENT="[Desktop Entry]
Type=Application
Name=Cursor
Exec=$APPIMAGE_PATH
Icon=$ICON_PATH
Categories=Utility;
"
echo "Generating .desktop content"
# Step 3: Save the .desktop file
DESKTOP_FILE_PATH="$HOME/.local/share/applications/cursor.desktop"
echo "$DESKTOP_FILE_CONTENT" > $DESKTOP_FILE_PATH
echo "Saved .desktop file at: $DESKTOP_FILE_PATH"
# Step 4: Make it executable
chmod +x $DESKTOP_FILE_PATH
echo "Made the .desktop file executable"
# Done
echo "All set, Cursor should now be available in your app launcher with a fancy icon."
@tadasgedgaudas
Copy link

Need to run update-desktop-database at least for ubuntu 24

#!/bin/bash

# Step 1: Confirm the path to the .AppImage file
APPIMAGE_PATH="/usr/local/bin/cursor"
echo "Using AppImage path: $APPIMAGE_PATH"

# Step 1.5: Download the Cursor logo
ICON_DIR="$HOME/.local/share/icons"
ICON_PATH="$ICON_DIR/cursor-icon.svg"
mkdir -p "$ICON_DIR"
if ! curl -o "$ICON_PATH" "https://www.cursor.so/brand/icon.svg"; then
    echo "Failed to download icon. Using a default icon."
    ICON_PATH="/usr/share/icons/hicolor/scalable/apps/accessories-text-editor.svg"
fi
echo "Icon path: $ICON_PATH"

# Step 2: Create a .desktop file with necessary fields
DESKTOP_FILE_CONTENT="[Desktop Entry]
Type=Application
Name=Cursor
Exec=\"$APPIMAGE_PATH\"
Icon=$ICON_PATH
Categories=Development;IDE;
Comment=AI-powered code editor
"
echo "Generating .desktop content"

# Step 3: Save the .desktop file
DESKTOP_FILE_PATH="$HOME/.local/share/applications/cursor.desktop"
echo "$DESKTOP_FILE_CONTENT" > "$DESKTOP_FILE_PATH"
echo "Saved .desktop file at: $DESKTOP_FILE_PATH"

# Step 4: Make it executable
chmod +x "$DESKTOP_FILE_PATH"
echo "Made the .desktop file executable"

# Step 5: Update desktop database
update-desktop-database "$HOME/.local/share/applications"
echo "Updated desktop database"

# Done
echo "All set, Cursor should now be available in your app launcher with a fancy icon."

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