How do I remove icons from the Unity launcher using a script? [duplicate]

Solution 1:

  • Get the list of launcher items:

    gsettings get com.canonical.Unity.Launcher favorites
    

    This will return something like:

    ['nautilus-home.desktop', 'gnome-terminal.desktop', 'gedit.desktop']
    

    which you can manipulate in your script (eg. using sed), and then

  • Set the launcher item list:

    gsettings set com.canonical.Unity.Launcher favorites "['gimp.desktop']"
    

    Don't forget the quotes.

Solution 2:

try:

unity --replace

after

gsettings set com.canonical.Unity.Launcher favorites "['firefox.desktop']"

working on 12.04