Easily create Application Launchers in Gnome-3 using the Terminal

This is just an easy, quick and short way to create Application Launchers (.desktop files) in GNOME using a pre-installed text editor in most UNIX and Linux systems called Pico.

Step 1: Create the file in your preferred directory (Mine is my home folder) then hit Enter.

Step2: Edit the file.

As you can see in the screenshot, the format is very short and simple. In the head of the file you have to type [Desktop Entry] followed by four parameters: The first for your type of file which is Application, the second is the name for your launcher, the third is the name (If is a bin file) or path to your executable file, and the fourth is the icon which also can be set with its name if you are going to use one from the system. Hit ctrl-x, then ‘y’ to save the file.

Step 3: Make the file executable using chmod +x

Done! :)


Python booleans in gconf with pygtk Message dialog

A small Python Script I use on my VM with GNOME-2 to prevent myself from deleting one of the Desktop Panels by accident. In GNOME 2 you can lock/unlock this panels by editing a GConf schema so you can avoid a wrong selection whenever you launch the right click menu to customize this widgets.

The script creates a Gtk Message Dialog with the options “Yes” or “No”. In my case, I made an executable icon (.desktop file) for this script and placed it into the bottom panel so it can be easily accessed.

You can also modify this script very easy if you want to try it with a different Gconf Setting by replacing the global variable for the schema and/or the string values.


#! /usr/bin/python

import gtk, gconf

KEY = "/apps/panel/global/locked_down"

class Switcher(gtk.MessageDialog):

    def __init__(self):
        client = gconf.client_get_default()
        value  = not ( client.get_bool(KEY) )
        state  = "lock down" if value else "unlock"

        gtk.MessageDialog.__init__(self, None, 0,
                                   gtk.MESSAGE_QUESTION,
                                   gtk.BUTTONS_YES_NO,
                                  "Gnome Panels Lock")
        self.format_secondary_text(
   "Are you sure you want to %s Gnome Panels?" % state)

        if self.run() == gtk.RESPONSE_YES:
            client.set_bool(KEY, value)
        self.destroy()
if __name__ == "__main__":
    Switcher()


Follow

Get every new post delivered to your Inbox.