Search code examples
linuxscreenresolutionlinux-mint

I need a script to change screen resolution in Linux Mint 15 then launch an application


Probably a simple question with a simple answer. I have an application that will sometimes crash and cause my screen resolution to change when it does. For the moment I just want to have a quick script I can run that will change my screen resolution back where it's supposed to be then re-launch the app.

I'm running Linux Mint 15 KDE 64 bit and my default screen is 1600x900.

Thanks in advance for the help.

Jeff


Solution

  • You have not listed what you have tried, if anything, thus far. However since you are running Mint, you probably have xrandr or can easily get it.

    xrandr -q
    Screen 0: minimum 320 x 200, current 1366 x 768, maximum 32767 x 32767
    LVDS1 connected 1366x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm
    1366x768       60.0*+
    1360x768       59.8     60.0  
    1024x768       60.0  
    800x600        60.3     56.2  
    640x480        59.9  
    

    Then you just user xrandr -s to change the screen resolution mode. So say I wanted to change to change to 1024x768 I would just run:

    xrandr -s 2
    

    Here is a really simple script to demonstrate:

    #!/bin/bash
    echo "I am going to check the screen resolution"
    xrandr -q
    sleep 5s
    echo "I am going to change the screen resolution to 1024x768"
    xrandr -s 2
    echo "Now we are going to to check the resolution again"
    xrandr -q
    sleep 5s
    echo "Now I am going to change the resolution back to 1366x768"
    xrandr -s 0
    echo "Now we check yet again"
    xrandr -q
    sleep 5s
    

    If I am misinterpreting what you are asking for then please update your question to better reflect your aim.