forked from butterproject/butter-desktop
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Create-Desktop-Entry
executable file
·40 lines (31 loc) · 1.13 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
#!/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 input
if [ "$input" == "Y" ] || [ "$input" == "y" ]
then
create_desktop_entry
else
echo "Just execute ./Create-Desktop-Entry when you are ready to create a desktop entry for Popcorn Time"
fi