6

Metacity: Snap

view full story
linux-howto

http://blogs.gnome.org – There has been some discussion on the last post about implementing functionality similar to Microsoft’s “Aero Snap”.  Your chronicler has never used Windows 7, but the idea is demonstrated in this video.  It appears to mean that: when a window is dragged to the left or right of the screen, it is vertically maximised, and resized horizontally to half the screen width; when a window is dragged to the top of the screen, it is maximised; there are hints elsewhere that dragging to a corner minimises, but this is unconfirmed at present. There are apparently several people who would like this implemented on the free desktop. One option is to do it with an external tool.  This is the route taken by this tutorial by gotsanity.  It’s a simple matter of monitoring the root window for configure events; the link goes to a program which will demonstrate the general principle.  Making that program into a daemon which will solve this problem is only a matter of adding code to detect a window crossing screen borders, and some kind of payload for when one does. The advantages of this approach are: that it will work with any window manager, and that we have previously said that almost anything which can be implemented externally should be, to preserve the lightweight nature of Metacity. The disadvantages, however, are: the need to keep a separate daemon running; this is a good deal more of a long-term problem than launching one-shot processes on a keystroke, the difficulty in adding the grey box that tells you you’re about to trigger the effect (though this is certainly not impossible with such a method), and the change in the moment of triggering from after you release the button to during; this is a side-effect of the modern ability to drag a window itself rather than a wireframe.  It would be hard to solve in any way that didn’t feel like a hack.  strokinder points out why this is problematic. The ability could also be implemented within the window manager itself.  The advantages and disadvantages of this plan are mirror images of those of the other plan.  It may, however, be worth the added complexity.  Additionally, the loss of the portability inherent in using an external script may not matter: if this was implemented in Metacity itself, it would presumably be fairly easy to carry it over to Mutter, since in this area the systems differ little.  Porting to Compiz may be more of a difficulty. If anyone with a little programming experience would like to volunteer to work on this, abundant help can be provided; otherwise we will see about dealing with it when the bug queue is reduced a little. Please follow GNOME bug 607694, where this issue is being discussed. Photo © Darwin Bell, cc-by. (Software)