1

For quite some time I'm "struggling" with the problem I wish to present in pictures down below.

The problem is that I have weird borders around programs I open in the Terminal Emulator. Though it is basically only noticeable if I'm inside Vim or similar programs where I've set the background of that program to be opaque.

So if I'm using mpv, ranger, etc. You can see the same problem, however it's really hard to notice it since the background is transparent as well as the background of TE, whereas if I'm in something like Vim, where I like to have opaque background while working in it, it's annoying to say the least, to see that difference.

I'm currently using Manjaro, though I've used XFCE as DE in the past, but switched to i3 as WM to see if that would help. Hint hint, it didn't.

I've tried different things to resolve this issue. I've tried:

  1. I've tried, as you can see in the pictures down below, different Terminal Emulators. I'm currently using xfce-256color, but have also tried to use urxvt as a remedy for this problem, but "no luck".
  2. I've tried other TEs as well. I've tried: Kitty, Alacritty, xterm, dwm, etc. you name it, I've tried it, but nothing changed. So I guess it's not TE.
  3. I've tried running Vim with "-u NONE -X" options and immediately set background to colorscheme=darkblue, just so it's obvious to see if borders are still there.
    Unfortunately, everything is the same.
  4. I've tried running: urxvt -b 0 and while that did do something, it made borders thinner(as you can see in 3rd group of pictures down below), they are still preserved.
  5. I've also set borders to 0 in the config of i3: for_window [class="^.*"] border pixel 0, but again, same story.

xterm-256color without i3 gaps xterm-256color with    i3 gaps

urxvt without i3 gaps urxvt with    i3 gaps

urxvt -b 0 without i3 gaps urxvt -b 0 with    i3 gaps

I'd like to note that I do not want to make my background the same color as my TE as a "fix" for this problem. That is essentially what I implicitly do with ranger, mpv, etc. That also bugs me, but Vim is where I spend my time the most and I do not want to make it "less of an issue" with setting the background color of Vim transparent, i.e. highlight Normal ctermbg=none

I've tried to change the Font size of my xterm-256color. By default, in above pictures, it's set to: Source Code Pro Regular 9

I've made two more pictures.

  1. Left Terminal Font size: 10, Right Terminal Font size: 11 enter image description here

  2. Left Terminal Font size: 10, Right Terminal Font size: 8 enter image description here

As you can see the size of visible "weird borders" portion increases and decreases, but they persist nonetheless.

Thank you for reading.

Some information about my system(since I'm not sure what is necessary):
Distro: Manjaro
WM: i3
TE: xterm-256colors/urxvt

lspci -vnn | grep VGA output:
00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller [8086:2a42] (rev 07) (prog-if 00 [VGA controller])

I'm not sure what is necessary, if I need to provide any additional information, please inform me.

0

2 Answers 2

1

Terminal emulators work with a grid of rectangular character cells, each having the same size.

You have probably noticed with "regular" window managers that most terminal emulators resize in sudden jumps, rather than smoothly pixel by pixel. This is because they wish to avoid an unusable area at the right and bottom margins, and thereby provide a pleasant look of the application running inside.

This is achieved by the so-called "geometry hints". Let's say you've choosen a font where a character cell is 10×20 pixels, and the terminal emulator also adds a 1px border around the entire terminal emulation area. For the sake of simplicity, let's assume no tab bar, no scrollbar etc. This means that preferred window widths are 12, 22, 32, 42... pixels, and preferred window heights are 22, 42, 62, 82... pixels. Most terminal emulators install the geometry hints that their width should be 10*w+2 pixels and their height should be 20*h+2 pixels for some integers w and h (obviously the exact numbers are always calculated from the actual cell size, preferred border width, scrollbar width, and other bells and whistles in mind).

As the name says, these are hints, not rules. Window managers are allowed to respect or ignore them, as they please. Typical window managers ignore them at maximized and fullscreen windows but respect them otherwise. I'm not familiar with tiling window managers, but I assume they always ignore these hints. Tiling window managers want to have stricter control where the window goes, it's the window manager that tells it and the app has to adjust, not the other way around.

So, if the window size doesn't happen to match the hints, what should terminal emulators do? You're left with some unused area on the right and at the bottom, not covered by the w*h number of character cells. You can't really do anything there. (Well, there are some tricks. E.g. VTE (used by GNOME Terminal and others) uses the bottom extra area when scrolling. Kitty distributes the additional space across cells so the cells aren't exactly of the same size. But usually that area is unusable.)

What can you do here?

One way is to make sure there's no such leftover area, i.e. your window manager respects the geometry hints. I don't know if, and how, Manjaro or i3 lets you do this.

The other is: In many terminal emulators there is a way to dynamically (i.e. runtime) change the default background color. This default background color is typically not only used for the w*h character cells (whichever of those don't have a background color explicitly set), but also for the border around them, and this is the border that can get much bigger if the geometry hints are not respected.

In supporting terminal emulators, set the default background color (and thereby the border color too) using the OSC 11 escape sequence, or revert to the default using OSC 111, e.g.:

printf '\e]11;#abcdef\e\\'
printf '\e]111\e\\'

Hook these up to starting / quitting vim and friends to paint the border to the color you prefer in that context.

0

I've had the same issue and at least solved it for a maximized window for the bottom part by adjusting the size of the panel on top (KUbuntu).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .