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:
Between the Whisker menu and the global menu is a Close window button, a (Un)maximize window button, and a drop down menu with further window actions.
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.
7 thoughts on “Global menu with window actions in XFCE”
Hi. I’m looking for the “drop down menu with further window actions” command. A search for “window operations menu from command line” leads to no solution. Thanks in advance.
Sorry for the confusion. There is not command which gives you the “drop down menu with further window actions”. As described above, you can create such a drop down menu be adding several menu actions (of your choice) to one launcher item. If there is more than one entry in a launcher, it is displayed as a drop down menu.
Each single action needs to be added as a `wmctrl` command.
I do consider all the ideas you have offered for your post. Th;8&#y217ere very convincing and will definitely work. Nonetheless, the posts are too quick for starters. Could you please extend them a little from subsequent time? Thanks for the post.
No, i am sorry. I think i have not made myself clear. I am searching for a command to show the “alt+space” menu (called windows operations menu i have learned). “xdotool key alt+space” does not work for me as a starter command. So i thought you have found an alternative in your third starter (inverse pyramid icon) from the left with wmctrl which you does not mention.
Alas, I have not found a command for that but neither have I searched for it. What you could do is, you could create such a drop down with the same actions by adding them one by one as wmctrl commands. I don’t think all of them are possible though.
what about http://goodies.xfce.org/projects/panel-plugins/xfce4-windowck-plugin ?
Very nice. xfce4-windowck seems to cover all features I was looking for. It might very well replace my current workaround. I will give it a try. Thanks for the tip.
Comments are closed.