forked from popcorn-official/popcorn-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Create-Desktop-Entry
executable file
·46 lines (36 loc) · 1.29 KB
/
Create-Desktop-Entry
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Adds a desktop entry for the current user
create_desktop_entry() {
NAME="Popcorn Time"
COMMENT="Watch Movies and TV Shows instantly!"
CURRENT_DIR=$(pwd)
EXECUTABLE=$CURRENT_DIR/Popcorn-Time
ICON_PATH=$CURRENT_DIR/src/app/images/icon.png
DESTINATION_DIR=/home/$(whoami)/.local/share/applications
DESKTOP_FILE=$DESTINATION_DIR/popcorn-time.desktop
echo "[Desktop Entry]" > $DESKTOP_FILE
echo "Version=1.0" >> $DESKTOP_FILE
echo "Type=Application" >> $DESKTOP_FILE
echo "Name=$NAME" >> $DESKTOP_FILE
echo "Icon=$ICON_PATH" >> $DESKTOP_FILE
echo "Exec=\"$EXECUTABLE\" %U" >> $DESKTOP_FILE
echo "Comment=$COMMENT" >> $DESKTOP_FILE
echo "Categories=Multimedia;" >> $DESKTOP_FILE
echo "Terminal=false" >> $DESKTOP_FILE
# Updates the desktop entries
gtk-update-icon-cache /usr/share/icons/hicolor
echo "Desktop entry added for $(whoami)"
}
printf "Create a desktop entry for Popcorn Time for the current user ? (Y)es/(N)o: "
read -n1 input
if [ "$input" == "Y" ] || [ "$input" == "y" ] || [ "$input" == "" ]
then
case "$(uname)" in
Linux)
create_desktop_entry ;;
Darwin)
echo "Create a desktop entry is only meant to be used on Linux" ;;
esac
else
echo -e "Cancel. /nJust execute ./Create-Desktop-Entry when you are ready to create a desktop entry for Popcorn Time"
fi