应用更改或重新启动Unity dash / launcher / …而无需重启或注销
我在我的主目录中删除了覆盖系统范围的自定义.desktop
启动程序文件之后,我在Unity应用程序镜头中找不到我的应用程序。
我的问题是我需要应用这些更改并在这种情况下更新已安装的.desktop
文件的数据库,但其他类似的方案也是可以想象的。
那么我可以做什么(并在下一次做)而不是重新启动或注销并重新登录以更新Unity配置并强制它重新加载并重新初始化所有内容?
我在15.10,所以unity --reset &
并且不起作用,因为它已被弃用。
然后我尝试了unity --replace &
,但是这使我的桌面崩溃并使我的TTY7无法使用。 它首先闪现黑暗,看起来它正在重新启动Unity并恢复桌面,但随后它不再对任何东西做出反应。 切换到TTY1并使用黑色屏幕和鼠标光标向后退我。 通过TTY1登录reboot
并reboot
,它再次工作,Unity甚至现在识别我的应用程序。
但是,如果我一直处于重新启动或注销无法选择的情况下,那么我还有什么办法呢?
按Alt + F2键入unity
,然后按Enter键 。
-
Unity只是一个Compiz插件,您可以使用以下命令重新加载:
compiz --replace
或者让你关闭终端
compiz --replace & disown
要确认,您可以检查:
$ file `which unity` /usr/bin/unity: Python script, ASCII text executable $ more /usr/bin/unity
-
另一种方式,轻量重新加载只是插件(非常快)
-
创建
compiz_plugin_reloader
脚本来源: iXce的博客:Compiz插件重新加载器
#!/usr/bin/env python '''Compiz plugin reloader (through compizconfig) Copyright (c) 2007 Guillaume Seguin
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 () -
修复权限
chmod +x compiz_plugin_reloader
-
运行方式:
./compiz_plugin_reloader unityshell
-