Fixing Black Borders in GTK4 Apps: A Step-by-Step Guide

How to fix this?

Gnome Calculator without Compositor

In short you need compositor that’s it.

Check Composite Extensions

Before installing compositor, make sure you have installed and correctly configured Xorg. To make sure the Composite extension is enabled for the X Server, run:

1
xdpyinfo | grep Composite

The output should like this

1
2
3
rmdhnreza ~ $ xdpyinfo | grep Composite
    Composite
rmdhnreza ~ $

If there is no output, add the Composite option to the Extensions section of Xorg configuration:

  1. Create file under /etc/X11/xorg.conf.d/ with name 10-composite.conf
  2. Add this line to enable Composite extensions
  3. Restart your Linux system
1
2
3
Section "Extensions"
        Option  "Composite" "true"
EndSection

Install Compositor

Personally, I don’t like compositors or eye candy effects because I prefer things to be instant. Therefore, I opt for the lightest available compositor and disable all eye candy effects (fade, opacity, shadow, etc.).

  1. xcompmgr
  2. fastcompmgr

Most distribution ship xcompmgr in their package manager.

1
2
3
4
5
6
Arch Linux	: pacman -S xcompmgr
Debian		: apt install xcompmgr
Fedora		: dnf install xcompmgr
TumbleWeed	: zypper install xcompmgr
Ubuntu		: apt install xcompmgr
Void Linux	: xbps-install xcompmgr

For fastcompmgr, you need to compile it yourself or download the binary file from GitHub releases. Make the file executable and place it in your $PATH.

Autostart Compositor

Basically, xcompmgr and fastcompmgr have the same configuration, so no matter which compositor you’re using, the command will be the same.
To make the compositor autostart at startup, just place this command in your .xinitrc (if you are not using LightDM) or .xprofile (if you are using LightDM).

1
2
xcompmgr -C -l0 -t0 -r0 -o0 -I0 -O0 -D0 &
exec dbus-run-session $(which i3)

Brave without Compositor Brave with Compositor

Gnome Calculator without Compositor Gnome Calculator with Compositor

Fix broken GTK4 Apps

GTK4 Apps broken

Sometimes GTK4 apps do not render text correctly after running a compositor on some older GPUs. This is because of the new GSK_RENDERER. To fix this, simply override the GSK_RENDERER for the affected apps.
Just edit the .desktop file and add env GSK_RENDERER=cairo in the Exec= section before the app’s executable name. For example, in gnome-calculator.

1
Exec=env GSK_RENDERER=cairo gnome-calculator

If you want override system-wide just add this to /etc/environment

1
GSK_RENDERER=cairo

GSK_RENDERER environment variable

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Supported arguments for GSK_RENDERER environment variable:
    broadway - Use the Broadway specific renderer
    cairo - Use the Cairo fallback renderer
    opengl - Use the OpenGL renderer
    gl - Use the OpenGL renderer
    ngl - Use the new OpenGL renderer
    vulkan - Use the Vulkan renderer
    help - Print this help

Other arguments will cause a warning and be ignored.
Bantu bagikan halaman ini ke:
Built with Hugo
Theme Stack designed by Jimmy