Xfce dock & global menu - Nice and elegant

Updated: June 29, 2018

The one thing that unifies all Gtk-like desktops, and please don't crucify me over technical semantics, is that they all look alike. Unity, Gnome 3, MATE, Xfce, they (mostly) follow the macOS layout, with a top panel and menu, and an optional application dock at the bottom - or left side if you will. Not always, of course, but the idea is there. This makes for a somewhat different usage model compared to Windows or Plasma, but it's all right.

Recently, I've done a handful of testing with Xfce systems, including MX Linux and the Xubuntu Beaver, and I got meself thinking. Xfce normally goes for a more conventional UI, and I was curious to see if it's possible to make an Xfce desktop behave like a proper little Mac clone - or more like the parent distro, similar to what we had with Mutiny in MATE, plus the stuff we did in Ubuntu MATE 18.04. Just, y'know, because I can. So I sat down and started fiddling. Let me show you what happened.

Teaser

Dock

The notion of docks isn't new - I've written about this at length. Then, you can also use D2D and D2P extensions in Gnome 3, and no, those are not some NSFW acronyms or Star Wars fandom stuff right there. Testing in Xubuntu in this case, I already had a Plank dock, ported over from a Zesty instance into the Aardvark desktop following an in-vivo upgrade (and later Beaver, too). So we're already covered there, but then there's more.

Plank dock

Plank preferences

Global menu

The notion of the global menu is curious - it saves vertical space by presenting a contextual menu on the top panel based on the active application. It does take a little bit of time getting used to, but it works quite well overall. Unity has this natively, and it's the only Linux system to use the global menu effectively. The question is, can Xfce do something similar?

Apart from Mutiny, which seems to be the most complete and mature implementation yet, I did find several references to global menus for Xfce and MATE, including TopMenu and something called Vala AppMenu (not to be confused with the Vala panel). Same same but different. Then, both these are referred to by somewhat obsolete third-party repos, and there are several lengthy and non-trivial guides on how to set them up.

I started with AppMenu, and I decided to use the official repos only for the time being. Now, the old WebUpd8 repo does have an extra source, but it's last been updated for Ubuntu 16.10. So we will fall back to that only if the regular channels do not work. And work not they did indeed.

Anyway, after I installed a whole bunch of packages titled vala, appmenu and anything in between, plus the necessary log out and then log back in, there was no global menu option under panel items. I made sure I had installed all the right dependencies and all, but nothing.

sudo apt-get install xfce4-topmenu-plugin topmenu-gtk2 topmenu-gtk3

Ah well. Next I tried to manually compile from the GitHub project repo. I cloned the files, followed the online instructions and then:

-- Detecting C compile features - done
-- Looking for RPMTools... - rpmbuild NOT FOUND
CMake Error at cmake/FindVala.cmake:52 (string):

Really, rpmbuild? On a Debian-based system? WebUpd8 repo it is then. Only here I struggled some more. The full list of dependencies seems broken.

E: Package 'appmenu-qt5' has no installation candidate

But I did eventually make progress - xfce4-vala-appmenu-plugin ftw! This finally led me to some satisfactory results, and the necessary option did show in the top panel:

Add AppMenu

AppMenu, layout

Global menu works

Overall, AppMenu works, but it is not a seamless solution. Sometimes, it takes a full second for the menu to show, or you need to touch/jiggle the window border to make it "focus" so that the AppMenu actually knows which application is the active one. Not sure how the code is realized behind the curtains, but it does seem a little bit clunky.

It also got stuck once or twice - but only during the early testing; later on it was fine. I actually had to HUP the process to revive it, and Xfce even suggested removing the plugin as I had restarted it too many times.

roger 24480 13125 9 13:54 ? 00:00:02 /usr/lib/x86_64-linux-gnu/xfce4/panel/wrapper-2.0 /usr/lib/x86_64-linux-gnu/xfce4/panel/plugins/libappmenu-xfce.so 9 10485790 appmenu AppMenu Plugin Display AppMenu (Global Menu)

Too many plugin restarts

Then, after the initial woes, it was fine. I had to make several manual hacks, much like the WebUpd8 article suggests, so that Firefox and Thunderbird would also show correctly with the AppMenu. The concept of changing the application desktop files is similar to what we had in the Plasma icons-only guides.

GIMP with AppMenu

Very similar to what we've seen before. Plank config refers to *.desktop files under /usr/share/applications. For example, for Firefox:

cat firefox.dockitem
[PlankDockItemPreferences]
Launcher=file:///usr/share/applications/firefox.desktop

And then, you edit the file to include the necessary environment variable for Firefox (or Thunderbird), from Exec=firefox %u to Exec=env UBUNTU_MENUPROXY=0 firefox %u.

Firefox

And we're getting there:

Almost final looks

Nice 1

Dock again

Now, I decided to make the desktop even prettier and more efficient. I also installed Docky, to see how it fares compared to Plank, and added several widgets to the top panel. After all, the idea is to emulate macOS as much as possible, hence all these games. And yes, there are games, but they are fun and cool, and why not.

Docky misbehaved a little in the beginning. All in all, it's friendly and customizable and all, but it keeps its docklets on the right side, and I'd like to have the show desktop icon on the left. But then, it has more options than Plank. Also, it did not show a couple of icons, like Thunar and Terminal, and I had to copy desktop files into the local share (you can also symlink). Then, I removed docked icons and added them again, and finally it was working nicely.

cp /usr/share/applications/xfce4-terminal.desktop ~/.local/share/applications

Docky

Gallery

A few more nice screenshots, in no particular order:

With weather applet

Nice 2

Final looks

Conclusion

While the setup was far from trivial, I am rather pleased with the look & feel I've achieved. The choice of the dock is less important, so go with what you like - most won't let you launch more than a single instance of an application, btw. Both Docky and Plank were stable and behaved pretty well, and they are a good choice for our Mac-ified desktop.

On the global menu side, it was much trickier, with broken packages, missing dependencies, complex compilations, and whatnot. In the end, I had it all running, albeit with some odd glitches here and there. Not perfect, but quite reasonable. Very similar to Mutiny, I have to say, if not quite as straightforward to set up. And I do understand why this is not a default set in Xfce desktops, but it would be nice to have that. Xfce has grown a lot in the past few years, and it need not lurk in the corner shyly. It can proudly wear its laurels. There. Pretty looks and functionality. All covered. I hope you enjoyed this.

Cheers.

You may also like: