Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Window manipulation ESC sequences #8107

Closed
unxed opened this issue Dec 6, 2024 · 1 comment
Closed

Support Window manipulation ESC sequences #8107

unxed opened this issue Dec 6, 2024 · 1 comment

Comments

@unxed
Copy link

unxed commented Dec 6, 2024

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

CSI Ps ; Ps ; Ps t
          Window manipulation (XTWINOPS), dtterm, extended by xterm.
          These controls may be disabled using the [allowWindowOps](https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:allowWindowOps)
          resource.

          xterm uses Extended Window Manager Hints ([EWMH](https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html)) to maximize
          the window.  Some window managers have incomplete support for
          EWMH.  For instance, fvwm, flwm and quartz-wm advertise
          support for maximizing windows horizontally or vertically, but
          in fact equate those to the maximize operation.

          Valid values for the first (and any additional parameters)
          are:
            Ps = 1  ⇒  De-iconify window.
            Ps = 2  ⇒  Iconify window.
            Ps = 3 ;  x ;  y ⇒  Move window to [x, y].
            Ps = 4 ;  height ;  width ⇒  Resize the xterm window to
          given height and width in pixels.  Omitted parameters reuse
          the current height or width.  Zero parameters use the
          display's height or width.
            Ps = 5  ⇒  Raise the xterm window to the front of the
          stacking order.
            Ps = 6  ⇒  Lower the xterm window to the bottom of the
          stacking order.
            Ps = 7  ⇒  Refresh the xterm window.
            Ps = 8 ;  height ;  width ⇒  Resize the text area to given
          height and width in characters.  Omitted parameters reuse the
          current height or width.  Zero parameters use the display's
          height or width.
            Ps = 9 ;  0  ⇒  Restore maximized window.
            Ps = 9 ;  1  ⇒  Maximize window (i.e., resize to screen
          size).
            Ps = 9 ;  2  ⇒  Maximize window vertically.
            Ps = 9 ;  3  ⇒  Maximize window horizontally.
            Ps = 1 0 ;  0  ⇒  Undo full-screen mode.
            Ps = 1 0 ;  1  ⇒  Change to full-screen.
            Ps = 1 0 ;  2  ⇒  Toggle full-screen.
            Ps = 1 1  ⇒  Report xterm window state.
          If the xterm window is non-iconified, it returns CSI 1 t .
          If the xterm window is iconified, it returns CSI 2 t .
            Ps = 1 3  ⇒  Report xterm window position.
          Note: X Toolkit positions can be negative, but the reported
          values are unsigned, in the range 0-65535.  Negative values
          correspond to 32768-65535.
          Result is CSI 3 ; x ; y t
            Ps = 1 3 ;  2  ⇒  Report xterm text-area position.
          Result is CSI 3 ; x ; y t
            Ps = 1 4  ⇒  Report xterm text area size in pixels.
          Result is CSI  4 ;  height ;  width t
            Ps = 1 4 ;  2  ⇒  Report xterm window size in pixels.
          Normally xterm's window is larger than its text area, since it
          includes the frame (or decoration) applied by the window
          manager, as well as the area used by a scroll-bar.
          Result is CSI  4 ;  height ;  width t
            Ps = 1 5  ⇒  Report size of the screen in pixels.
          Result is CSI  5 ;  height ;  width t
            Ps = 1 6  ⇒  Report xterm character cell size in pixels.
          Result is CSI  6 ;  height ;  width t
            Ps = 1 8  ⇒  Report the size of the text area in characters.
          Result is CSI  8 ;  height ;  width t
            Ps = 1 9  ⇒  Report the size of the screen in characters.
          Result is CSI  9 ;  height ;  width t
            Ps = 2 0  ⇒  Report xterm window's icon label.
          Result is OSC  L  label ST
            Ps = 2 1  ⇒  Report xterm window's title.
          Result is OSC  l  label ST
            Ps = 2 2 ; 0  ⇒  Save xterm icon and window title on stack.
            Ps = 2 2 ; 1  ⇒  Save xterm icon title on stack.
            Ps = 2 2 ; 2  ⇒  Save xterm window title on stack.
            Ps = 2 3 ; 0  ⇒  Restore xterm icon and window title from
          stack.
            Ps = 2 3 ; 1  ⇒  Restore xterm icon title from stack.
            Ps = 2 3 ; 2  ⇒  Restore xterm window title from stack.
            Ps >= 2 4  ⇒  Resize to Ps lines (DECSLPP), VT340 and VT420.
          xterm adapts this by resizing its window.

          XTWINOPS 2 2  (save/push title) and 2 3  (restore/pop title)
          accept an optional third parameter for direct access to the
          stack.  Parameters in the range 1 through 10, may be used to
          store the title into the stack or retrieve the title from the
          stack without pushing/popping.
@unxed unxed changed the title Support Windows manipulation ESC sequences Support Window manipulation ESC sequences Dec 6, 2024
@kovidgoyal
Copy link
Owner

I dont believe these are a good idea. They are impossible to implement
robustly as not all window managers (such as tiling ones) allow clients
to manipulate their own window sizes. Similarly, kitty uses layouts for
windows that work by distributong available space using constraints and
biases and dont support exact window sizes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants