The problem#
Many applications have a fullscreen mode that has a different interface from their windowed mode. For example, many media players will show just the video in fullscreen mode but include media controls in windowed mode. But, especially if you have a large monitor, you may want to use that interface while only having the application take up part of your monitor.
The solution#
I could not find a solution that works on every window manager.
The window manager handles resizing the application when it
switches to fullscreen, so the most straightforward way to accomplish
this is to not run a window manager. Problem solved! Unfortunately,
window managers are really useful, so outside of some niche cases where
you're positioning windows with xdotool
,
that's probably not what you want.
There's a "fakefullscreen" option in some forks of the very configurable window manager dwm: base dwm with the fakefullscreen patch always does fullscreen that way, the instantWM fork has a hotkey Super+Shift+F that toggles fake fullscreen for a window, and awesome can be configured to do the same.
For more common window managers, there is a solution, but more than
two virtual monitors requires an xorg-server newer than 21.1.10
(which is the most recent release at time of writing, so you would
have to compile it yourself), and in my tests, it only worked
on Compiz, and not Mutter, KWin, or
Xfwm. Use xrandr
1.5+ to define virtual monitors
on sections of your monitors and then maximizing or fullscreening
applications should respect those boundaries:
xrandr --setmonitor lefthalf 960/217x1080/132+0+0 LVDS-1
# This is a hack, should be "LVDS-1", not "none".
xrandr --setmonitor righthalf 960/217x1080/132+960+0 none
where the the geometery specification format is w/mmwxh/mmh+x+y
(mmw
/h
="millimeters width/height") and LVDS-1
is the name
xrandr
gives to my physical monitor. Note that xorg-server 21.1.10
and older have a limit of one virtual monitor per physical monitor which
we can circumvent by putting the second virtual monitor on "none
".