如何让 Unity2D 切换启动器的背光?

Nil*_*ann 6 launcher unity-2d

如何更改启动器图标的行为,以便仅在应用程序运行时才打开它们的背景?

如果应用程序处于活动状态,我希望突出显示背景或边框,就像我在 Unity 3D 上一样。

jok*_*ino 3

恐怕您无法在 Unity-2D 中切换启动器项目的背光。它显然仅适用于 Unity-3D,并且考虑到 Unity-2D 的大部分开发已停止,我认为没有任何可能开发此功能。

我还偶然发现了bug #753969,并发现了这个未经测试的补丁,如果您知道如何从源代码构建Unity-2D,它可能会帮助您在 Unity-2D 上获得可切换背光。


Raf*_*lak 3

我得到了它!多亏了 jokerdino 链接的补丁,我能够配置 Unity2D,使其按照所需的方式运行。

在此输入图像描述

我准备了一个自动应用所需更改的脚本。因此,您所需要做的就是下载并运行它。

重要提示:此脚本仅适用于 Ubuntu 12.04。因为它会修补 Unity 的文件,所以使用它需要您自担风险!特别是,如果它检测到并抱怨无法正确执行补丁,请不要强迫它应用补丁。

wget http://people.ubuntu.com/~rafalcieslak256/Unity2dBgToggle.sh
chmod +x Unity2dBgToggle.sh
./Unity3dBgToggle.sh
Run Code Online (Sandbox Code Playgroud)

该脚本将询问您 root 密码、修补两个文件并重新启动 Unity2D shell。

要恢复更改,只需重新安装包即可unity-2d-shell

注意:此更改将随着更新而丢失。然后您需要再次运行该脚本。

以下是脚本内容:

#!/bin/sh
cat > /tmp/IconTile.patch << EOF
--- IconTile.qml    2012-10-05 14:47:31.341845516 +0200
+++ IconTile.qml_new    2012-10-05 14:47:55.757966590 +0200
@@ -32,6 +32,7 @@
     property string selectedTileBackgroundImage: ""
     property string tileBackgroundImage: ""
     property string tileShineImage: ""
+    property alias tileBackgroundVisible: tileBackground.visible

     property color defaultBackgroundColor: "#333333"
     property color selectedBackgroundColor: "#dddddd"
EOF
cat > /tmp/LauncherItem.patch << EOF
--- LauncherItem.qml    2012-10-05 14:40:37.267792239 +0200
+++ LauncherItem.qml_new    2012-10-05 14:43:00.136500682 +0200
@@ -210,6 +210,7 @@
                 tileShineImage: (item.isBfb) ? "../launcher/artwork/squircle_shine_54.png" : ""
                 selectedTileBackgroundImage: (item.isBfb) ? "../launcher/artwork/squircle_base_selected_54.png" : ""

+                tileBackgroundVisible: running | launching
                 /* tile background fade in/out animation */
                 SequentialAnimation on backgroundOpacity {
                     NumberAnimation { to: 0.0; duration: 1000; easing.type: Easing.InOutQuad }
EOF
sudo patch /usr/share/unity-2d/shell/common/IconTile.qml < /tmp/IconTile.patch
sudo patch /usr/share/unity-2d/shell/launcher/LauncherItem.qml < /tmp/LauncherItem.patch
killall unity-2d-shell
unity-2d-shell > /dev/null 2>&1 &
Run Code Online (Sandbox Code Playgroud)