Sway: Maximising windows

Created on 28 May 2020  路  3Comments  路  Source: swaywm/sway

GTK behaves weird when full-screened: the main controls for windows are hidden (e.g.: the "Save" button in save dialog and other critical elements, like the "Confirm" button in some UIs).

I brought this up at the GTK3 issue tracker, but apparently, dialogs behave this way by design since they're intended to be used on floating window managers only and not tiling ones (and the users of these know to maximise this window and not full-screen them, I guess?).

The conclusion is that windows have two properties: full-screen and maximised. While they seem to mean the exact same thing, the difference is very specific and mostly a technical one. The important distinction is that full-screen windows hide their controls by default (again, like the "Open" button in a file chooser dialog, which I think is extremely stupid, since that's the main CTA).

I'm wondering if it's possible to "maximise" a window in sway. Potentially, I'd like to bind a hotkey to maximise windows, so I can have them "fullscreen", but with them not hiding important UI elements.

I don't see any mentions of maximisation on the docs; is such a thing possible, or merely not implemented on swaywm? (I guess it would seem redundant, since both concepts _seem_ to be the same unless you look at how GTK behaves)

enhancement proposal

Most helpful comment

Here's a small patch you can apply locally that switches Sway's fullscreen command to maximize rather than fullscreen. For my personal usage I like this hack since any applications I really want the fullscreen mode of, I can tap F11 for.

I think what, if anything, to do about this in Sway proper warrants further discussion, though.


Related:

The i3 issue is marked as accepted and seems popular (sometimes heated), but has not been implemented since it was filed (2015).

The EWMH guidelines are for X, but I think application behavior is analogous on Wayland. It states:

_NET_WM_STATE_FULLSCREEN indicates that the window should fill the entire screen and have no window decorations. Additionally the Window Manager is responsible for restoring the original geometry after a switch from fullscreen back to normal window. For example, a presentation program would use this hint.

Sway only sends fullscreen notifications through xdg-shell. The GTK3 file open dialog _does_ have its "Open" button in its window decoration, and GTK3 _is_ hiding its window decorations as requested by Sway, so everything sounds like its working correctly to me here — even if the resulting user experience is suboptimal.

Visually, a maximize command should act as if the selected window was in a brand new workspace (that is, the bar should still show). So, it's not quite what you want here because as you state in the linked thread, since keeping mental track of two similar-but-not-quite keybindings is a bit icky.

Apart from a maximize command (which may be useful in its own right), one proposal here would be to add a fullscreen_mode [fullscreen|maximize|smart] option to control this behavior. fullscreen would be the current behavior, maximize would be the behavior as with my linked patch, and smart could be something in-between like maximizing only dialogs. i3 does not have such an option; I'm unsure about whether that's a prerequisite to having it in Sway.

All 3 comments

Here's a small patch you can apply locally that switches Sway's fullscreen command to maximize rather than fullscreen. For my personal usage I like this hack since any applications I really want the fullscreen mode of, I can tap F11 for.

I think what, if anything, to do about this in Sway proper warrants further discussion, though.


Related:

The i3 issue is marked as accepted and seems popular (sometimes heated), but has not been implemented since it was filed (2015).

The EWMH guidelines are for X, but I think application behavior is analogous on Wayland. It states:

_NET_WM_STATE_FULLSCREEN indicates that the window should fill the entire screen and have no window decorations. Additionally the Window Manager is responsible for restoring the original geometry after a switch from fullscreen back to normal window. For example, a presentation program would use this hint.

Sway only sends fullscreen notifications through xdg-shell. The GTK3 file open dialog _does_ have its "Open" button in its window decoration, and GTK3 _is_ hiding its window decorations as requested by Sway, so everything sounds like its working correctly to me here — even if the resulting user experience is suboptimal.

Visually, a maximize command should act as if the selected window was in a brand new workspace (that is, the bar should still show). So, it's not quite what you want here because as you state in the linked thread, since keeping mental track of two similar-but-not-quite keybindings is a bit icky.

Apart from a maximize command (which may be useful in its own right), one proposal here would be to add a fullscreen_mode [fullscreen|maximize|smart] option to control this behavior. fullscreen would be the current behavior, maximize would be the behavior as with my linked patch, and smart could be something in-between like maximizing only dialogs. i3 does not have such an option; I'm unsure about whether that's a prerequisite to having it in Sway.

Apart from a maximize command (which may be useful in its own right), one proposal here would be to add a fullscreen_mode [fullscreen|maximize|smart] option to control this behavior. fullscreen would be the current behavior, maximize would be the behavior as with my linked patch, and smart could be something in-between like maximizing only dialogs. i3 does not have such an option; I'm unsure about whether that's a prerequisite to having it in Sway.

smart is basically what my end goal with be: fullscreen regular windows, but maximise dialogs. Though I wouldn't mind having some local glue code that does some of the work at first.

This patch seems like a magnificent starting point, so I'll experiment with that patch when I get a free day or two :)

FWIW, I do think the behaviour on sway's side should be identical with both full-screen and maximise (for simplicity's sake), and merely change what property is switched for the client.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RyanDwyer picture RyanDwyer  路  3Comments

dnkl picture dnkl  路  4Comments

aidanharris picture aidanharris  路  3Comments

Olie440 picture Olie440  路  4Comments

emersion picture emersion  路  4Comments