Add snap layouts popup on the maximize button - #48
Conversation
Hovering a window's maximize button pops up a grid of layout templates, in the manner of Windows 11's snap layouts. Each template is drawn as a miniature of the monitor split into zones; the zone under the pointer is highlighted, and clicking it moves and resizes the window to fill that part of the monitor's usable area. The popup is a new internal window (openbox/snap.c) painted with the theme's OSD appearances, anchored below the maximize button and clamped to the monitor. It appears after a configurable hover delay and is taken down on a short delay so the pointer can cross the gap into it, or immediately on a click elsewhere, a keypress, or the client going away. Configured by a new <snapLayouts> block in rc.xml: <enabled>, <delay>, and optional <layout><zone x= y= width= height=/></layout> entries given in percent of the monitor. Six layouts are built in and are used when none are configured. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
@netlinux-ai (just to clear out the speculation from the description of the pull request) |
|
@netlinux-ai
If you use Ubuntu 26.04, you can add these PPAs to your system and test the resulting performance. So far there are zero regressions in my testing on Ubuntu 26.04 on both PPAs. Both patches, individually or together, work fine in the PPAs. The advantage (or the good thing) about both patches is that they enhance the Openbox experience, like modern desktop environments provide. Also, the patches do not alter the behavior of existing openbox themes. Both the old and new themes can adopt to the new change if someone likes to do so. See some screenshots to observe and understand the new behavior.
|
|
Yes I was going for extending the current behaviour not changing it. I'm not sure the shots show the popup correctly. I have another PR if you are interested: adding buttons to the top bar for layers and bringing up obconf. |
Yes, the zones are faint because of the Hovertest theme I created, which does not have great contrast for the popup. The contrast in the popup is better enhanced by using other built-in openbox themes. The good thing is that the tiling works.
I think this would be a permanent distraction sort of thing sitting on the titlebar. People only like either keyboard shortcuts to manage tiling or the popup as alternative for on-demand tiling. The simple and minimal, the better the acceptability among users. Perhaps you could test the PPA sometime. Use any stock Openbox theme you like or a new themerc, and don't forget to add the following block of keys in themerc file: The new key window.button.wistoh defines the width/height aspect ratio of window buttons, and the new key window.title.kgrip defines the empty space (available for grip) above and below the button in the titlebar. |
|
I think you should have hover-to-tile popup only. I believe to keep neat and minimal patch footprints across the source tree. |







Add snap layouts popup on the maximize button
Hovering a window's maximize button pops up a grid of layout templates, in the
manner of Windows 11's snap layouts. Each template is drawn as a miniature of
the monitor split into zones; the zone under the pointer is highlighted, and
clicking it moves and resizes the window to fill that part of the monitor's
usable area.
Implementation
openbox/snap.c) painted with thetheme's existing OSD appearances, so it follows the user's theme with no new
theme requirements. It is anchored below the maximize button and clamped to
the monitor.
delay when the pointer leaves (so it can cross the gap between button and
popup), or immediately on a click elsewhere, a keypress, or the client being
unmanaged.
client_move_resizeagainst the monitor's usablearea (
screen_area), so panels/struts are respected. Fullscreen, shaded andmaximized states are cleared first.
Configuration
A new
<snapLayouts>block inrc.xml(schema added torc.xsd):Six layouts are built in (halves, thirds, quarters, etc.) and are used when
none are configured.
Testing
In daily use as the author's session WM on X11 (glib 2.88, amd64, dual
monitor with an xfce4-panel).