Refactoring to maintainability

Double sizing your app in Linux

The setup

If you know me personally you probably have heard me talking how awful is the scene on Linux regarding HiDPI. Out of the box things aren’t great. Because of the multiple desktop and graphic systems running out of the old XServer with different ways of handling the approach to scaling, how an application handles HiDPI is quite different. If on top of that you have a multi-monitor setup (2 on my desktop), that have different dpi, things get even worse.

This is one aspect where Windows has been always superior. It can handle different dpi without a hitch, moving from one screen to another smoothly (somehow, Apple decided that they were not going to support it ¯_(ツ)_/¯, at least not by default )

Linux options

For my Linux Cinnamon setup, the following occurs:

  • I can indicate a general size (using fixed increments). But some apps don’t actually use that (Cinnamon is a fork of Gnome 2, and other desktops like KDE have a different approach).
  • The option above is not useful when having monitors of different dpi.
  • I can use in some cases Ctrl-+ to increase the size of fonts or ui elements. On others it doesn’t.
  • I can indicate the scaling factor for individual apps (but if I remember correctly, not all of them actually scale)

Fixing an app scaling

For my laptop which has a HiDPI screen, I decided to fix Spotify. Early in the morning is a bit of pain trying to read with that small font.

In Linux Cinnamon you can change the Launcher settings of an application.

If you right click on the menu icon you can then follow this chain of options: Configure->Menu->Open Menu Editor

which will open the following screen: Main Menu Editor

From there you have two options, either Properties or Edit Desktop File.

For the former one you will see this screen: Properties of Launcher

And what you will want to modify is the Command box.

For the later you will see this screen: Desktop File Contents

And what you will want to modify is the Exec entry.

In both cases, just before the %U (well, I haven’t tested with arguments, so not 100% sure at the moment if it needs to be after the %U), you will want to add this: --force-device-scale-factor=2

And that should scale by 2 the size of the application screen. The scale factor must be a whole number (an integer), so options are limited.

By the way, for the meaning of %U you can check on the freedesktop site