You are not logged in.

#1 2013-12-07 17:26:44

Somnus
Member
Registered: 2013-07-16
Posts: 105

Starting xrandr script at startup.

This issue started as one thing and has evolved into the following:

What I need to try to find out is how to run this xrandr.sh script at startup. Creating a .desktop and having xfce's Startup Programs run it doesn't work. Neither does adding the lines in the .sh to .xinitrc.
The only way I've gotten it to work is to have conky start at startup, and have conky run the script. I should note that I'm using very minimal xfce programs. Most of them have been gutted and taken over by Openbox, if that makes a difference.

The script is:

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode DVI-I-0 1680x1050_60.00
xrandr --output DVI-I-0 --mode 1680x1050_60.00

Here's the original post, and everything on the first page of this thread is related to it.

Hello everyone. I just recently replaced my GPU from the Nvidia GT430 to the GT640. This is the first time I've replaced a GPU while running linux. After installing the card my screen resolution is automatically set at  1024x768. My preferred resolution is 1680x1050, however that option is available in the Nvidia X Server Settings program.  I know that normally this means that the drivers aren't updated, so I reinstalled the nvidia drivers and reboot. The X Server program shows that I have the latest driver for my card (v331.20) but I still don't have the correct resolution available.

Does anyone have any ideas? Do I need to completely remove the nvidia drivers, switching to nouveau temporarily, and reinstall them?

Any help is appreciated!

EDIT: Post name changed to indicate the new nature of the related problem.

Last edited by Somnus (2013-12-14 17:14:54)

Offline

#2 2013-12-07 17:38:27

GloW_on_dub
Member
Registered: 2013-03-13
Posts: 391
Website

Re: Starting xrandr script at startup.

what is the output of xrandr ?

Offline

#3 2013-12-07 17:39:34

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Screen 0: minimum 8 x 8, current 1024 x 768, maximum 16384 x 16384
DVI-I-0 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768       75.0*+   70.1     60.0  
   1792x1344      60.0  
   1600x1200      65.0     60.0  
   1400x1050      74.8     60.0  
   1280x1024      75.0     60.0  
   1280x960       60.0  
   1152x864       75.0  
   832x624        74.6  
   800x600        75.0     72.2     60.3     56.2  
   700x525        74.8     60.0  
   640x480        75.0     72.8     59.9  
   512x384        70.1     60.0  
   400x300        72.2  
   320x240        72.8     60.1  
DVI-I-1 disconnected (normal left inverted right x axis y axis)
HDMI-0 disconnected (normal left inverted right x axis y axis)
DVI-D-0 disconnected (normal left inverted right x axis y axis)

Offline

#4 2013-12-07 17:47:38

GloW_on_dub
Member
Registered: 2013-03-13
Posts: 391
Website

Re: Starting xrandr script at startup.

Does

xrandr -s 1680x1050

work ?
Is this the way you want your display to look ?

Offline

#5 2013-12-07 17:49:33

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Unfortunately that doesn't work. It says "Size 1680x1050 not found in available modes"

I know that the card can do it, since it's working on windows (dual boot), just not sure what I need to do to get it working here now.

Offline

#6 2013-12-07 17:54:33

GloW_on_dub
Member
Registered: 2013-03-13
Posts: 391
Website

Re: Starting xrandr script at startup.

Offline

#7 2013-12-07 18:01:42

Kilzool
Member
From: Ireland
Registered: 2010-08-04
Posts: 232

Re: Starting xrandr script at startup.

I would look into your /etc/X11/xorg.conf and see if that is causing any issues.
I would remove your ~/home/$user/.nvidia-setting-rc if you have one.

You may also try resetting the xorg.conf by using the nvidia-xconfig as root.
Then rebooting, after.

Last edited by Kilzool (2013-12-07 18:02:30)

Offline

#8 2013-12-07 18:50:57

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Thank you GloW! This worked perfectly. Thank you for solving my problem, as well as prompting me to learn more about xrandr.

Offline

#9 2013-12-07 21:24:55

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Removed the solve tag from this post.

After reboot none of the xrandr settings were saved. I have to create the newmode again.

I see in the wiki that if you change the resolution using xrandr that it only has effect for that session, but after adding the newmode I set it in nvidia thinking that would make it permenant. I even saved the xconfig file but it didn't save.

Offline

#10 2013-12-07 22:19:13

GloW_on_dub
Member
Registered: 2013-03-13
Posts: 391
Website

Re: Starting xrandr script at startup.

you can add or xrandr commands you use in your ~/.xprofile
or

nvidia-xconfig --mode=1680x1050

then manually add, right after,  the Modeline  you've used with xrandr command, something like :

Modeline "1920x1080i_50" 78.300 1920 2464 2520 2784 1080 1102 1117 1125 interlace +hsync +vsync

Last edited by GloW_on_dub (2013-12-07 22:19:27)

Offline

