在没有启动器的情况下编译Unity

我想修改统一以不显示发射器(左侧栏)。 我不是在寻找能让发射器在某些情况下可见的任何解决方案。 我真的希望它完全消失。 这是我未婚夫的礼物,我希望为她的linux笔记本电脑实现最高的女性接受系数,该笔记本电脑正在运行一个带有花哨图标的dockerdocker,使它看起来像来自那个知名的果味公司。

关于我应该学习哪些包和哪些源文件的任何提示?

我希望它能像使用“unity.launcher.show()”评论一行一样简单并重新编译:-)

谢谢!

我自己的问题的答案是:

  • 统一版本<7.4.0的Launcher.cpp,unityshell.cpp,DashController.cpp和HudController.cpp以及
  • 统一版本7.4.0的Launcher.cpp和UnitySettings.ccp

来自统一源包。

但我回答的不仅仅是因为每个寻找我的问题答案的人都会对知道如何处理这些源文件感兴趣。

内容:
A.编译自己
B.获取二进制文件

免责声明:我没有任何线索所有这一点仅在12.04进行了测试,统一为5.20.2,14.04为统一7.2.6,15.10为统一7.3.2,16.04为统一7.4.0

A.编译Unity以不显示启动器

在此处输入图像描述

为了不耐烦

此脚本至少应在12.04,14.04和15.10下运行。 根据需要在最后取消注释:

#!/bin/bash mkdir temp-build-dir; cd temp-build-dir export HWE=$(dpkg-query -l xserver*-lts-* | grep ^ii | cut -d" " -f3 | rev | cut -d- -f1 | rev | sort -u) sudo apt-get install unity xserver-xorg-video-dummy-lts-$HWE sudo apt-get build-dep unity sudo apt-get install apt-show-versions devscripts dpkg-dev fakeroot nano apt-get source unity cd unity-* # you can leave the comment field in the changelog empty but dont forget to save the file EDITOR=nano debchange --newversion $(apt-show-versions unity | cut -d " " -f2) find . -iname Launcher.cpp -exec sed -i -e '1,/void Launcher::DrawContent(nux::GraphicsEngine/b' -e '0,/{/s//{\nreturn;/' {} \; # for unity 7.4.0 comment out this for statement and read the explanation Nr. A.4 for i in unityshell.cpp DashController.cpp HudController.cpp; do find . -iname $i -exec sed -i -e 's/launcher_width =/launcher_width =0; \/\//' {} \; done dpkg-buildpackage -rfakeroot -d -us -uc -b sudo dpkg -i ../unity_*.deb # For 12.04 use: # gconftool --type Integer --set /apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode 1 # For 14.04 use: # dconf write "/org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode" 1 

然后重启团结,你就完成了。

1.寻找合适的源文件

经过一些试验和错误,我发现要更改的源文件是

  • Launcher.cpp – >添加一行不再显示启动器
  • unityshell.cpp,DashController.cpp和HudController.cpp – >将启动器的宽度设置为零

所有四个文件都包含在源包“unity”中。

2.获取资源

我必须手动安装软件包xserver-xorg-video-dummy-lts- {你的HWE版本}以实现一些依赖性问题,然后才能安装build-deps for unity:

 sudo apt-get install xserver-xorg-video-dummy-lts-{put your HWE name here} 

您可以使用以下命令找到HWE的名称(版本):

 dpkg-query -l xserver*-lts-* | grep ^ii | cut -d" " -f3 | rev | cut -d- -f1 | rev | sort -u 

之后剩下的工作:

 sudo apt-get build-dep unity apt-get source unity cd unity-* 

3.在Launcher.cpp中放一行

 find . -iname launcher.cpp -exec gedit {} \; 

