One thing I really like about Ubuntu’s Unity desktop is that is very efficient in regards to vertical screen real estate. The global menu and decorationless windows when maximized save a lot of precious pixels. The omission of these nice features in other desktop environments mostly was what prevented me from ditching Unity so far. However these days are no more. I’ve found the perfect solution with XFCE.
Global menu in XFCE
I’ve used the update of Ubuntu to version 15.04 for a clean new installation and switched from Unity to XFCE. One of the reasons for choosing XFCE was that a working global menu panel plugin is available. Since I use a derivate of Ubuntu, I’m able to use the PPA maintained by webupd8. Webupd8 is also where installation instructions can be found.
Hide window decoration
In order to maximize vertical screen real estate for content, I additionally have enabled “Hide frame of windows when maximized” and “Hide title of windows when maximized”. These options are accessible in Window Manager Tweaks which should come pre-installed with Xubuntu.
Now there are no window border and no title bar around maximized windows. The only issue that comes with this change is that there is no easy way to restore windows to unmaximized state anymore. With some programs it’s even hard to close windows. Both options are usually accessible as window actions in the title bar. To reintroduce this functionality I use custom launchers in the panel.
Close and maximize as launcher
XFCE has the possibility to add a launcher item to a panel. It is meant to start certain programs or execute specific commands. Think of it as the pinned shortcuts to launch programs in other desktop environments.
Now we only need a command that has the ability to close a window, maximize it, etc. Luckily there is a program which does exactly that: wmctrl. wmctrl acts as a command line utility to speak with many window managers, XFCE among them. It can be used to basically do anything with any window that XFCE can do. So it certainly can close a window, maximize and restore it. Perfect for my needs.
First install wmctrl with the following command (or search for wmctrl in the Software Center).
sudo apt-get install wmctrl
To close the current window the following command is necessary:
wmctrl -c ":ACTIVE:"
And toggling the maximized state is done with
wmctrl -r ":ACTIVE:" -b toggle,maximized_vert,maximized_horz
I haven’t found one window attribute to maximize both vertically and horizontally at once but working with both dimensions simultaneously seems perfectly fine. There are many more actions to be found in the manual of wmctrl (‘man wmctrl’). Go ahead and have a look to find out how to resize windows, minimize them, and what not.
Now the only thing left to do is create launcher items with the correct commands. Right click on the panel which you want to add the buttons to and select Panel > Add new items …. Select “Launcher” in the list and click Add. If the button is not in your desired position, you can change that by right-clicking on it and selecting Move.
With a right click on the launcher you can change its Properties. Here you need to Add a new empty item and fill in one of the commands from above. You can also select a fitting icon. I’ve found the best options in the category Action Icons.
You can add new items for each of the window functions that you want in your panel. However if you add more than one item to the same launcher, they appear in a drop-down menu. If you want the icons next to each other, you need to create separate launcher items for each of them.
This is the result:
For me this is a perfectly good solution. However there are some issues which I did not solve.
- Buttons are always shown even if there is no window on the current desktop. (Un)maximize does nothing, while close shows the shutdown menu.
- Icons don’t changed based on maximized state. You are stuck with the same icon for maximize as for restore.