GNOME x11 fractional scaling

I have used GNOME for 2 years but now forced to use KDE Plasma since it uses DPI value from .Xresources. In this article I will describe how to achieve true fractional scaling under GNOME. Note that this is just an experiment; it may not be suitable for everyday use.

1. Recompile gnome-settings-daemon

In gnome-settings-daemon located DPI value. By default it is 96. If content too small, you need to increase this value: try values 120 (125%), 144 (150%) etc. For me, the ideal option is 130.

  1. Clone gnome-settings-daemon
  2. Find and open file gnome-settings-daemon/plugins/xsettings/gsd-xsettings-manager.c
  3. Find the line with #define DPI_FALLBACK 96. Now it is 236. Replace 96 with optimal value
  4. According to README, build and install with following commands:
    mkdir build && cd build
    meson --prefix=/usr --sysconfdir=/etc .. && ninja
    sudo ninja install
  5. Reboot your computer

2. Configure theme

Note: not all themes displaying correctly after these changes. I’m using Materia Dark and I haven’t issues with it. Next actions will increase the shell font size, which also scales the shell itself.

First, open /usr/share/themes/YOUR_THEME/gnome-shell/gnome-shell.css. You will see something like this:

Change font-size value. For example, set it to 1.3em. Save file. Type alt+F2, type r and press enter.

You also may be need to scale calendar. To do this, add in the end of the file next code:

Type alt+F2, type r and press enter.

3. Configure title buttons size

You maybe also will want to increase size of title buttons. To do this open file ~/.config/gtk-3.0/gtk.css. Add at the end of the file next code:

button.titlebutton {
    min-height: 32px;
    min-width: 32px;
    padding: 0;
}

You can use your params instead of 32px.

Edit (21.07.20):
As lockscreen you can use gnome-screensaver. Just install it and launch. To make it start automatically with GNOME, add the following to your ~/.bash_profile :

if [ "$XDG_CURRENT_DESKTOP" == "GNOME" ]; then
    gnome-screensaver & disown
fi

This will prevent you from using GDM at all, you can use SDDM instead. Also note, that if GDM is running then you cannot use gnome-screensaver.

Conclusion

This scaling isn’t ideal, it has pros and cons. It doesn’t affect elements such as GDM, which is used as a lock screen. Perhaps I will continue my experiment and will periodically update the article. So, pros:

  • True x11 scaling
  • Does not consume more resources
  • Applications don’t get blurry, as happens with fractional scaling on Wayland

Cons:

  • You need to recompile gnome-settings-daemon after every update
  • GDM will still without changes
  • You need to edit theme; not all themes will be displayed correctly after all manipulations

If you have any questions/suggestions – be sure to write in the comments, or better write me a letter: [email protected]

CLion Activator v1.1

Script activator for Linux, allows you to extend the trial period of CLion for 30 days
IF YOU HAVE AN OPPORTUNITY, PLEASE BUY CLION
Unlike the previous version, this activator is written in Python and clears all references to the trial license. This activator FULLY renews the license for 30 days.

  1. Download script
  2. cd <download folder>
  3. python CLionActivator.py
  4. Enter your current CLion version folder index (usually 0)
  5. Enjoy!

Xorg – change display resolution on AMD GPU, Debian

When I tried to create a new mode in Xorg (via xrandr --newmode), I get the following error:
Failed to get size of gamma for output default
The solution turned out to be simple: I just had to install the firmware-linux-nonfree package and reboot the PC.
So, here is the complete resolution change process:

  1. cvt <width> <height> <refresh rate>, output may be something like this:
    # 1920x1080 59.96 Hz (CVT 2.07M9) hsync: 67.16 kHz; pclk: 173.00 MHz Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
  2. xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
  3. xrandr --addmode <OUTPUT> 1920x1080_60.00, OUTPUT can be extracted from xrandr output. It can be something like DVI-0, HDMI-0 etc
  4. To apply new mode that you created execute xrandr --output <OUTPUT> --mode 1920x1080_60.00

After that, the screen resolution will change to the one you specified.

Firefox useful settings

You can found hidden config on about:config

  • layers.acceleration.force-enabled set to true, if your screen flickering when you scrolling or watching videos
  • layout.css.devPixelsPerPx can control browser scale with this param. Very useful for users which have HiDPI screens!

Update 19.06.20/20.06.20:

  • browser.display.focus_ring_width set to 0 to remove ugly dotted borders around the links
  • gfx.webrender.all set to true to enable WebRender
  • browser.tabs.tabMinWidth reduce to fit more tabs (like in Chromium)