Adding custom applications to GNOME launcher The Next CEO of Stack OverflowHow to make...

What does "Its cash flow is deeply negative" mean?

Example of a Mathematician/Physicist whose Other Publications during their PhD eclipsed their PhD Thesis

Natural language into sentence logic

Term for the "extreme-extension" version of a straw man fallacy?

Does it take more energy to get to Venus or to Mars?

India just shot down a satellite from the ground. At what altitude range is the resulting debris field?

How to write the block matrix in LaTex?

Describing a person. What needs to be mentioned?

Is HostGator storing my password in plaintext?

Are there languages with no euphemisms?

How do we know the LHC results are robust?

Need some help with wall behind rangetop

What is the difference between "behavior" and "behaviour"?

Trouble understanding the speech of overseas colleagues

Visit to the USA with ESTA approved before trip to Iran

How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

WOW air has ceased operation, can I get my tickets refunded?

MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs

What makes a siege story/plot interesting?

How do spells that require an ability check vs. the caster's spell save DC work?

How can I quit an app using Terminal?

How to safely derail a train during transit?

Anatomically Correct Mesopelagic Aves



Adding custom applications to GNOME launcher



The Next CEO of Stack OverflowHow to make executable bin files accessible to Gnome?How can I make the tagspaces launch file work?Create Custom Application Launcher in GNOME panelhow to get a launcher desktop icon for matlab R2019aHow do you create a custom application launcher in Gnome Shell? Eclipse menus are broken in UbuntuDuplicate icons for manually created GNOME launcher itemsCustom launcher in application panel not workingAdding Gnome Commander to Launchereclipse.desktop on launcher being replaced on rebootWhy won't “MyApp.Desktop” launcher appear in “Show Applications”?Create Custom Application Launcher in GNOME panelGNOME shell doesn't detect custom .desktop fileDuplicated .desktop shortcut in Gnome Launcher in Ubuntu 18.04












65















Looking for a utility that allows me insert an item into the list of applications that GNOME knows about.



For example:



