LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing video resolution from command line? (https://www.linuxquestions.org/questions/linux-general-1/changing-video-resolution-from-command-line-169268/)

lhouk 04-12-2004 03:36 PM

Changing video resolution from command line?
 
I need to be able to immediately reset the display resolution from within a shell script (since one of the games I run under Wine resets the resolution to 640x480 and doesn't restore it when it exits). I tried

/sbin/setxconf -g 1024x768 -b 16

but it didn't seem to do anything. What is the command line equivalent of "right-click-on-desktop -> Properties -> Settings -> change-screen-size -> Apply" under Xandros 2.0, which I'm running? (If it didn't log me out when it resizes like that sequence does, it would be even better, by the way.) Thanks in advance to all who respond!

Creak 04-12-2004 06:49 PM

You should have to make a script that change the XF86Config-4 and reboot the x server...
I'm sur it's possible, but i don't know how, sorry :confused:

Creak

lhouk 04-14-2004 09:31 AM

Quote:

Originally posted by Creak
You should have to make a script that change the XF86Config-4 and reboot the x server...

Creak

Actually, it's even simpler than that, in theory. See, if I reboot the system, it comes up with the correct resolution, so XFConfig-4 never changes. In fact, if I just do a su and then restart X with startx, it comes up with the correct resolution. However, it also comes up to a login prompt; I'm logged out when X is restarted.

Frankly, I didn't expect this to be so complicated. When I run Master of Orion II under Wine, the first thing that happens is that the screen is changed to 640x480 resolution. How does Wine do this without restarting X? Anybody familiar with the Wine source code?

dkaplowitz 04-14-2004 09:35 AM

If you have the "Modes" section set up with a number of alternative resolutions, you should be able to ctrl+alt+"+" or "-" to the other resolutions listed in "Modes".

If not that, then maybe you can use "xvidtune" to set it, but that's less immediate.

lhouk 04-15-2004 02:16 PM

I got a solution from the Usenet group "comp.emulators.ms-windows.wine"; I need to use the "xrandr" command. :D To quote from the Usenet posting:

Quote:

Ville Aakko <vaa82@hotmail.com> wrote in message news:<c5k7on$fo1$1@ousrvr3.oulu.fi>...
> Try these workarounds:
>
> - try changing resolution with CTRL+ or CTRL- (that is, pressing CTRL and +
> or CTRL and - together). Test this before running wine, so you know how
> it works.
> - If that doesn't work, run "xvidtune -unlock" and then try CTRL+ and CTRL-
> - If that doesn't work, run "xrandr -q" and then "xrandr -s #", where # is
> the correct display mode. Also look at xrandr's man page.
>
> ...You could check you have "UseXRandR" = "Y" in your wine config, I believe
> that should make wine change resolutions itself in normal situations.
Oddly enough, I found that Ctrl/Alt/+ and Ctrl/Alt/- worked fine before running Wine, but not afterwards. And "xvidtune -unlock" made no difference. But "xrandr" did! So, I wanted to post what worked for me, in hopes that it might prove useful to someone else. And also, thanks to creak and dkaplowitz for their suggestions. :)

Leslie


All times are GMT -5. The time now is 06:03 PM.