#11 2013-12-07 23:05:26

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

I've tried making a script with:

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode DVI-I-0 1680x1050_60.00
xrandr --output DVI-I-0 --mode 1680x1050_60.00

in it and putting in the start up applications, and I've also tried adding that to .xinitrc with no luck.. just nothing happens. I can run the script manually though and it works fine.

Offline

#12 2013-12-08 09:47:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Starting xrandr script at startup.

Post your ~/.xinitrc or ~/.xprofile, whichever you use.

Offline

#13 2013-12-11 17:43:19

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Sorry for the delay, but here's the .xinitrc:

#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)

if [ -d /etc/X11/xinit/xinitrc.d ]; then
  for f in /etc/X11/xinit/xinitrc.d/*; do
    [ -x "$f" ] && . "$f"
  done
  unset f
fi

##############################
# Choose Desktop Environment #
##############################

 exec startxfce4

##############################
# Switch Input With Keyboard #
##############################

setxkbmap -layout "us, el" -option "grp:sclk_toggle "


###############################
# Set Resolution at 1680x1050 #
###############################

xrandr --newmode "1680x1050_60.00"  146.25  1680 1784 1960 2240  1050 1053 1059 1089 -hsync +vsync
xrandr --addmode DVI-I-0 1680x1050_60.00
xrandr --output DVI-I-0 --mode 1680x1050_60.00

Offline

#14 2013-12-11 17:49:55

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Starting xrandr script at startup.

Read the note https://wiki.archlinux.org/index.php/Xinitrc

Make sure to uncomment only one exec line, since that will be the last command run from the script; all the following lines will just be ignored.

Offline

#15 2013-12-11 17:52:23

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

I do only have one exec line uncommented though. Unless you mean only one line -period- uncommented. Is that what you mean? As in, I should everything I want to happen at start up on the same line?

Offline

#16 2013-12-11 17:54:10

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Starting xrandr script at startup.

Try moving setxkbmap and xrandr commands up, before 'exec startxfce4'.

Offline

#17 2013-12-11 23:29:25

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

Oh I see what you're saying, sorry!

That was a partial success. Now the setxkbmap is working, but still no go on the xrandr...

Offline

#18 2013-12-12 06:21:23

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Starting xrandr script at startup.

Offline

#19 2013-12-12 09:18:08

Neburski
Member
Registered: 2009-09-15
Posts: 118

Re: Starting xrandr script at startup.

Somnus wrote:

Oh I see what you're saying, sorry!

That was a partial success. Now the setxkbmap is working, but still no go on the xrandr...

Did you place the xrandr commands above the exec line?

Last edited by Neburski (2013-12-12 09:20:17)

Offline

#20 2013-12-12 18:37:50

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

I did.

Offline

#21 2013-12-12 22:22:29

czubek
Banned
Registered: 2012-03-08
Posts: 141

Re: Starting xrandr script at startup.

A few years back I recall Googling “how to make xrandr settings permanent?” I found an answer in either Arch or ArchBang, I can’t remember. The poster suggested creating the following /etc/X11/xorg.conf.d/10-monitor.conf file:

Section "Monitor"
    Identifier             "VGA1"
    Option                 "Enable"  "true"
EndSection

Section "Monitor"
    Identifier             "LVDS1"
    Option                 "ignore"  "true"
EndSection

I needed xrandr to determine the monitor identifiers, and after that I removed it.
I’ve used it ever since. I just save it along with other files I need every time I re-install Arch.

Offline

#22 2013-12-13 08:06:46

GloW_on_dub
Member
Registered: 2013-03-13
Posts: 391
Website

Re: Starting xrandr script at startup.

This is what i propose in my last post , see here :
https://wiki.ubuntu.com/X/Config/Resolu … _xorg.conf

Offline

#23 2013-12-14 16:13:53

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

I haven't had an opportunity to try the xorg tweak yet because I've been dealing with a new issue... after I tried putting my xrandr script in the main bin folder, rather than my user one, Arch would load up to a blank screen. Switching getty would throw out errors about out of memory. I started Arch in single user mode, removed that script, reboot, and same thing. So I commented out the xrandr lines from .xinitrc, and now I can boot in again. However! Now my original script isn't working, and neither is adding the commands manually. I'm getting an error saying that bash doesn't recognize any xrandr commands:

bash: xrandr: command not found

Now I -really- don't know what to with xrandr. I'm going to try the xorg thing real quick and see what happens.

Offline

#24 2013-12-14 16:20:19

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Starting xrandr script at startup.

Do you have xorg-xrandr installed?

Offline

#25 2013-12-14 16:24:27

Somnus
Member
Registered: 2013-07-16
Posts: 105

Re: Starting xrandr script at startup.

I did, yes. I just reinstalled it (yaourt confirmed it was REinstalling) and that took care of it. Thank you.

Starting to get frustrated!

Offline

Board footer

Powered by FluxBB