Skip to content

Instantly share code, notes, and snippets.

@friddle
Created May 15, 2023 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save friddle/f8c93865e71bf1e02f702647edb5cce6 to your computer and use it in GitHub Desktop.
Save friddle/f8c93865e71bf1e02f702647edb5cce6 to your computer and use it in GitHub Desktop.
Create Steam Deck Desktop sh
#!/bin/bash
# Set the path to the Google Chrome binary
set +x
export url=$1
export desktop_folder="${HOME}/.local/share/application/"
origin_title=$(echo "$1"|awk -F "." '{print $2}')
title=$(curl -s $url| grep -o '<title>.*</title>' | sed -e 's/<title>//g' -e 's/<\/title>//g')
if [[ $title == "" ]];then
title=${origin_title}
fi
echo "create url:$url origin_title:${origin_title} title:${title}"
mkdir $HOME/icon/
icon_path=${HOME}/icon/${origin_title}.ico
wget $url/favicon.ico -O ${icon_path}
chrome_path="/usr/bin/flatpak run --branch=stable --arch=x86_64 --command=/app/bin/chrome com.google.Chrome ${url}"
desktop_file="${desktop_folder}/${origin_title}.desktop"
# Create the desktop file
cat > "$desktop_file" <<EOF
[Desktop Entry]
Type=Application
Name=${title}
Exec=$chrome_path
Icon=$icon_path
Terminal=false
EOF
# Make the desktop file executable
chmod +x $desktop_file
cp $desktop_file ${HOME}/Desktop/
echo "Desktop shortcut for ${origin_title} has been created."
# create youtube.com
# ./create_desktop.sh https://www.youtube.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment