Apply changes or restart Unity dash/launcher/... without reboot or logout
Solution 1
Press Alt+F2 type unity
and press Enter.
Solution 2
-
Unity is just a Compiz plugin, you can reload it using:
compiz --replace
Or to let you close terminal
compiz --replace & disown
To confirm, you can check:
$ file `which unity` /usr/bin/unity: Python script, ASCII text executable $ more /usr/bin/unity
-
Another way, light reload only the plugin (very quick)
-
Create the
compiz_plugin_reloader
scriptSource: iXce’s blog: Compiz plugin reloader
#!/usr/bin/env python '''Compiz plugin reloader (through compizconfig) Copyright (c) 2007 Guillaume Seguin <[email protected]> Licensed under GNU GPLv2''' import compizconfig from sys import argv, exit from time import sleep if __name__ == "__main__": if len (argv) < 2: print "Usage : %s plugin1 [plugin2 ... pluginN]" % argv[0] exit (2) plugins = argv[1:] context = compizconfig.Context (basic_metadata = True) print "Unloading " + " ".join (plugins) for plugin in plugins: if plugin not in context.Plugins: print "Warning : %s plugin not found" % plugin plugins.remove (plugin) continue context.Plugins[plugin].Enabled = False if len (plugins) == 0: print "Error : no plugin found" exit (1) context.Write () print "Waiting for settings update" sleep (2) print "Loading " + " ".join (plugins) for plugin in plugins: context.Plugins[plugin].Enabled = True context.Write ()
-
Fix permissions
chmod +x compiz_plugin_reloader
-
Run as:
./compiz_plugin_reloader unityshell
-
Related videos on Youtube
Byte Commander
Ask Ubuntu moderator♦, IT student and DevOps engineer. I love Ubuntu, Python, good music and coffee, although not necessarily in that order. You can easily contact me in the Ask Ubuntu General Room most of the time, or on Discord as @ByteCommander#2800. I'd also love to invite you to my Ubuntu Hideout Discord Server btw. PS: My profile picture is derived from "Wolf Tribals" by user HaskDitex (DeviantArt.com), which is under creative Commons 3.0 License. Currently I'm using the character "Dregg Morriss" from the game "Medieval Cop" by Vasant Jahav ("Gemini Gamer"). It can be found here.
Updated on September 18, 2022Comments
-
Byte Commander over 1 year
I was in the situation that an application I had was not available in the Unity applications lens after I removed a custom
.desktop
launcher file in my home directory that had overridden the system-wide one.My problem was that I needed to apply those changes and update in this case the database of installed
.desktop
files, but other similar scenarios are also imaginable.So what could I have done (and do the next time) instead of rebooting or logging out and back in to update the Unity configuration and force it to reload and reinitialize all of its stuff?
I am on 15.10, so
unity --reset &
does not work because it's deprecated.I then tried
unity --replace &
instead, but that crashed my desktop and rendered my TTY7 unusable. It first flashed dark and looked like it was restarting Unity and restoring the desktop, but then it did not react to anything any more. Switching to TTY1 and back left me with a black screen plus mouse cursor. After rebooting via TTY1 login andreboot
, it worked again and Unity even recognized my application now.But if I would have been in a situation where a reboot or logout was no option, what would have been my way to go?
-
doug over 8 yearsyou can try
setsid unity
, it will 'refresh' unity. On one of my installs it does so, the other it results in a log out. Others seem to say it resets back to defaults, does not here in either case.
-
-
Byte Commander over 8 yearsSimple but genial. I have no idea why nobody thought of this earlier. I don't know how much of Unity gets restarted, but it's definitely enough to recognize overridden .desktop files. Thank you! I'll award you the bounty in a few days, waiting for further responses.
-
Byte Commander over 8 yearsCongratulations to your first bounty @padlyuck! :D
-
George D over 7 yearsCan you please elaborate on this ? What exactly does it do?
-
padlyuck over 7 yearsI found this solution here askubuntu.com/questions/495997/how-to-properly-restart-unity . I can not say for sure what makes this command. It decided my problem with no side effects, so I suggested it as a solution to this issue.
-
davidA almost 7 yearsBeware - I did this on 14.04 and it shut down X (and all apps) and I had to log in again.