Custom Scripts Quicklist with GUI
Create Quicklist launcher for your scripts. Embedded GUI with automatic and manual option for adding entries.
The automatic option can only add, with the manual you can modify the file directly.
1. Create custom .desktop file for launcher
gedit ~/.local/share/applications/my_scripts.desktop
2. Paste the following code and edit following:(line 5 is the way to folder with your scripts, in this example, this is folder with the name Scripts
, you need to change it for your location. You can change also the line 6 which is an icon. And at the end change <username>
text to match your home folder username.
[Desktop Entry]
Name=My Scripts Folder
Comment=Open your scripts folder
TryExec=nautilus
Exec=xdg-open /home/<username>/Scripts
Icon=ibus-engine
Terminal=false
StartupNotify=true
Type=Application
Categories=GNOME;GTK;Core;
OnlyShowIn=GNOME;Unity;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-Ubuntu-Gettext-Domain=nautilus
X-Ayatana-Desktop-Shortcuts=AddScript
[AddScript Shortcut Group]
Name=Add New Script
Exec=/home/<username>/.local/share/applications/scripts/addscript
TargetEnvironment=Unity
3. Create a 'scripts' folder (if not exist) in ~/.local/share/applications folder:
mkdir ~/.local/share/applications/scripts
4. Create the script file 'addscript' with gedit (this is the GUI for adding entries to your quicklist):
gedit ~/.local/share/applications/scripts/addscript
5. Add this text to the file,then save and close
#!/bin/bash
menuitem=`zenity --list --title="My Scripts Launcher Manager" \
--width=300 --height=150 \
--text="Select action" \
--column="Pick" --column="Action" \
--radiolist TRUE Add-Script-Automatically FALSE Add/Edit/Delete-Manually`
case $menuitem in
Add-Script-Automatically )
hkey=$(zenity --entry --text "Set name for your script" --entry-text "" --title "Set name")
if [ -z "$hkey" ]; then
zenity --error --title "Set name for your script " --text="The script name is empty. Exiting ..."
exit 0
fi
ay=$(sed -n '/X-Ayatana-Desktop-Shortcuts/p' /$HOME/.local/share/applications/my_scripts.desktop)
shortname2=$(echo "$hkey" | sed 's/\///g')
shortname=$(echo "$shortname2" | sed 's/ /_/g')
hkey3=$(zenity --entry --text "Set command for your script" --entry-text "" --title "Set command")
if [ -z "$hkey3" ]; then
zenity --error --title "Set command " --text="The command is empty. Exiting ..."
exit 0
fi
sed -i "s/$ay/$ay;$shortname/g" /$HOME/.local/share/applications/my_scripts.desktop
echo "" >> /$HOME/.local/share/applications/my_scripts.desktop
echo "[$shortname Shortcut Group]" >> /$HOME/.local/share/applications/my_scripts.desktop
echo "Name=$hkey" >> /$HOME/.local/share/applications/my_scripts.desktop
echo "Exec=$hkey3" >> /$HOME/.local/share/applications/my_scripts.desktop
echo "TargetEnvironment=Unity" >> /$HOME/.local/share/applications/my_scripts.desktop
zenity --info --title "New entry added" --text "Changes only take effect on next login"
;;
Add/Edit/Delete-Manually)
zenity --text-info --filename=/$HOME/.local/share/applications/my_scripts.desktop > /tmp/my_scripts.desktop.edited --title "Add/Edit/Delete Script" --editable --width 850 --height 480
cp /tmp/my_scripts.desktop.edited /$HOME/.local/share/applications/my_scripts.desktop
rm /tmp/my_scripts.desktop.edited
zenity --info --title "New entry added" --text "Changes only take effect on next login"
;;
esac
6. Make the file executable:
chmod +x ~/.local/share/applications/scripts/addscript
7.Drag & Drop the my_scripts.desktop
file from ~/.local/share/applications
in nautilus to the Unity Launcher Bar
8. You can start adding entries to your quicklist with clicking on "Add New Script
" menu item