sortix-mirror/chvideomode/chvideomode.1
Juhani Krekelä e4ce686576 Use standard termios flags and functions in chvideomode(1).
Previously chvideomode(1) used {get,set}termmode(2) as well as
tcgetwincurpos(2), which are non-standard and only work in the kernel
terminal.

This necessitates changing the keybind for exiting the menu from esc to
Q, as there is no good standard way to disambiguate between escape
character by itself and the start of an escape sequence.
2023-06-20 01:06:20 +03:00

158 lines
4 KiB
Groff

.Dd June 16, 2023
.Dt CHVIDEOMODE 1
.Os
.Sh NAME
.Nm chvideomode
.Nd interactively change the screen resolution
.Sh SYNOPSIS
.Nm
.Op Fl \-show-all Ns "=" Ns Ar bool
.Op Fl \-show-supported Ns "=" Ns Ar bool
.Op Fl \-show-unsupported Ns "=" Ns Ar bool
.Op Fl \-show-text Ns "=" Ns Ar bool
.Op Fl \-show-graphics Ns "=" Ns Ar bool
.Op Fl \-bpp Ns "=" Ns Ar bpp
.Op Fl \-min-bpp Ns "=" Ns Ar min-bpp
.Op Fl \-max-bpp Ns "=" Ns Ar max-bpp
.Op Fl \-width Ns "=" Ns Ar width
.Op Fl \-min-width Ns "=" Ns Ar min-width
.Op Fl \-max-width Ns "=" Ns Ar max-width
.Op Fl \-height Ns "=" Ns Ar height
.Op Fl \-min-height Ns "=" Ns Ar min-height
.Op Fl \-max-height Ns "=" Ns Ar max-height
.Op Ar videomode
.Sh DESCRIPTION
.Nm
changes the video mode by displaying an interactive menu containing a list of
available modes, with an additional entry for entering a custom mode (if
supported by the driver).
If the mode change fails, the menu is redisplayed until cancellation or a
successful mode change.
If the
.Ar videomode
argument is specified in the
.Ar width Ns x Ns Ar height Ns x Ns Ar bits-per-pixel
format per
.Xr videomode 5 ,
then the video mode is immediately set non-interactively.
.Pp
By default,
.Nm
only displays supported text and graphical modes, but modes can also be
explicitly filtered via options.
Multiple filters can be specified, and only modes matching all filters will be
displayed.
If a filter has min and max options, setting it is equivalent to setting
min and max to the same value; for example,
.Fl \-bpp Ns "=" Ns Sy 32
is equivalent to
.Fl \-min-bpp Ns "=" Ns Sy 32 ,
.Fl \-max-bpp Ns "=" Ns Sy 32 .
Filters taking
.Ar bool
as an argument have possible values of
.Sy true
or
.Sy false .
If the same filter is specified multiple times, only the last specified value
is used.
.Pp
The interactive key commands are as follows:
.Bl -tag -width "1234567890"
.It Up Arrow
Move the selection up 1 item.
.It Down Arrow
Move the selection down 1 item.
.It 0 - 9
Select item of the specified number.
.It q , Q
Quit without changing video mode.
.It Enter
Change the video mode to the current selection.
.El
.Pp
The options are as follows:
.Bl -tag -width "12345678"
.It Fl \-show-all Ns "=" Ns Ar bool
Override all other filter options, displaying every mode if
.Ar bool
is
.Sy true .
(defaults to
.Sy false)
.It Fl \-show-supported Ns "=" Ns Ar bool
Show supported video modes if
.Ar bool
is
.Sy true .
(defaults to
.Sy true )
.It Fl \-show-unsupported Ns "=" Ns Ar bool
Show unsupported video modes if
.Ar bool
is
.Sy true .
(defaults to
.Sy false )
.It Fl \-show-text Ns "=" Ns Ar bool
Show video modes available in text mode if
.Ar bool
is
.Sy true .
(defaults to
.Sy true )
.It Fl \-show-graphics Ns "=" Ns Ar bool
Show video modes available in graphics mode if
.Ar bool
is
.Sy true .
(defaults to
.Sy true )
.It Fl \-bpp Ns "=" Ns Ar bpp
Show video modes with bits-per-pixel equal to
.Ar bpp .
.It Fl \-min-bpp Ns "=" Ns Ar min-bpp
Show video modes with bits-per-pixel greater than
.Ar min-bpp ,
inclusive.
.It Fl \-max-bpp Ns "=" Ns Ar max-bpp
Show video modes with bits-per-pixel less than
.Ar max-bpp ,
inclusive.
.It Fl \-width Ns "=" Ns Ar width
Show video modes with width equal to
.Ar width .
.It Fl \-min-width Ns "=" Ns Ar min-width
Show video modes with width greater than
.Ar min-width ,
inclusive.
.It Fl \-max-width Ns "=" Ns Ar max-width
Show video modes with width less than
.Ar max-width ,
inclusive.
.It Fl \-height Ns "=" Ns Ar height
Show video modes with height equal to
.Ar height .
.It Fl \-min-height Ns "=" Ns Ar min-height
Show video modes with height greater than
.Ar min-height ,
inclusive.
.It Fl \-max-height Ns "=" Ns Ar max-height
Show video modes with height less than
.Ar max-height ,
inclusive.
.El
.Sh EXIT STATUS
.Nm
exits with an exit status of 10 if the menu is quit, 11 if no modes are
available, 12 if no modes are available after filtering, 13 if the terminal has
no associated video devices, or 1 on any other error.
.Nm
exits 0 if the video mode is successfully changed.
.Sh SEE ALSO
.Xr chkblayout 1 ,
.Xr dispmsg_issue 2 ,
.Xr videomode 5
.Sh BUGS
.Nm
only supports a single monitor.