-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRefresh_Desktopfile.sh
executable file
·45 lines (36 loc) · 1.19 KB
/
Refresh_Desktopfile.sh
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
#!/bin/bash
current_dir=$(pwd)
desktop_file="Smartinput.desktop"
desktop_path="$HOME/.local/share/applications"
app_name="Smartinput"
install() {
echo "[Desktop Entry]" > "$desktop_path/$desktop_file"
echo "Name=$app_name" >> "$desktop_path/$desktop_file"
echo "Comment=Smartinput Application" >> "$desktop_path/$desktop_file"
echo "Exec=sh -c 'cd $current_dir && ./main'" >> "$desktop_path/$desktop_file"
echo "Icon=$current_dir/icon.png" >> "$desktop_path/$desktop_file"
echo "Terminal=false" >> "$desktop_path/$desktop_file"
echo "Type=Application" >> "$desktop_path/$desktop_file"
echo "Categories=Utility;" >> "$desktop_path/$desktop_file"
update-desktop-database "$desktop_path"
echo "Install $app_name done!"
}
uninstall() {
rm "$desktop_path/$desktop_file"
update-desktop-database "$desktop_path"
echo "Uninstall $app_name done, you also need to delete the directory manually!"
}
main() {
if [ "$1" == "install" ]; then
install
elif [ "$1" == "uninstall" ]; then
uninstall
elif [ "$1" == "help" ]; then
echo "Useage:
-Install: sh $0 install
-Uninstall: sh $0 uninstall"
else
install
fi
}
main "$1"