查找函数“void Launcher :: DrawContent(nux :: GraphicsEngine&GfxContext,bool force_draw)”并输入“return;” 只是在它的身体开始像这样:

 void Launcher::DrawContent(nux::GraphicsEngine& GfxContext, bool force_draw) { return; //dont show launcher anymore ... 

这足以不再显示发射器了。 但是破折号和hud将离开屏幕左侧的发射器未使用的地方。

4.在unityshell.cpp,DashController.cpp和HudController.cpp / UnitySettings.cpp中将启动器宽度设置为零

对于统一<7.4.0:

使用编辑器在unityshell.cpp,DashController.cpp和HudController.cpp中将“launcher_width =”的所有出现替换为“launcher_width = 0; //”。
或者只使用此命令

 for i in unityshell.cpp DashController.cpp HudController.cpp; do find . -iname $i -exec sed -i -e 's/launcher_width =/launcher_width =0; \/\//' {} \; ; done 

对于统一7.4.0:

找到文件UnitySettings.cpp并替换LauncherSize末尾的返回值,如下所示:

 int Settings::LauncherSize(int monitor) const { if (monitor < 0 || monitor >= (int)monitors::MAX) { LOG_ERROR(logger) << "Invalid monitor index: " << monitor << ". Returning 0."; return 0; } return 0; // pimpl->launcher_sizes_[monitor]; } 

只有当您希望破折号显示在屏幕左侧时,才需要这样做,而没有任何已用于启动器的边距。

5.在更改日志中设置正确的版本

在我的情况下(12.04,统一5.20.2)我必须使用5.20到5.20.2将统一源的版本改为

 EDITOR=nano debchange --newversion $(apt-show-versions unity | cut -d " " -f2) 

在编译之前避免在安装时破坏依赖项。 不要忘记保存文件。

6.编译并安装

然后我用这个重新编译:

 dpkg-buildpackage -rfakeroot -d -us -uc -b 

安装新包装:

 sudo dpkg -i ../unity_*.deb 

(据我所知,测试它,实际需要的唯一文件是

 find . -name libunityshell.so | grep unity/usr/lib/compiz/libunityshell.so 

用新的替换/usr/lib/compiz/libunityshell.so就足够了,但是如果你想确保只安装上面写的新的Unity包。)

7.将启动器设置为自动隐藏

 # For 12.04: gconftool --type Integer --set /apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode 1 # For 14.04: dconf write "/org/compiz/profiles/unity/plugins/unityshell/launcher-hide-mode" 1 

而已。 重新启动团结,发射器消失了!

B.如果您更愿意信任并且只是获取二进制文件

如果你更喜欢二进制和你的统一版本和PC架构的组合

 unity --version getconf LONG_BIT 

可以在下面找到,只需下载正确的包

32位

  • unity_5.20.0-0ubuntu3_i386_nolauncher.deb
  • unity_5.20.2_i386_nolauncher.deb
  • unity_7.2.6 + 14.04.20151021-0ubuntu1_i386_nolauncher.deb
  • unity_7.3.2 + 15.10.20151016-0ubuntu1_i386_nolauncher.deb

64位

  • unity_5.20.0-0ubuntu3_amd64_nolauncher.deb
  • unity_7.2.6 + 14.04.20160408-​​0ubuntu1_amd64_nolauncher.deb
  • unity_7.3.2 + 15.10.20151016-0ubuntu1_amd64_nolauncher.deb
  • unity_7.4.0 + 16.04.20160715-0ubuntu1_amd64_nolauncher.deb

并在下载后检查deb文件

 md5sum unity_*.deb 

结果应该是其中之一

 0a5f7fc9255262e5803656d83f84f7c5 unity_5.20.0-0ubuntu3_amd64_nolauncher.deb 717dc41f4cad6410c997e1014f5f3f1d unity_5.20.0-0ubuntu3_i386_nolauncher.deb 594eb8b87f8a56697865c051c4db5073 unity_5.20.2_i386_nolauncher.deb 8ed070afa4d7d6da8222d03b8ad5ebf3 unity_7.2.6+14.04.20160408-0ubuntu1_amd64_nolauncher.deb abd32e40e8a10bd603b9fc44014cb179 unity_7.2.6+14.04.20151021-0ubuntu1_i386_nolauncher.deb 43c56b889028bf368da01780c0a099b9 unity_7.3.2+15.10.20151016-0ubuntu1_amd64_nolauncher.deb 64474d1a8280ed4113d748a57422ddcc unity_7.3.2+15.10.20151016-0ubuntu1_i386_nolauncher.deb 4fecdb9b4f590e00609baa3b98f55cc0 unity_7.4.0+16.04.20160715-0ubuntu1_amd64_nolauncher.deb 

然后安装包

 sudo dpkg -i unity_*.deb 

将启动器设置为自动隐藏并重新启动Unity。 而已!

如果出现问题并且团结没有开始:

 sudo apt-get install --reinstall unity 

但如果一切正常,您可能希望阻止更新新包:

 echo "unity hold" | sudo dpkg --set-selections 

我的电脑上只编译了“unity_5.20.2_i386_nolauncher.deb”文件。 其他deb文件是在所谓的“云计算机”(因为机房看起来像云……)上使用脚本的这种变体制作的:

 #!/bin/bash sudo apt-get update sudo apt-get -y dist-upgrade sudo apt-get -y build-dep unity sudo apt-get -y install unity devscripts dpkg-dev fakeroot nano mkdir temp-build-dir; cd temp-build-dir rm -r unity-* apt-get source unity cd unity-* find . -iname Launcher.cpp -exec sed -i -e '1,/void Launcher::DrawContent(nux::GraphicsEngine/b' -e '0,/{/s//{\nreturn;/' {} \; # for unity 7.4.0 comment out this for statement and read the explanation Nr. A.4 for i in unityshell.cpp DashController.cpp HudController.cpp; do find . -iname $i -exec sed -i -e 's/launcher_width =/launcher_width =0; \/\//' {} \; done dpkg-buildpackage -rfakeroot -d -us -uc -j2 -b cp ../unity_*.deb ../$(echo ../unity_*.deb | sed -e 's/.deb$/_nolauncher.deb/')