There are some applications (mainly java based) that don't follow the global 2x scale I set in the screen-settings. So these apps are really tiny on my high DPI screen with 3200x1800px.
How can I get these apps running in a smaller screen resolution?
Test adding to your java command line:
-Dsun.java2d.uiScale=2.0
, or set it to a scale factor you want.A major convenience upgrade would be to use a background script, automatically setting the resolution per application, while you can set different resolutions for different (multiple) applications at once.
That is exactly what the script below does.
An example of a default resolution of
1680x1050
:Running
gedit
, automatically changing to640x480
:Running
gnome-terminal
, automatically changing to1280x1024
:When the application is closed, the resolution is automatically set back to
1680x1050
How to use
set_resolution.py
In the head of the script, set your default resolution, in the line:
In the very same directory (folder), create a textfile, exactly named:
procsdata.txt
. In this textfile, set the desired application or process, followed by a space, followed by the desired resolution. One application or script per line, looking like:Run the script by the command:
Note
The script use
pgrep -f <process>
, which catches all matches, including scripts. The possible downside is that it can cause name clashes when opening a file with the same name as the process.If you run into issues like that, change:
into:
The script
Explanation
When the script starts, it reads the file in which you defined your applications and their corresponding desired screen resolutions.
It then keeps an eye on the running processes (running
pgrep -f <process>
for each of the applications) and sets the resolution if the application starts up.When
pgrep -f <process>
does not produce output for any of the listed applications, it sets the resolution to "default".Edit:
"Dynamic" version (as requested)
While the version above works with multiple listed applications, it only sets the resolution for one application at a time.
The version below can handle different applications with a different (required) resolution, running at the same time. The background script will keep track of what is the front most application, and will set the resolution accordingly. It also works fine with Alt+Tab.
Note that this behaviour might be annoying if you switch a lot between the desktop and listed applications; the frequent resolution switch might be too much.
differences in how to setup
The setup is pretty much the same, appart from the fact that this one uses
wmctrl
andxdotool
:The script
Notes
As a workaround
I created a bash script that changes the resolution to fullHD before it starts the application (in this examle Android Studio) and changes it back to 3200x1800 when the application quits:
Enter this script:
and give it executeable rights:
Then you can start it with Alt+F1
studio
For other resize-factors that 2.0 see https://askubuntu.com/a/486611/34298
For easy switching zoom on and off in Firefox use the extension Zoom Menu Elements
For Linux:
Add the following:
... and is better to use METAL look & feel as GTK+ follows some scaling by Gnome also.