You are not logged in.
I was using nvidia-beta for a while due to some high CPU issues and possible kernel incompatibility which I believe is resolved. I changed back to the standard nvidia driver, and now when my laptop is docked (which is connected to an external display), startx automatically boots into an extended desktop display mode. I typically only use the external monitor when I want to, and would prefer that startx simply use the laptop display. This also goofs with some of my conky instances, as some two of my three are right-aligned and thus go onto the external display. I can easily use `disper -s` to turn off the monitor, but I have to kill/restart conky in order to get them in the right place on my laptop display.
Any suggestions? My googling is only turning up instances of people wanting to turn on automatic display detection vs. disabling it when it is happening automatically.
I'm sure it's something simple in an /etc/X11/nvidia.conf file, /etc/modprobe.d/nvidia.conf or similar, but am not sure. Thanks for input.
Offline
I am sure that there is a better way to do this using the /etc/X11/nvidia.conf file, but I am not very familiar with that one. The way that I am familiar is to put this line at the top of the session file that startx uses:
disper -sNote that I am not backgrounding it using the '&'. You do not want to do that because then the script will hang until the display switch complete. You also want to put it before the conkys because then the display switch happens before conky is started.
I face similar issues with dzen and trayer. I get around it by using the following bash script to determine the screen sizes:
#!/bin/bash
OUT=$(disper -p 2> /dev/null )
NUMBER=$(( ${1:-1} + 1 ))
MONITOR=$(echo "$OUT" | sed -e '/xinerama/!d' \
-e 's/[a-z ]*: //' \
-e 's/$/,/' \
-e 's/[A-Z0-9-]*,/|&|/'$NUMBER \
-e 's/,//g' \
-e 's/[^|]*|\([A-Z0-9-]*\)|.*/\1/')
source <(echo "$OUT" | sed -e '/metamode/!d' \
-e "s/$MONITOR: nvidia-auto-select @\([0-9]*\)x\([0-9]*\) +\([0-9]*\)+\([0-9]\)/|W=\1;H=\2;X=\3;Y=\4;|/" \
-e 's/[^|]*|\([0-9XYWH=;]*\)|.*/\1/')
case $2 in
w) echo $W ;;
h) echo $H ;;
x) echo $X ;;
y) echo $Y ;;
*) echo "X=$X"
echo "Y=$Y"
echo "W=$W"
echo "H=$H"
;;
esacI am sure that the script could be improved upon, but that's how I take care of it.
Just out of curiosity, does your disper function properly? Mine stopped working a couple weeks ago.
Offline
@polson136: Thanks for the reply.
For me, disper does work to put me back on the laptop screen, but my conky instances remain off the screen. Maybe it's more about my conky configs or something? I have three running, two of which are using ${alignr} to right align them. Nvidia/xrandr/??? is automatically assigning my external display as "right of" my laptop, so that's where those two conky instances end up. Even though I can easily use `disper -s` to get solely on the laptop, the conky instances are nowhere to be found. I have to kill and restart them so they'll be right aligned to the laptop and not the full stacked width of the initial screen when I ran `startx` (which is 1600 + 1440 for laptop + external monitor).
Your script is intriguing... not a very advanced bash-er myself, so I couldn't follow it, but did want to inquire about if that would help with my conky issue at all? It's not that I can't turn the screen off, it's that everything is defined with respect to the total size upon `startx` due to the auto-detection. So I want it to not use an external display unless I tell it to...
Thanks again!
Offline
I am not a very experienced conkyer, but I have dealt with this problem in other programs.
The trick with the first part of the post is to run disper BEFORE conky is ever started. This should be possible by adding the disper command to the top of your startup file. (usually .xinitrc or .xsession, depending on how you start x. I don't know what startx uses)
The script in the second part of my post reads the monitor information from disper and then outputs in a more script-friendly format. If you have a program that can use that information, say from a command line argument (I don't know if Conky does), then that can be used to position it.
Offline
Ah, gotcha. Yeah, I'd have to put disper in my autostart.sh openbox file, which is where I start my conky's from. I'll dig into your script at some point, and thanks for the explanation! There's *got* to be a way to stop nvidia or X from auto-detecting. I might post on SuperUser or something to see if I get any other hits. Thanks again!
Offline
I'm pretty sure you can from xorg.conf, but I don't know it well enough. I don't think laptop autodetects. I'll see if I can figure out why.
Offline