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

JLT*_*LTD 17 unity compiling launcher

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

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

我希望它像用“unity.launcher.show()”注释掉这一行并重新编译一样简单:-)

谢谢!

JLT*_*LTD 20

我自己的问题的答案是:

  • Launcher.cpp、unityshell.cpp、DashController.cpp 和 HudController.cpp 用于统一版本 < 7.4.0 和
  • 统一版本 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 不显示启动器

在此处输入图片说明

0. 对于不耐烦

此脚本应至少适用于 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
Run Code Online (Sandbox Code Playgroud)

然后重新启动 unity,你就完成了。

1. 寻找正确的源文件

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

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

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

2. 获取来源

我必须手动安装包 xserver-xorg-video-dummy-lts-{your HWE version} 来解决一些依赖问题,然后才能安装 build-deps 以实现统一:

sudo apt-get install xserver-xorg-video-dummy-lts-{put your HWE name here}
Run Code Online (Sandbox Code Playgroud)

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

dpkg-query -l xserver*-lts-* | grep ^ii  | cut -d" " -f3 | rev | cut -d- -f1 | rev | sort -u
Run Code Online (Sandbox Code Playgroud)

之后剩下的工作:

sudo apt-get build-dep unity
apt-get source unity
cd unity-*
Run Code Online (Sandbox Code Playgroud)

3. 在 Launcher.cpp 中放一行

find . -iname launcher.cpp -exec gedit {} \;
Run Code Online (Sandbox Code Playgroud)

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

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

这足以不再显示启动器。但是仪表板和显示器仍会在屏幕左侧留下未使用的发射器位置。

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

对于统一 < 7.4.0:

使用编辑器将 unityshell.cpp、DashController.cpp 和 HudController.cpp 中所有出现的“launcher_width = 0; //”替换为“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
Run Code Online (Sandbox Code Playgroud)

对于统一 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];
}
Run Code Online (Sandbox Code Playgroud)

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

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

在我的情况下(12.04,unity 5.20.2)我不得不使用

EDITOR=nano debchange --newversion $(apt-show-versions unity | cut -d " " -f2) 
Run Code Online (Sandbox Code Playgroud)

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

6.编译安装

然后我用这个重新编译:

dpkg-buildpackage -rfakeroot -d -us -uc -b
Run Code Online (Sandbox Code Playgroud)

安装了新包:

sudo dpkg -i ../unity_*.deb
Run Code Online (Sandbox Code Playgroud)

(据我观察和测试,实际需要的唯一文件是

find . -name libunityshell.so | grep unity/usr/lib/compiz/libunityshell.so
Run Code Online (Sandbox Code Playgroud)

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

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
Run Code Online (Sandbox Code Playgroud)

就是这样。重新启动 unity 并且启动器消失了!


B. 如果您更愿意信任并获得二进制文件

如果您更喜欢获得二进制文件以及您的统一版本和 PC 架构的组合

unity --version
getconf LONG_BIT
Run Code Online (Sandbox Code Playgroud)

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

32位

64位

并在下载后检查 deb 文件

md5sum unity_*.deb
Run Code Online (Sandbox Code Playgroud)

结果应该是其中之一

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
Run Code Online (Sandbox Code Playgroud)

然后安装包

sudo dpkg -i unity_*.deb
Run Code Online (Sandbox Code Playgroud)

将启动器设置为自动隐藏并重新启动统一。就是这样!

如果出现问题并且没有开始统一:

sudo apt-get install --reinstall unity
Run Code Online (Sandbox Code Playgroud)

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

echo "unity hold" | sudo dpkg --set-selections
Run Code Online (Sandbox Code Playgroud)


我的电脑上只编译了文件“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/')
Run Code Online (Sandbox Code Playgroud)