I have downloaded Eclipse EE (I have some very special plugins that I need to work with, and those plugins don't "like" the version available in the default repository). I'm using GNOME 3, on Ubuntu 11.10. So I want to execute Eclipse w/o opening a terminal and running it.



It must be something very simple.










share|improve this question

























  • png images does not work, try jpg

    – user271520
    Apr 20 '14 at 17:21
















65















Looking for a utility that allows me insert an item into the list of applications that GNOME knows about.



For example:



I have downloaded Eclipse EE (I have some very special plugins that I need to work with, and those plugins don't "like" the version available in the default repository). I'm using GNOME 3, on Ubuntu 11.10. So I want to execute Eclipse w/o opening a terminal and running it.



It must be something very simple.










share|improve this question

























  • png images does not work, try jpg

    – user271520
    Apr 20 '14 at 17:21














65












65








65


27






Looking for a utility that allows me insert an item into the list of applications that GNOME knows about.



For example:



I have downloaded Eclipse EE (I have some very special plugins that I need to work with, and those plugins don't "like" the version available in the default repository). I'm using GNOME 3, on Ubuntu 11.10. So I want to execute Eclipse w/o opening a terminal and running it.



It must be something very simple.










share|improve this question
















Looking for a utility that allows me insert an item into the list of applications that GNOME knows about.



For example:



I have downloaded Eclipse EE (I have some very special plugins that I need to work with, and those plugins don't "like" the version available in the default repository). I'm using GNOME 3, on Ubuntu 11.10. So I want to execute Eclipse w/o opening a terminal and running it.



It must be something very simple.







gnome-shell eclipse .desktop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 26 mins ago









pomsky

32.9k11103135




32.9k11103135










asked Nov 15 '11 at 19:39









Shaftoe2702Shaftoe2702

428157




428157













  • png images does not work, try jpg

    – user271520
    Apr 20 '14 at 17:21



















  • png images does not work, try jpg

    – user271520
    Apr 20 '14 at 17:21

















png images does not work, try jpg

– user271520
Apr 20 '14 at 17:21





png images does not work, try jpg

– user271520
Apr 20 '14 at 17:21










5 Answers
5






active

oldest

votes


















65














You can use Main Menu for this. If not, install it first:



sudo apt-get install alacarte


1. Open Main Menu



2. See the example



Main Menu



After that you can call your applications with name: "command_of_application".



Edit: I missed that you had asked for applications in your home directory. If so, command must be the full path of that application.






share|improve this answer


























  • That's what I'm looking for.

    – Shaftoe2702
    Nov 15 '11 at 20:32











  • In German Ubuntu 17.10, search for "Menüberabeitung"

    – Christopher K.
    May 9 '18 at 14:25











  • Thank you, luckily this package was there for fedora too.

    – Sukumaar
    Dec 6 '18 at 5:40



















55














The applications launchers Gnome knows about are .desktop files in /usr/share/applications, and ~/.local/share/applications. You can create custom launchers for whatever is in your home folder, by either manually creating and editing a custom .desktop file, or by using Alacarte, the old Gnome menu editor.





The Gnome desktop file documentation can be of help: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en



The custom launcher is just a text file, named, for example, EclipseEE.desktop, with the following content:



[Desktop Entry]
Name=Eclipse EE
Exec=/home/mrPeterson/path_to_executable
StartupNotify=true
Terminal=false
Type=Application
Icon=/optional/path/to/icon.png





share|improve this answer


























  • first link is broken

    – nispio
    Aug 11 '15 at 23:59



















8














(Repost from the original OP)



This is neat trick pointed out elsewhere:



gnome-desktop-item-edit ~/Desktop/ --create-new


Now, I have an Icon. That was a nice feature to have bound to the context menu, but alas, I do not see it.






share|improve this answer


























  • This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

    – yuikonnu
    Jan 7 '18 at 17:59



















4














I like Jorge's simple gnome-desktop-item-edit solution. However, if I place the .desktop file on ~/Desktop/ it does not show up as an application but only as a file in the gnome menu. So I do:



sudo gnome-desktop-item-edit /usr/share/applications/ --create-new





share|improve this answer


























  • Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

    – RousseauAlexandre
    Nov 23 '18 at 7:36



















1














I know this thread is kinda old, but I wanted to share with you guys this bash function I just made because... because I can.
If you find it useful, feel free to use it!



Warning: I just made it. It might not be perfect.



new-gnome-launcher-app(){
# This functions adds some executable file to the gnome launcher.
# It does the following:
# - Add symlink to /usr/bin
# - Add entry for gnome launcher

# TODO: Check image file extension

# Check if root
# if [ "$(id -u)" != "0" ]; then
# echo "Must run as root"
# return 1
# fi

# If parameter is entered, assume it's the executable's directory.
# Else, ask for it
if [ "$?" -gt "1" ]; then
exec_path="$1"
else
echo -n "Enter executable file name: "
read exec_path
fi
# Check if file exists
if [ ! -f "$exec_path" ] || [ ! -f "$(pwd)/$exec_path" ]; then
echo "File doesn't exist"
unset exec_path
return 1
fi
# Get absolute path to file
if [ "${exec_path:0:1}" != "/" ]; then
echo "'$exec_path' was not an absolute path"
exec_path="$(pwd)/$exec_path"
echo "Assuming path '$exec_path'"
fi
exec_basename="$(basename "$exec_path")"
# Check if symlink already exists
if [ -f "/usr/bin/$exec_basename" ]; then
echo "File '/usr/bin/$exec_basename' already exists. We wont be able to create the symlink."
unset exec_basename
unset exec_path
return 1
fi
# Add entry for gnome panel
gnome_panel_entry_path="/usr/share/applications/$exec_basename.desktop"
if [ -f "$gnome_panel_entry_path" ]; then
echo "Entry '$(basename "$gnome_panel_entry_path")' already exists!"
unset exec_basename
unset gnome_panel_entry_path
unset exec_path
return 2
fi
# ask for display name
while [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ]; do
echo -n "Enter the program's name: "
read APP_NAME
while [ "$APP_NAME" == "" ]; do
echo -n "Please enter something: "
read APP_NAME
done
# ask for a description
echo -n "Enter a short description: "
read APP_DESCRIPTION
# ask for an icon file
echo -n "Enter absolute path to an icon image (empty for none): "
read APP_ICON
while [ "$APP_ICON" != "" ] && [ ! -f "$APP_ICON" ]; do
echo -n "File doesn't exist. Retry: "
read APP_ICON
done
# ask if it needs a terminal
echo -n "Will this program need a terminal? [y/n]: "
read APP_TERMINAL
while [ "$APP_TERMINAL" != "y" ] && [ "$APP_TERMINAL" != "n" ]; do
echo -n "Please enter something: "
read APP_TERMINAL
done
if [ "$APP_TERMINAL" == "y" ]; then
APP_TERMINAL="true"
else
APP_TERMINAL="false"
fi
# ask for tags
echo -n "Enter some categories that fit your program (';' separated): "
read APP_CATEGORIES
# Check if user is satisfied
while [ "$USER_RESPONSE" == "" ] || [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ] && [ "$USER_RESPONSE" != "n" ] && [ "$USER_RESPONSE" != "N" ]; do
echo -e "Is this information correct?n"
echo -e "tName: tt$APP_NAME"
echo -e "tExecutable: t$exec_path"
echo -e "tDescription: t$APP_DESCRIPTION"
echo -e "tIcon File: t$APP_ICON"
echo -e "tTerminal: t$APP_TERMINAL"
echo -e "tCategories: t$APP_CATEGORIES"
echo -n "(y/n): "
read USER_RESPONSE
done
if [ "$USER_RESPONSE" == "n" ] || [ "$USER_RESPONSE" == "N" ]; then
echo "Then please enter everything again, kind sir"
unset USER_RESPONSE
fi
done
# User is happy
# Add link to /usr/bin
echo "Adding link to /usr/bin"
sudo ln -s "$exec_path" "/usr/bin/$exec_basename"
# Add gnome panel entry
echo "Creating gnome-panel entry"
echo "[Desktop Entry]" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Type=Application" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Encoding=UTF-8" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Name=$APP_NAME" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Comment=$APP_DESCRIPTION" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Icon=$APP_ICON" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Exec=$exec_path" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Terminal=$APP_TERMINAL" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Categories=$APP_CATEGORIES" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Entry added in '$gnome_panel_entry_path'"
unset USER_RESPONSE
unset APP_NAME
unset APP_CATEGORIES
unset APP_TERMINAL
unset APP_DESCRIPTION
unset APP_ICON
unset exec_path
unset exec_basename
unset gnome_panel_entry_path
return 0
}





share|improve this answer
























  • :+1: for you time :), good to have a command line tool

    – Daniel Pérez
    Jan 8 '18 at 18:27












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f79583%2fadding-custom-applications-to-gnome-launcher%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























5 Answers
5






active

oldest

votes








5 Answers
5






active

oldest

votes









active

oldest

votes






active

oldest

votes









65














You can use Main Menu for this. If not, install it first:



sudo apt-get install alacarte


1. Open Main Menu



2. See the example



Main Menu



After that you can call your applications with name: "command_of_application".



Edit: I missed that you had asked for applications in your home directory. If so, command must be the full path of that application.






share|improve this answer


























  • That's what I'm looking for.

    – Shaftoe2702
    Nov 15 '11 at 20:32











  • In German Ubuntu 17.10, search for "Menüberabeitung"

    – Christopher K.
    May 9 '18 at 14:25











  • Thank you, luckily this package was there for fedora too.

    – Sukumaar
    Dec 6 '18 at 5:40
















65














You can use Main Menu for this. If not, install it first:



sudo apt-get install alacarte


1. Open Main Menu



2. See the example



Main Menu



After that you can call your applications with name: "command_of_application".



Edit: I missed that you had asked for applications in your home directory. If so, command must be the full path of that application.






share|improve this answer


























  • That's what I'm looking for.

    – Shaftoe2702
    Nov 15 '11 at 20:32











  • In German Ubuntu 17.10, search for "Menüberabeitung"

    – Christopher K.
    May 9 '18 at 14:25











  • Thank you, luckily this package was there for fedora too.

    – Sukumaar
    Dec 6 '18 at 5:40














65












65








65







You can use Main Menu for this. If not, install it first:



sudo apt-get install alacarte


1. Open Main Menu



2. See the example



Main Menu



After that you can call your applications with name: "command_of_application".



Edit: I missed that you had asked for applications in your home directory. If so, command must be the full path of that application.






share|improve this answer















You can use Main Menu for this. If not, install it first:



sudo apt-get install alacarte


1. Open Main Menu



2. See the example



Main Menu



After that you can call your applications with name: "command_of_application".



Edit: I missed that you had asked for applications in your home directory. If so, command must be the full path of that application.







share|improve this answer














share|improve this answer



share|improve this answer








edited Apr 27 '18 at 19:13









pomsky

32.9k11103135




32.9k11103135










answered Nov 15 '11 at 20:13









heartsmagicheartsmagic

4,5302040




4,5302040













  • That's what I'm looking for.

    – Shaftoe2702
    Nov 15 '11 at 20:32











  • In German Ubuntu 17.10, search for "Menüberabeitung"

    – Christopher K.
    May 9 '18 at 14:25











  • Thank you, luckily this package was there for fedora too.

    – Sukumaar
    Dec 6 '18 at 5:40



















  • That's what I'm looking for.

    – Shaftoe2702
    Nov 15 '11 at 20:32











  • In German Ubuntu 17.10, search for "Menüberabeitung"

    – Christopher K.
    May 9 '18 at 14:25











  • Thank you, luckily this package was there for fedora too.

    – Sukumaar
    Dec 6 '18 at 5:40

















That's what I'm looking for.

– Shaftoe2702
Nov 15 '11 at 20:32





That's what I'm looking for.

– Shaftoe2702
Nov 15 '11 at 20:32













In German Ubuntu 17.10, search for "Menüberabeitung"

– Christopher K.
May 9 '18 at 14:25





In German Ubuntu 17.10, search for "Menüberabeitung"

– Christopher K.
May 9 '18 at 14:25













Thank you, luckily this package was there for fedora too.

– Sukumaar
Dec 6 '18 at 5:40





Thank you, luckily this package was there for fedora too.

– Sukumaar
Dec 6 '18 at 5:40













55














The applications launchers Gnome knows about are .desktop files in /usr/share/applications, and ~/.local/share/applications. You can create custom launchers for whatever is in your home folder, by either manually creating and editing a custom .desktop file, or by using Alacarte, the old Gnome menu editor.





The Gnome desktop file documentation can be of help: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en



The custom launcher is just a text file, named, for example, EclipseEE.desktop, with the following content:



[Desktop Entry]
Name=Eclipse EE
Exec=/home/mrPeterson/path_to_executable
StartupNotify=true
Terminal=false
Type=Application
Icon=/optional/path/to/icon.png





share|improve this answer


























  • first link is broken

    – nispio
    Aug 11 '15 at 23:59
















55














The applications launchers Gnome knows about are .desktop files in /usr/share/applications, and ~/.local/share/applications. You can create custom launchers for whatever is in your home folder, by either manually creating and editing a custom .desktop file, or by using Alacarte, the old Gnome menu editor.





The Gnome desktop file documentation can be of help: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en



The custom launcher is just a text file, named, for example, EclipseEE.desktop, with the following content:



[Desktop Entry]
Name=Eclipse EE
Exec=/home/mrPeterson/path_to_executable
StartupNotify=true
Terminal=false
Type=Application
Icon=/optional/path/to/icon.png





share|improve this answer


























  • first link is broken

    – nispio
    Aug 11 '15 at 23:59














55












55








55







The applications launchers Gnome knows about are .desktop files in /usr/share/applications, and ~/.local/share/applications. You can create custom launchers for whatever is in your home folder, by either manually creating and editing a custom .desktop file, or by using Alacarte, the old Gnome menu editor.





The Gnome desktop file documentation can be of help: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en



The custom launcher is just a text file, named, for example, EclipseEE.desktop, with the following content:



[Desktop Entry]
Name=Eclipse EE
Exec=/home/mrPeterson/path_to_executable
StartupNotify=true
Terminal=false
Type=Application
Icon=/optional/path/to/icon.png





share|improve this answer















The applications launchers Gnome knows about are .desktop files in /usr/share/applications, and ~/.local/share/applications. You can create custom launchers for whatever is in your home folder, by either manually creating and editing a custom .desktop file, or by using Alacarte, the old Gnome menu editor.





The Gnome desktop file documentation can be of help: https://developer.gnome.org/integration-guide/stable/desktop-files.html.en



The custom launcher is just a text file, named, for example, EclipseEE.desktop, with the following content:



[Desktop Entry]
Name=Eclipse EE
Exec=/home/mrPeterson/path_to_executable
StartupNotify=true
Terminal=false
Type=Application
Icon=/optional/path/to/icon.png






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 12 '15 at 14:45

























answered Nov 15 '11 at 20:11









mikewhatevermikewhatever

24.2k77086




24.2k77086













  • first link is broken

    – nispio
    Aug 11 '15 at 23:59



















  • first link is broken

    – nispio
    Aug 11 '15 at 23:59

















first link is broken

– nispio
Aug 11 '15 at 23:59





first link is broken

– nispio
Aug 11 '15 at 23:59











8














(Repost from the original OP)



This is neat trick pointed out elsewhere:



gnome-desktop-item-edit ~/Desktop/ --create-new


Now, I have an Icon. That was a nice feature to have bound to the context menu, but alas, I do not see it.






share|improve this answer


























  • This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

    – yuikonnu
    Jan 7 '18 at 17:59
















8














(Repost from the original OP)



This is neat trick pointed out elsewhere:



gnome-desktop-item-edit ~/Desktop/ --create-new


Now, I have an Icon. That was a nice feature to have bound to the context menu, but alas, I do not see it.






share|improve this answer


























  • This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

    – yuikonnu
    Jan 7 '18 at 17:59














8












8








8







(Repost from the original OP)



This is neat trick pointed out elsewhere:



gnome-desktop-item-edit ~/Desktop/ --create-new


Now, I have an Icon. That was a nice feature to have bound to the context menu, but alas, I do not see it.






share|improve this answer















(Repost from the original OP)



This is neat trick pointed out elsewhere:



gnome-desktop-item-edit ~/Desktop/ --create-new


Now, I have an Icon. That was a nice feature to have bound to the context menu, but alas, I do not see it.







share|improve this answer














share|improve this answer



share|improve this answer








answered Nov 25 '11 at 0:37


























community wiki





Jorge Castro














  • This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

    – yuikonnu
    Jan 7 '18 at 17:59



















  • This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

    – yuikonnu
    Jan 7 '18 at 17:59

















This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

– yuikonnu
Jan 7 '18 at 17:59





This program wasn't installed by default for me; had to do sudo apt-get install --no-install-recommends gnome-panel

– yuikonnu
Jan 7 '18 at 17:59











4














I like Jorge's simple gnome-desktop-item-edit solution. However, if I place the .desktop file on ~/Desktop/ it does not show up as an application but only as a file in the gnome menu. So I do:



sudo gnome-desktop-item-edit /usr/share/applications/ --create-new





share|improve this answer


























  • Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

    – RousseauAlexandre
    Nov 23 '18 at 7:36
















4














I like Jorge's simple gnome-desktop-item-edit solution. However, if I place the .desktop file on ~/Desktop/ it does not show up as an application but only as a file in the gnome menu. So I do:



sudo gnome-desktop-item-edit /usr/share/applications/ --create-new





share|improve this answer


























  • Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

    – RousseauAlexandre
    Nov 23 '18 at 7:36














4












4








4







I like Jorge's simple gnome-desktop-item-edit solution. However, if I place the .desktop file on ~/Desktop/ it does not show up as an application but only as a file in the gnome menu. So I do:



sudo gnome-desktop-item-edit /usr/share/applications/ --create-new





share|improve this answer















I like Jorge's simple gnome-desktop-item-edit solution. However, if I place the .desktop file on ~/Desktop/ it does not show up as an application but only as a file in the gnome menu. So I do:



sudo gnome-desktop-item-edit /usr/share/applications/ --create-new






share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 1 at 18:17









pomsky

32.9k11103135




32.9k11103135










answered Feb 18 '13 at 14:13









pygracpygrac

28123




28123













  • Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

    – RousseauAlexandre
    Nov 23 '18 at 7:36



















  • Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

    – RousseauAlexandre
    Nov 23 '18 at 7:36

















Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

– RousseauAlexandre
Nov 23 '18 at 7:36





Howerver you want to create menu for all gnome users, you should prefer place it on ~/.local/share/applications folder and avoid to use sudo.

– RousseauAlexandre
Nov 23 '18 at 7:36











1














I know this thread is kinda old, but I wanted to share with you guys this bash function I just made because... because I can.
If you find it useful, feel free to use it!



Warning: I just made it. It might not be perfect.



new-gnome-launcher-app(){
# This functions adds some executable file to the gnome launcher.
# It does the following:
# - Add symlink to /usr/bin
# - Add entry for gnome launcher

# TODO: Check image file extension

# Check if root
# if [ "$(id -u)" != "0" ]; then
# echo "Must run as root"
# return 1
# fi

# If parameter is entered, assume it's the executable's directory.
# Else, ask for it
if [ "$?" -gt "1" ]; then
exec_path="$1"
else
echo -n "Enter executable file name: "
read exec_path
fi
# Check if file exists
if [ ! -f "$exec_path" ] || [ ! -f "$(pwd)/$exec_path" ]; then
echo "File doesn't exist"
unset exec_path
return 1
fi
# Get absolute path to file
if [ "${exec_path:0:1}" != "/" ]; then
echo "'$exec_path' was not an absolute path"
exec_path="$(pwd)/$exec_path"
echo "Assuming path '$exec_path'"
fi
exec_basename="$(basename "$exec_path")"
# Check if symlink already exists
if [ -f "/usr/bin/$exec_basename" ]; then
echo "File '/usr/bin/$exec_basename' already exists. We wont be able to create the symlink."
unset exec_basename
unset exec_path
return 1
fi
# Add entry for gnome panel
gnome_panel_entry_path="/usr/share/applications/$exec_basename.desktop"
if [ -f "$gnome_panel_entry_path" ]; then
echo "Entry '$(basename "$gnome_panel_entry_path")' already exists!"
unset exec_basename
unset gnome_panel_entry_path
unset exec_path
return 2
fi
# ask for display name
while [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ]; do
echo -n "Enter the program's name: "
read APP_NAME
while [ "$APP_NAME" == "" ]; do
echo -n "Please enter something: "
read APP_NAME
done
# ask for a description
echo -n "Enter a short description: "
read APP_DESCRIPTION
# ask for an icon file
echo -n "Enter absolute path to an icon image (empty for none): "
read APP_ICON
while [ "$APP_ICON" != "" ] && [ ! -f "$APP_ICON" ]; do
echo -n "File doesn't exist. Retry: "
read APP_ICON
done
# ask if it needs a terminal
echo -n "Will this program need a terminal? [y/n]: "
read APP_TERMINAL
while [ "$APP_TERMINAL" != "y" ] && [ "$APP_TERMINAL" != "n" ]; do
echo -n "Please enter something: "
read APP_TERMINAL
done
if [ "$APP_TERMINAL" == "y" ]; then
APP_TERMINAL="true"
else
APP_TERMINAL="false"
fi
# ask for tags
echo -n "Enter some categories that fit your program (';' separated): "
read APP_CATEGORIES
# Check if user is satisfied
while [ "$USER_RESPONSE" == "" ] || [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ] && [ "$USER_RESPONSE" != "n" ] && [ "$USER_RESPONSE" != "N" ]; do
echo -e "Is this information correct?n"
echo -e "tName: tt$APP_NAME"
echo -e "tExecutable: t$exec_path"
echo -e "tDescription: t$APP_DESCRIPTION"
echo -e "tIcon File: t$APP_ICON"
echo -e "tTerminal: t$APP_TERMINAL"
echo -e "tCategories: t$APP_CATEGORIES"
echo -n "(y/n): "
read USER_RESPONSE
done
if [ "$USER_RESPONSE" == "n" ] || [ "$USER_RESPONSE" == "N" ]; then
echo "Then please enter everything again, kind sir"
unset USER_RESPONSE
fi
done
# User is happy
# Add link to /usr/bin
echo "Adding link to /usr/bin"
sudo ln -s "$exec_path" "/usr/bin/$exec_basename"
# Add gnome panel entry
echo "Creating gnome-panel entry"
echo "[Desktop Entry]" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Type=Application" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Encoding=UTF-8" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Name=$APP_NAME" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Comment=$APP_DESCRIPTION" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Icon=$APP_ICON" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Exec=$exec_path" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Terminal=$APP_TERMINAL" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Categories=$APP_CATEGORIES" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Entry added in '$gnome_panel_entry_path'"
unset USER_RESPONSE
unset APP_NAME
unset APP_CATEGORIES
unset APP_TERMINAL
unset APP_DESCRIPTION
unset APP_ICON
unset exec_path
unset exec_basename
unset gnome_panel_entry_path
return 0
}





share|improve this answer
























  • :+1: for you time :), good to have a command line tool

    – Daniel Pérez
    Jan 8 '18 at 18:27
















1














I know this thread is kinda old, but I wanted to share with you guys this bash function I just made because... because I can.
If you find it useful, feel free to use it!



Warning: I just made it. It might not be perfect.



new-gnome-launcher-app(){
# This functions adds some executable file to the gnome launcher.
# It does the following:
# - Add symlink to /usr/bin
# - Add entry for gnome launcher

# TODO: Check image file extension

# Check if root
# if [ "$(id -u)" != "0" ]; then
# echo "Must run as root"
# return 1
# fi

# If parameter is entered, assume it's the executable's directory.
# Else, ask for it
if [ "$?" -gt "1" ]; then
exec_path="$1"
else
echo -n "Enter executable file name: "
read exec_path
fi
# Check if file exists
if [ ! -f "$exec_path" ] || [ ! -f "$(pwd)/$exec_path" ]; then
echo "File doesn't exist"
unset exec_path
return 1
fi
# Get absolute path to file
if [ "${exec_path:0:1}" != "/" ]; then
echo "'$exec_path' was not an absolute path"
exec_path="$(pwd)/$exec_path"
echo "Assuming path '$exec_path'"
fi
exec_basename="$(basename "$exec_path")"
# Check if symlink already exists
if [ -f "/usr/bin/$exec_basename" ]; then
echo "File '/usr/bin/$exec_basename' already exists. We wont be able to create the symlink."
unset exec_basename
unset exec_path
return 1
fi
# Add entry for gnome panel
gnome_panel_entry_path="/usr/share/applications/$exec_basename.desktop"
if [ -f "$gnome_panel_entry_path" ]; then
echo "Entry '$(basename "$gnome_panel_entry_path")' already exists!"
unset exec_basename
unset gnome_panel_entry_path
unset exec_path
return 2
fi
# ask for display name
while [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ]; do
echo -n "Enter the program's name: "
read APP_NAME
while [ "$APP_NAME" == "" ]; do
echo -n "Please enter something: "
read APP_NAME
done
# ask for a description
echo -n "Enter a short description: "
read APP_DESCRIPTION
# ask for an icon file
echo -n "Enter absolute path to an icon image (empty for none): "
read APP_ICON
while [ "$APP_ICON" != "" ] && [ ! -f "$APP_ICON" ]; do
echo -n "File doesn't exist. Retry: "
read APP_ICON
done
# ask if it needs a terminal
echo -n "Will this program need a terminal? [y/n]: "
read APP_TERMINAL
while [ "$APP_TERMINAL" != "y" ] && [ "$APP_TERMINAL" != "n" ]; do
echo -n "Please enter something: "
read APP_TERMINAL
done
if [ "$APP_TERMINAL" == "y" ]; then
APP_TERMINAL="true"
else
APP_TERMINAL="false"
fi
# ask for tags
echo -n "Enter some categories that fit your program (';' separated): "
read APP_CATEGORIES
# Check if user is satisfied
while [ "$USER_RESPONSE" == "" ] || [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ] && [ "$USER_RESPONSE" != "n" ] && [ "$USER_RESPONSE" != "N" ]; do
echo -e "Is this information correct?n"
echo -e "tName: tt$APP_NAME"
echo -e "tExecutable: t$exec_path"
echo -e "tDescription: t$APP_DESCRIPTION"
echo -e "tIcon File: t$APP_ICON"
echo -e "tTerminal: t$APP_TERMINAL"
echo -e "tCategories: t$APP_CATEGORIES"
echo -n "(y/n): "
read USER_RESPONSE
done
if [ "$USER_RESPONSE" == "n" ] || [ "$USER_RESPONSE" == "N" ]; then
echo "Then please enter everything again, kind sir"
unset USER_RESPONSE
fi
done
# User is happy
# Add link to /usr/bin
echo "Adding link to /usr/bin"
sudo ln -s "$exec_path" "/usr/bin/$exec_basename"
# Add gnome panel entry
echo "Creating gnome-panel entry"
echo "[Desktop Entry]" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Type=Application" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Encoding=UTF-8" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Name=$APP_NAME" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Comment=$APP_DESCRIPTION" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Icon=$APP_ICON" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Exec=$exec_path" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Terminal=$APP_TERMINAL" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Categories=$APP_CATEGORIES" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Entry added in '$gnome_panel_entry_path'"
unset USER_RESPONSE
unset APP_NAME
unset APP_CATEGORIES
unset APP_TERMINAL
unset APP_DESCRIPTION
unset APP_ICON
unset exec_path
unset exec_basename
unset gnome_panel_entry_path
return 0
}





share|improve this answer
























  • :+1: for you time :), good to have a command line tool

    – Daniel Pérez
    Jan 8 '18 at 18:27














1












1








1







I know this thread is kinda old, but I wanted to share with you guys this bash function I just made because... because I can.
If you find it useful, feel free to use it!



Warning: I just made it. It might not be perfect.



new-gnome-launcher-app(){
# This functions adds some executable file to the gnome launcher.
# It does the following:
# - Add symlink to /usr/bin
# - Add entry for gnome launcher

# TODO: Check image file extension

# Check if root
# if [ "$(id -u)" != "0" ]; then
# echo "Must run as root"
# return 1
# fi

# If parameter is entered, assume it's the executable's directory.
# Else, ask for it
if [ "$?" -gt "1" ]; then
exec_path="$1"
else
echo -n "Enter executable file name: "
read exec_path
fi
# Check if file exists
if [ ! -f "$exec_path" ] || [ ! -f "$(pwd)/$exec_path" ]; then
echo "File doesn't exist"
unset exec_path
return 1
fi
# Get absolute path to file
if [ "${exec_path:0:1}" != "/" ]; then
echo "'$exec_path' was not an absolute path"
exec_path="$(pwd)/$exec_path"
echo "Assuming path '$exec_path'"
fi
exec_basename="$(basename "$exec_path")"
# Check if symlink already exists
if [ -f "/usr/bin/$exec_basename" ]; then
echo "File '/usr/bin/$exec_basename' already exists. We wont be able to create the symlink."
unset exec_basename
unset exec_path
return 1
fi
# Add entry for gnome panel
gnome_panel_entry_path="/usr/share/applications/$exec_basename.desktop"
if [ -f "$gnome_panel_entry_path" ]; then
echo "Entry '$(basename "$gnome_panel_entry_path")' already exists!"
unset exec_basename
unset gnome_panel_entry_path
unset exec_path
return 2
fi
# ask for display name
while [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ]; do
echo -n "Enter the program's name: "
read APP_NAME
while [ "$APP_NAME" == "" ]; do
echo -n "Please enter something: "
read APP_NAME
done
# ask for a description
echo -n "Enter a short description: "
read APP_DESCRIPTION
# ask for an icon file
echo -n "Enter absolute path to an icon image (empty for none): "
read APP_ICON
while [ "$APP_ICON" != "" ] && [ ! -f "$APP_ICON" ]; do
echo -n "File doesn't exist. Retry: "
read APP_ICON
done
# ask if it needs a terminal
echo -n "Will this program need a terminal? [y/n]: "
read APP_TERMINAL
while [ "$APP_TERMINAL" != "y" ] && [ "$APP_TERMINAL" != "n" ]; do
echo -n "Please enter something: "
read APP_TERMINAL
done
if [ "$APP_TERMINAL" == "y" ]; then
APP_TERMINAL="true"
else
APP_TERMINAL="false"
fi
# ask for tags
echo -n "Enter some categories that fit your program (';' separated): "
read APP_CATEGORIES
# Check if user is satisfied
while [ "$USER_RESPONSE" == "" ] || [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ] && [ "$USER_RESPONSE" != "n" ] && [ "$USER_RESPONSE" != "N" ]; do
echo -e "Is this information correct?n"
echo -e "tName: tt$APP_NAME"
echo -e "tExecutable: t$exec_path"
echo -e "tDescription: t$APP_DESCRIPTION"
echo -e "tIcon File: t$APP_ICON"
echo -e "tTerminal: t$APP_TERMINAL"
echo -e "tCategories: t$APP_CATEGORIES"
echo -n "(y/n): "
read USER_RESPONSE
done
if [ "$USER_RESPONSE" == "n" ] || [ "$USER_RESPONSE" == "N" ]; then
echo "Then please enter everything again, kind sir"
unset USER_RESPONSE
fi
done
# User is happy
# Add link to /usr/bin
echo "Adding link to /usr/bin"
sudo ln -s "$exec_path" "/usr/bin/$exec_basename"
# Add gnome panel entry
echo "Creating gnome-panel entry"
echo "[Desktop Entry]" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Type=Application" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Encoding=UTF-8" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Name=$APP_NAME" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Comment=$APP_DESCRIPTION" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Icon=$APP_ICON" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Exec=$exec_path" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Terminal=$APP_TERMINAL" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Categories=$APP_CATEGORIES" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Entry added in '$gnome_panel_entry_path'"
unset USER_RESPONSE
unset APP_NAME
unset APP_CATEGORIES
unset APP_TERMINAL
unset APP_DESCRIPTION
unset APP_ICON
unset exec_path
unset exec_basename
unset gnome_panel_entry_path
return 0
}





share|improve this answer













I know this thread is kinda old, but I wanted to share with you guys this bash function I just made because... because I can.
If you find it useful, feel free to use it!



Warning: I just made it. It might not be perfect.



new-gnome-launcher-app(){
# This functions adds some executable file to the gnome launcher.
# It does the following:
# - Add symlink to /usr/bin
# - Add entry for gnome launcher

# TODO: Check image file extension

# Check if root
# if [ "$(id -u)" != "0" ]; then
# echo "Must run as root"
# return 1
# fi

# If parameter is entered, assume it's the executable's directory.
# Else, ask for it
if [ "$?" -gt "1" ]; then
exec_path="$1"
else
echo -n "Enter executable file name: "
read exec_path
fi
# Check if file exists
if [ ! -f "$exec_path" ] || [ ! -f "$(pwd)/$exec_path" ]; then
echo "File doesn't exist"
unset exec_path
return 1
fi
# Get absolute path to file
if [ "${exec_path:0:1}" != "/" ]; then
echo "'$exec_path' was not an absolute path"
exec_path="$(pwd)/$exec_path"
echo "Assuming path '$exec_path'"
fi
exec_basename="$(basename "$exec_path")"
# Check if symlink already exists
if [ -f "/usr/bin/$exec_basename" ]; then
echo "File '/usr/bin/$exec_basename' already exists. We wont be able to create the symlink."
unset exec_basename
unset exec_path
return 1
fi
# Add entry for gnome panel
gnome_panel_entry_path="/usr/share/applications/$exec_basename.desktop"
if [ -f "$gnome_panel_entry_path" ]; then
echo "Entry '$(basename "$gnome_panel_entry_path")' already exists!"
unset exec_basename
unset gnome_panel_entry_path
unset exec_path
return 2
fi
# ask for display name
while [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ]; do
echo -n "Enter the program's name: "
read APP_NAME
while [ "$APP_NAME" == "" ]; do
echo -n "Please enter something: "
read APP_NAME
done
# ask for a description
echo -n "Enter a short description: "
read APP_DESCRIPTION
# ask for an icon file
echo -n "Enter absolute path to an icon image (empty for none): "
read APP_ICON
while [ "$APP_ICON" != "" ] && [ ! -f "$APP_ICON" ]; do
echo -n "File doesn't exist. Retry: "
read APP_ICON
done
# ask if it needs a terminal
echo -n "Will this program need a terminal? [y/n]: "
read APP_TERMINAL
while [ "$APP_TERMINAL" != "y" ] && [ "$APP_TERMINAL" != "n" ]; do
echo -n "Please enter something: "
read APP_TERMINAL
done
if [ "$APP_TERMINAL" == "y" ]; then
APP_TERMINAL="true"
else
APP_TERMINAL="false"
fi
# ask for tags
echo -n "Enter some categories that fit your program (';' separated): "
read APP_CATEGORIES
# Check if user is satisfied
while [ "$USER_RESPONSE" == "" ] || [ "$USER_RESPONSE" != "y" ] && [ "$USER_RESPONSE" != "Y" ] && [ "$USER_RESPONSE" != "n" ] && [ "$USER_RESPONSE" != "N" ]; do
echo -e "Is this information correct?n"
echo -e "tName: tt$APP_NAME"
echo -e "tExecutable: t$exec_path"
echo -e "tDescription: t$APP_DESCRIPTION"
echo -e "tIcon File: t$APP_ICON"
echo -e "tTerminal: t$APP_TERMINAL"
echo -e "tCategories: t$APP_CATEGORIES"
echo -n "(y/n): "
read USER_RESPONSE
done
if [ "$USER_RESPONSE" == "n" ] || [ "$USER_RESPONSE" == "N" ]; then
echo "Then please enter everything again, kind sir"
unset USER_RESPONSE
fi
done
# User is happy
# Add link to /usr/bin
echo "Adding link to /usr/bin"
sudo ln -s "$exec_path" "/usr/bin/$exec_basename"
# Add gnome panel entry
echo "Creating gnome-panel entry"
echo "[Desktop Entry]" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Type=Application" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Encoding=UTF-8" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Name=$APP_NAME" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Comment=$APP_DESCRIPTION" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Icon=$APP_ICON" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Exec=$exec_path" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Terminal=$APP_TERMINAL" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Categories=$APP_CATEGORIES" | sudo tee -a "$gnome_panel_entry_path" > /dev/null
echo "Entry added in '$gnome_panel_entry_path'"
unset USER_RESPONSE
unset APP_NAME
unset APP_CATEGORIES
unset APP_TERMINAL
unset APP_DESCRIPTION
unset APP_ICON
unset exec_path
unset exec_basename
unset gnome_panel_entry_path
return 0
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 2 '16 at 1:34









Maximiliano Castro DiazMaximiliano Castro Diaz

111




111













  • :+1: for you time :), good to have a command line tool

    – Daniel Pérez
    Jan 8 '18 at 18:27



















  • :+1: for you time :), good to have a command line tool

    – Daniel Pérez
    Jan 8 '18 at 18:27

















:+1: for you time :), good to have a command line tool

– Daniel Pérez
Jan 8 '18 at 18:27





:+1: for you time :), good to have a command line tool

– Daniel Pérez
Jan 8 '18 at 18:27


















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f79583%2fadding-custom-applications-to-gnome-launcher%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

Simple Scan not detecting my scanner (Brother DCP-7055W)Brother MFC-L2700DW printer can print, can't...