Subscribe:   RSS icon   twitter icon

Eliminating gaps between terminal windows in dwm

Lee Phillips
September 6th, 2020

Terminals like to have their windows sized to hold an integral number of lines and columns of (fixed width) text. This creates unsightly gaps between terminal windows when using tiling window managers, as the size that the terminal window wants to be is unlikely to correspond to the size you want it to fit into.

Most programs will just be quiet and live with whatever window you stuff them in. But terminal programs tend to send a “size hint” to the window manager, which is apt to obey, and adjust the window size, creating the gaps you don’t want. In some window managers you can find a setting to ignore the size hint, and all will be well.

In dwm, find the line

static const int resizehints = 1;

in the config.h file, and change the 1 to a 0. Then, as you know, compile, install and restart dwm to see the gapless goodness.

This worked in my extensive testing of uxterm and….that’s all I tested.

The nifty st terminal, from the same team that brings us dwm, has a patch called “anysize” that has the same effect, and worked for me. I don’t know whether you need the patch if you make the change to dwm described above.

If st is so nifty, why did I switch to uxterm, you ask? The main reason was that when you flip back and forth between windows of different sizes, st does not redraw the part of its window that was clipped when it was in a smaller container—you lose not just the visible part, but the scrollback, too (I have the scrollback patch patched in as well). This is annoying enough that I was thinking about finding an alternative. Then I came upon this article, which measures the typing latency of a bunch of terminals, and discovered that st is much worse than uxterm, which is almost as parsimonious with memory. So I’m running uxterm now. It also does not redraw the part of its window that gets clipped when contracting and expanding, but it preserves its scrollback. Other than that, no difference in normal operations.


Share with Facebook Share with Twitter Share with Reddit Share with StumbleUpon Share with Digg Share with Slashdot
▶ Comment
lee-phillips.org is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.
Quotilizer ... loading ...

Tenuously related:

The best tool for CVs with publication lists.