-
Notifications
You must be signed in to change notification settings - Fork 1
/
crear.sh
executable file
·38 lines (37 loc) · 1021 Bytes
/
crear.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
#!/bin/bash
echo 'Bienvenido al creador de lanzadores para GNOME'
echo 'Ingrese algunos datos...'
echo 'El nombre de la aplicación:'
read nombre
echo 'Descripción de la aplicación:'
read descripcion
echo 'Comando, ruta de la aplicación [absoluta]:'
read comando
echo 'Ruta del icono (png,jpg,xpm) [absoluta]:'
read icono
# rationale: lowercase
nombreicono=$(echo "$nombre" | tr '[:upper:]' '[:lower:]' | sed 's/\ /-/g')
echo '¿Quiere que los demás usuarios accedan al lanzador?: (y/n)'
read global
# rationale: lowercase an first letter
global=$(echo "$global" | tr '[:upper:]' '[:lower:]' | head -c 1)
if [ "$global" = "y" ]; then
APP_DIR='/usr/share/applications/'
SUDO='sudo'
else
APP_DIR="$HOME/.local/share/applications/"
SUDO=''
fi
$SUDO tee ${APP_DIR}${nombreicono}.desktop << EOF
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=$nombre
GenericName=$nombre
Comment=$descripcion
Icon=$icono
Exec=$comando %F
Terminal=false
Categories=GTK;Application;
MimeType=application/x-shockwave-flash;
EOF