You can divide the Unity launcher's items in application launchers and other items; network related, mounted volumes and such. The best is to only copy the application launchers to other users, since the other ones can be user specific and / or vary during the process.
Also note that if you copy a launcher's content to another user, possible local .desktop files (in
~/.local/share/applications) of locally installed applications for example, will not appear in the other user's Unity launcher.
Reading the current launcher's content
Having said that, you can read the current launcher's content by the command:
gsettings get com.canonical.Unity.Launcher favorites
The output is a list of all items from your current Unity launcher.
Setting a new launcher's content
To set a new content for the launcher, the following command is used:
gsettings set com.canonical.Unity.Launcher favorites <list_of_items>
Using a script to copy the launcher to another user's account
If we use a script to fetch the launcher items of the first user, write the result to a file, then log into the another user's account to run the script again (together with the file) to set the content into other user's account, it can be done in no time. The script below is made to do both, depending on the argument you give it (see further below).
How to use
- Copy the script below into an empty file, save it as
Open a terminal window in the "model user's" account, and run the script with the command:
python3 /path/to/copy_launcher.py get
get -argument of the command makes the script create a text file:
saved_launcher.txt, with the content of your current Unity launcher. The file is created in the same directory as where the script is located.
- Copy both the script and the
saved_launcher.txt file on (for example) an usb stick, but keep both files together in one and the same directory.
Log into other user's account, open a terminal and run the script by the command:
python3 /path/to/copy_launcher.py set
(mind the set argument)
command = sys.argv
curr_dir = os.path.dirname(os.path.abspath(__file__))
datafile = curr_dir+"/saved_launcher.txt"
get_current = subprocess.check_output(["gsettings", "get", "com.canonical.Unity.Launcher", "favorites"]).decode("utf-8")
return (str([item for item in eval(get_current) if item.startswith("application://")]),
[item for item in eval(get_current) if not item.startswith("application://")])
current_launcher = get_current()
with open(datafile, "w") as saved:
with open(datafile, "r") as saved:
app_section = read_saved(); fixed_section = get_current()
new_launcher = str(app_section+fixed_section)
subprocess.Popen(["gsettings", "set", "com.canonical.Unity.Launcher", "favorites", new_launcher ])
if command == "set":
elif command == "get":
If you're done, you copied the Unity launcher from one user to another.