-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_launcher.sh
More file actions
executable file
·57 lines (48 loc) · 1.41 KB
/
add_launcher.sh
File metadata and controls
executable file
·57 lines (48 loc) · 1.41 KB
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
47
48
49
50
51
52
53
54
55
#!/bin/bash
#
# Add desktop shortcut launcher for software(no .desktop file in
# /usr/share/applications) in ubuntu.
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
read -p "input name for your app:" app_name
echo ${app_name}
read -p "input The path to the executable to run:" app_path
echo ${app_path}
# read -p "input The name of the icon that will be used to display this entry:" icon
# echo $icon
read -p "whether this application needs to be run in a terminal or not:(y/n)" ans
if echo "$ans" | grep -iq "^y" ;then
echo Yes
terminal_flag="true"
else
echo no
terminal_flag="false"
fi
app_desktop="${app_name}.desktop"
main()
{
install_apt_dependencies
create_desktop_for_app
}
install_apt_dependencies()
{
sudo apt-get install --no-install-recommends gnome-panel
# gnome-desktop-item-edit ~/Desktop/ --create-new
}
create_desktop_for_app()
{
echo "create file in ~/.local/share/applications"
cd ~/.local/share/applications
touch ${app_desktop}
# write lines
echo "[Desktop Entry]" >> $app_desktop
echo "Name=$app_name" >> $app_desktop
echo "Exec=$app_path" >> $app_desktop
# echo "Icon=$icon" >> $app_desktop
echo "Type=Application" >> $app_desktop
echo "Terminal=$terminal_flag" >> $app_desktop
echo "Encoding=UTF-8" >> $app_desktop
sudo chmod a+x $app_desktop
mv ~/.local/share/applications/$app_desktop ~/Desktop
}
main