Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Written by Jacob Vlijm:

A background script to automatically set the resolution per application, while you can set different resolutions for different (multiple) applications at once.

It 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.

An example of a default resolution of 3200x1800:

enter image description here

Running gedit, automatically changing to 640x480:

enter image description here

Running gnome-terminal, automatically changing to 1280x1024:

enter image description here

When the application is closed, the resolution is automatically set back to 3200x1800


sudo apt-get install wmctrl xdotool

###How to use

  1. Copy the script below into an empty file, save it as

  2. In the head of the script, set your default resolution and scaling factor:

     #--- set default settings below
     default = "3200x1800"
     defaultScalingFactor = 2
  3. In the very same directory (folder), create a textfile, exactly named: procsdata.txt. Define one application or script per line:

    • the desired application or process
    • followed by a space
    • followed by the desired resolution
    • followed by a space
    • followed by the desired scaling factor. .


     java 1920x1080 1
     gedit 1920x1080 1
  4. Run the script by the command:

     python3 ./

###Figure out the descriptor for applications

If you want to find out the name, you have to write into the config file, you can use this command:

sleep 5 && cat "/proc/$(xdotool getwindowpid "$(xdotool getwindowfocus)")/comm"

Once you started this, you have 5 seconds to focus the desired app.

###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:

matches.append([p, subprocess.check_output(["pgrep", "-f", p]).decode("utf-8")])


matches.append([p, subprocess.check_output(["pgrep", p]).decode("utf-8")])

###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".


  • Although I have it running for several hours without an error now, please test it thoroughly. If an error might occur, please leave a comment here:
  • The script -as it is- works on a single monitor setup.


No description, website, or topics provided.




No releases published


You can’t perform that action at this time.