Create GNOME desktop entries for all users - gHacks Tech News

Create GNOME desktop entries for all users

Linux, being a multi-user system, begs for you to configure it such that all users initially experience exactly what you want them to experience. One option you have, which is very easy to do, is to create specific desktop launchers that are added to all new users upon first login. Naturally those users can then delete those launchers, but it gives you the opportunity to add launchers for things like help documentation or specific links to specific web sites.

But how is this particular task done? There isn't a specific GUI tool for it so, as you would imagine, you will be using a combination of GUI and command tools to get this process complete. It's fast, it's easy, and the end result could save you a lot of time when deploying Linux GNOME desktops.

Create your launchers

Figure 1

The first thing you must do is create the necessary launchers. In order to create a launcher in GNOME right click anywhere on the desktop and select Create Launcher. When you do this a new window will open (see Figure 1) where you enter all of the details for the launcher.

Say you want to create a launcher that will open the default browser to the Ghacks website. For this you would select Location from the "Type" drop down, give the launcher a name, enter the Ghacks URL for the location, and then a comment. You can customize that with a nice icon by clicking the icon button and selecting an image.

Once you have clicked okay the launcher is ready for you to use. But how do you enable this for all new users? Let's take a look.

Make it available

If you open up a terminal window and then change into the ~/Desktop directory, you will see a file called (in my case) Ghacks.desktop. The contents of this file look like:

#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Link
Icon[en_US]=gnome-panel-launcher
Name[en_US]=Ghacks
URL=https://www.ghacks.net
Comment[en_US]=Ghacks
Name=Ghacks
Comment=Ghacks
Icon=/home/jlwallen/Pictures/97px-Ubuntu-logo.svg.png

If you know what you are doing, you can edit these (and create them) manually.

Okay, so you have your launcher, what do you do? Simple...from the command line you need to copy the launchers you want added to all new users desktops to the /etc/skel directory. By default, you will see a launcher already in their called examples.desktop. That launcher really doesn't do anything - it just serves as a model for you to use to create launchers. As you've seen here, you don't really need a sample.

Create as many launchers, and as many types of launchers as you need. When a new user logs in for the first time, those launchers will be copied to their desktop for their use.

Final thoughts

The Linux desktop is a perfect example of real flexibility. You can make the desktop be and do anything you want. And, as an administrator, you can easily set up your new users such that they be greeted by the exact launchers you want them to have on their desktop. By taking advantage of this feature you can help to ensure your Linux desktop users start off on the right foot.





  • We need your help

    Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

    We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.

    If you like our content, and would like to help, please consider making a contribution:

    Comments

    1. Vikram said on March 30, 2011 at 7:50 am
      Reply

      How do i setup a launcher that launches an application/script that is to placed in the user’s $HOME???
      Creating a Launcher with it’s command as /home/`whoami`/application doesn’t work

    2. Yogesh Mhatre said on August 18, 2011 at 4:46 pm
      Reply

      Vikram …

      Instead of ‘whoami’ use a wildcard ‘$USER’

    3. michal said on July 27, 2013 at 3:08 am
      Reply

      How about add shortcuts to all _existing_ users?

    4. Shadychris said on April 1, 2014 at 8:49 am
      Reply

      This doesn’t seem to work on CentosOS 6.5. I have a working launcher for Matlab on my desktop, but copying it to the /etc/skel/ directory does_not_install the launcher on newly created accounts desktops.

    5. Shadychris said on April 1, 2014 at 9:11 am
      Reply

      OK – so now I just found out why it doesn’t work……
      You have omitted to mention the most vital piece of info in this article. If you want a launcher to appear on all new users Desktops you first have to create a folder /etc/skel/Desktop !!!!!!
      Simply placing the launcher in /etc/skel as the article instructs to do will place the launcher in the new users /home/******/ directory and NOT on their desktop!

      1. Martin Brinkmann said on April 1, 2014 at 10:06 am
        Reply

        Chris, thanks for letting us know about this. This will certainly help other users who run into the same issue.

    Leave a Reply