Bash script to add/remove desktop launchers to Unity launcher?

HDave

I'm trying to write a script to setup my desktop environment after a fresh install. One thing I can't figure out is how to pin/unpin items to the Unity Launcher from a bash script. Any ideas?

Ian B.

Use gsettings:

gsettings get com.canonical.Unity.Launcher favorites

Gives you a list of what's on the launcher:

['nautilus-home.desktop', '/opt/google/chrome/google-chrome.desktop', 'apps.desktop', 'geany.desktop', 'libreoffice-startcenter.desktop', 'gnome-terminal.desktop', 'gcalctool.desktop', 'Science.desktop', 'gimp.desktop', 'inkscape.desktop', 'ubuntu-software-center.desktop', 'alarm-clock-applet.desktop']

so you can do something like this in bash:

#!/bin/bash
myfile='firefox.desktop'
list=`gsettings get com.canonical.Unity.Launcher favorites`
newlist=`echo $list | sed s/]/", '${myfile}']"/`
gsettings set com.canonical.Unity.Launcher favorites "$newlist"

I tested and it works to add firefox to the launcher, however the icon doesn't display immediately. You'll have to log out/in or do a unity --replace command.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Bash script to add/remove desktop launchers to Unity launcher?

From Dev

bash script problem when run from desktop launcher

From Dev

Where are the Unity Launcher .desktop files?

From Dev

Where are the Unity Launcher .desktop files?

From Dev

Ubuntu / Unity attach script to Launcher

From Dev

Show the Unity Launcher, when desktop is opened

From Dev

Where is the documentation for the .desktop unity launcher file format?

From Dev

Desktop launcher won't launch the script

From Dev

Desktop launcher for script in terminal containing sudo command

From Dev

Python script cannot run from .desktop launcher

From Dev

Desktop launcher for Thunderbird-launching script in 19.10?

From Dev

Desktop file for bash script

From Dev

Possible to have 2 unity launchers?

From Dev

How to find the .desktop files for pinned applications in the Unity launcher?

From Dev

How to keep icon in unity launcher and remove from desktop?

From Dev

How to keep icon in unity launcher and remove from desktop?

From Dev

Unity desktop doesn't work, only wallpaper and launcher

From Dev

Desktop Launcher for Python Script Starts Program in Wrong Path

From Dev

How can I create launchers on my desktop?

From Dev

Ubuntu 19.10 : Invisible icons on my desktop launchers

From Dev

Where does unity keep information on the launchers in dash?

From Dev

Copy Unity Launchers from 14.04 to 16.04

From Dev

How can I combine application launchers into one launcher icon?

From Dev

How can I give a script its own icon in the Unity launcher?

From Dev

desktop launcher for ssh terminal

From Dev

Libgdx Desktop Launcher blank

From Dev

Run Matlab with a desktop launcher

From Dev

How to detect the desktop environment in a bash script?

From Dev

Desktop shortcut to Bash script crashes and burns

Related Related

  1. 1

    Bash script to add/remove desktop launchers to Unity launcher?

  2. 2

    bash script problem when run from desktop launcher

  3. 3

    Where are the Unity Launcher .desktop files?

  4. 4

    Where are the Unity Launcher .desktop files?

  5. 5

    Ubuntu / Unity attach script to Launcher

  6. 6

    Show the Unity Launcher, when desktop is opened

  7. 7

    Where is the documentation for the .desktop unity launcher file format?

  8. 8

    Desktop launcher won't launch the script

  9. 9

    Desktop launcher for script in terminal containing sudo command

  10. 10

    Python script cannot run from .desktop launcher

  11. 11

    Desktop launcher for Thunderbird-launching script in 19.10?

  12. 12

    Desktop file for bash script

  13. 13

    Possible to have 2 unity launchers?

  14. 14

    How to find the .desktop files for pinned applications in the Unity launcher?

  15. 15

    How to keep icon in unity launcher and remove from desktop?

  16. 16

    How to keep icon in unity launcher and remove from desktop?

  17. 17

    Unity desktop doesn't work, only wallpaper and launcher

  18. 18

    Desktop Launcher for Python Script Starts Program in Wrong Path

  19. 19

    How can I create launchers on my desktop?

  20. 20

    Ubuntu 19.10 : Invisible icons on my desktop launchers

  21. 21

    Where does unity keep information on the launchers in dash?

  22. 22

    Copy Unity Launchers from 14.04 to 16.04

  23. 23

    How can I combine application launchers into one launcher icon?

  24. 24

    How can I give a script its own icon in the Unity launcher?

  25. 25

    desktop launcher for ssh terminal

  26. 26

    Libgdx Desktop Launcher blank

  27. 27

    Run Matlab with a desktop launcher

  28. 28

    How to detect the desktop environment in a bash script?

  29. 29

    Desktop shortcut to Bash script crashes and burns

HotTag

Archive