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
".
The details#
Splitting ultrawide monitors#
All of the discussion I could find about this online was about dealing with ultrawide monitors, where people wanted to make them act more like two or more monitors side-by-side. This StackExchange question links to much of the discussion including the dwm patch linked above and this Xorg change that merged December 17, 2023 (i.e. after the 21.1.10 release, the most recent at time of writing), which added support for multiple virtual monitors splitting up the same physical monitor. There's an open merge request in GTK to support that, so this may work better in the near future.
Separate from that discussion, I found that for KDE, the recommendation is to use Mudeer.
Behavior under other window managers#
There's a lot of window managers; I only tested the most common ones that were already installed on my machine.
In my testing, Xfwm (default for Xfce) showed the same behavior seen in that StackExchange question: it would choose one of the virtual monitors to display on and the rest of the screen would be black.
Mutter (default for GNOME 3) and KWin (default for KDE), both seemed to completely ignore the virtual monitors.
As stated above, Compiz (originally for GNOME 2, now default for Unity) does respect the virtual monitors and treats them like real monitors.
How to test#
As I mentioned, this feature isn't fully supported yet in existing
releases of xorg-xserver, so I had to compile it myself. There's a page
on how to build X from source with some helpful scripts
that make it simple. One important note is to pay attention to the
recommendation to compile only the modules you need; the relevant code
change is in the module xserver
. I did get an error about something
"proto", so I added the proto/xorgproto
and proto/xcbproto
modules
to the list to compile and it worked.
That page then explains how to run the Xorg
binary, although I
ended up just running it as root
because I couldn't figure out how
resolve the permission issues and decided it didn't matter for a quick
test.
As a side note, I did try to test using Xephyr to just do this in a window, but as far as I could tell, Xephyr was completely ignoring the virtual monitors. I ended up using a laptop instead.
Comments
Have something to add? Post a comment by sending an email to comments@aweirdimagination.net. You may use Markdown for formatting.
There are no comments yet.