BASH script for changing screen resolution
I've setup a Linux computer for my mother-in-law and everytime she plays a certain game, it resizes her screen to 640x480... this is fine except that the game doesn't bother to revert back to 1024x768 when she quits. She can't ever remember the steps to reset the resolution from the desktop options menu in KDE. What I want to do it make her a simple icon in the top left corner of her screen that she can click on to reset the screen resolution for her automagically. I figure this can be accomplished easily enough with the proper command line script (that I can point the desktop icon to). Thanks for any help!
|
Not a script, but the "magic" key combinations: "CTRL ALT +" and "CTRL ALT -" should hop through the available X-server resolutions.
Important note: These are the '+' and '-' on the numpad. The "normal" '+' and '-' don't work. Hope this helps. |
You could write a script using xvidtune -next/-prev but it's probably easier to use ctrl alt +/- as Hko explained.
Also, if you ever find that a game/app has locked the display so you can't change resolution, then xvidtune -unlock will, well, unlock it. ;) |
You also have to have appropriate modes defined in your xorg.conf file to switch between them like that.
|
xrandr is the command to change res
xrandr -q to list modes, then xrandr -s 0,1,2 etc |
Quote:
|
Quote:
|
Thanks, that xrandr command will work nicely. I know about CTRL ALT+/-, but I'm not going to expect grandma to remember that! A nice big screen icon that says "Restore my screen" is what she needs.
|
*blink* I don't know why it didn't occur to me before but the obvious solution would be to wrap the game(s) in a script that would automatically reset the resolution if necessary.
Looking at xrandr, this should be simple, the current resolution is shown with a *. Since the default resolution is size "0", it's a trivial matter to check it. Code:
#!/bin/sh |
You could simplify and just put xrandr -s 0 after run game command, after all we know the res is going to be wrong anyhow
|
True, in this case. I was aiming for a more general solution (and trying to be elegant by avoiding unnecessary command). :)
BTW, what kind of game is it anyway? If it's open source, it should be easy enough to patch it to reset the resolution itself. |
All times are GMT -5. The time now is 02:48 PM. |