Tuesday, March 6, 2007

Beryl without emerald...

Ok, so the original ebuild for beryl meta x11-wm/beryl forced the user to require emerald and consequently emerald-themes and libwnck. However, since both Heliodor and Aquamarine are available as alternatives to emerald, I felt it was time to provide a choice to the user.

The ebuild would allow you to choose to add aquamarine (via USE="kde") and/or heliodor (via USE="gnome") but not to drop emerald. This was probably a good thing while aquamarine and heliodor we fairly new and maybe not as stable. Now, they seem pretty stable, so if you want to make the switch to one of those and not have emerald, it should be possible while using the meta ebuild for beyl.

To make this happen, we needed two things:

1) Modify the beryl meta ebuild
2) Patch the beryl-manager to hide the emerald theme manager option (if not installed)

The second item is purely cosmetic, but needed to be done.

Here's the original patch I applied to beryl-manager-0.1.9999.2:


--- beryl-manager-0.1.9999.2/src/main.c 2007-02-13 16:14:41.000000000 -0330
+++ beryl-manager-0.1.9999.2/src/main.c.new 2007-03-05 12:17:29.000000000 -0330
@@ -1149,6 +1149,8 @@
gtk_widget_show(mitem);
g_signal_connect(mitem, "activate", G_CALLBACK(startApp),
"beryl-settings");
+ if (detect_app("emerald-theme-manager"))
+ {
mitem = gtk_image_menu_item_new_with_label(_("Emerald Theme Manager"));
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(mitem),
make_image(PIXMAPS_DIR "/emerald-theme-manager-icon.png"));
@@ -1156,6 +1158,7 @@
gtk_widget_show(mitem);
g_signal_connect(mitem, "activate", G_CALLBACK(startApp),
"emerald-theme-manager");
+ }

mitem = gtk_separator_menu_item_new();
gtk_menu_shell_append(GTK_MENU_SHELL(menu), mitem);


I applied this patch to use detect_app from beryl-manager to try and see if emerald is installed. If not, then do not add the menu item. Pretty simple, but effective fix. Nesl247 has since modified this patch and committed to upstream, so it's in berl SVN now and will be available in the next release candidate and/or beryl 0.2.0.

Now that we have a clean beryl-manager, we can modify the beryl meta ebuild to remove the dependancy on emerald. We need to be careful, as the user should choose at least one window decorator to use. So here is the diff showing the changes:


--- beryl-0.1.9999.2.ebuild 2007-03-06 10:42:45.000000000 -0330
+++ /usr/portage/local/layman/xeffects/x11-wm/beryl/beryl-0.1.9999.2.ebuild 2007-03-05 16:54:52.000000000 -0330
@@ -11,16 +11,33 @@
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
-IUSE="kde gnome"
+IUSE="kde gnome noemerald"

RDEPEND="~x11-plugins/beryl-plugins-${PV}
- ~x11-wm/emerald-${PV}
+ !noemerald? ( ~x11-wm/emerald-${PV} )
kde? ( ~x11-wm/aquamarine-${PV} )
gnome? ( ~x11-wm/heliodor-${PV} )
~x11-misc/beryl-settings-${PV}
~x11-misc/beryl-manager-${PV}
>=x11-libs/cairo-1.2"

+pkg_setup() {
+ if use noemerald && ! use kde && ! use gnome; then
+ echo
+ ewarn "You have not selected any window decorator. For the meta"
+ ewarn "install, you should choose at least one of either emerald,"
+ ewarn "kde (aquamarine) or gnome (heliodor) decorators. Although"
+ ewarn "you may proceed without, you will have no window decorations"
+ ewarn "unless you enable emerald, kde, or gnome (unless provided"
+ ewarn "externally via another package)."
+ echo
+ ewarn "To enable the default window decorator, please disable the"
+ ewarn "noemerald use flag. Alternatively, set use kde or gnome for"
+ ewarn "aquamarine and/or heliodor, respectively."
+ echo
+ fi
+}
+
pkg_postinst() {
ewarn "DO NOT report bugs to Gentoo's bugzilla"
einfo "Please report all bugs to http://trac.gentoo-xeffects.org"


What did we do here? Well, we added a noemerald use flag. The reason for noemerald is that we still want the default behaviour to be "let's install emerald" and optionally add aquamarine and/or heliodor. If the user sets the use flag noemerald explicitly, then they do not get emerald by default. This should prevent installs without a window decorator.

I also added a check/warning if the user mistakenly chose no window decorator by enabling noemerald and not setting kde or gnome use flags.

Anyway, that's the current update...