Score:-1

xrandr commands are not working as expected

ai flag

My ~/.xprofile contents:

xrandr --output HDMI-0 --mode 1600x900 --pos 0x0 --rate 59.98 --panning 0x0
xrandr --output HDMI-1 --mode 1920x1080 --pos 1600x880 --rate 60 --panning 0x0 --primary

Right. LOGICALLY, this should be fine. Monitor HDMI-0 should have resolution 1600x900 and positioned at 0x0. Refresh rate of 59.98 frames per second. Panning should be disabled. Monitor HDMI-1 should have resolution 1920x1080, positioned to the lower right corner of HDMI-0 with a little extra height so there's a 20 pixel border between the vertical sides of each monitor. Refresh rate of 60. And panning disabled.

But when I unlock my PC, and have to run sudo ~/.xprofile out of terminal to fix the garbage resolutions of <1024x768, none of the parameters I put into ~/.xprofile get respected outside of resolutions. The resolutions look right.

But the monitors overlap. Both are set at 0x0. So they're showing the same content. That's not what I want. And my primary monitor, HDMI-1, is panning and seems to have an effective resolution of like 3600x2400.

My only fix is to press Super, type Settings, go to Display, and manually drag the monitors into the position I want.

Can someone explain why the above xrandr commands produce completely disconnected results?

karel avatar
sa flag
I am voting to close this question for reasons similar to those mentioned by @Nmath. In addition I have posted an answer about asking troubleshooting questions at [Super User Meta](https://meta.superuser.com/a/14904/) which I believe should be supported at Ask Ubuntu if they are asked properly.
Tim50001 avatar
ai flag
I added the "my" for a reason. For some reason, MY commands for xrandr are not working, despite being exactly in line with the documentation as far as I'm aware. I'm so glad you guys are so concerned about not helping someone who has done all this research. I'll edit the post to just the bare minimum! Done. So please, I'm begging anyone who has any light to shed on the matter instead of being pedantic, help me fix my Ubuntu so I can actually enjoy using it.
Tim50001 avatar
ai flag
I don't want to letterbox.
Tim50001 avatar
ai flag
I just want a normal resolution. Very vanilla. Perfect fit for screen for the max resolution the hardware wants. Monitor 1: 1920x1080. Monitor 2: 1600x900. That's it! I don't want fanciness. But the OS is spontaneously changing my resolutions and adding in panning and unnecessary stuff. I don't know why, at all! And yes, 1600x900 *is* native for this cheap secondary monitor. Windows sets it just fine with every boot. Ubuntu will support it when I manually set it.
Tim50001 avatar
ai flag
I guess what I'll have to do is record a video of my monitors messing up because describing it is not making sense. Like, I want to be NORMAL. The same as what Windows would logically do. The OS should query each monitor to find out what its preferred resolution is. The OS sets the resolutions to match those. They respect the user's defined positions to reflect their physical location. That's it. Not changing spontaneously when waking a computer. Not having the two monitors placed in the same virtual space. Just, normal. Normal workflow. Normal displays. Normality. I want to achieve normality.
cc flag
Your settings look like they could be done in the Settings/Display gui. Is there a reason you don't want to use that?
Tim50001 avatar
ai flag
Because it's a PITA @ubfan1. When the resolution is broken and windows don't appear where they should, you want me to navigate the UI every time? Why can't I use a script? In fact, why should I have to do this every time I unlock my computer at all? Even if there is absolutely no fix and Ubuntu is a perpetually broken OS, at the very least it should let me use a script to fix it. I am looking for assistance, not peanut gallery comments, thank you. Videos here: https://youtu.be/sqRVQre0RMI and https://youtu.be/FTIjt7wrx1U
Score:0
bd flag

Get arandr, drag the monitors to the position you want, and tell it to save the settings. it will create a script in ~/.screenlayout/default.sh

apt install arandr

arandr

Set your screens as needed, apply, save.

chmod 755 ~/.screenlayout/default.sh

~/.screenlayout/default.sh

You can then use that script with one caveat, and this may be the issue for you: IF you have nvidia and have used the nvidia settings, it may be overriding some functions with .nvidia file settings, those will need to be removed from your home directory. I had to create a new user, then try to do this.

(I use XFCE, the issue ONLY appeared in XFCE but not other desktops, so something about nvidia settings on xfce caused the virtual screen size to be messed up. (It made one of my monitors very tiny though it had the right resolution listed.) I think there were .nvidia, .nv, .noveau, settings in my home directory, in ~/.config, ~/.local, and a couple of other "hidden" directories. THEY ALL had to be removed. Now it works like a champ. And you can assign said script to a keystroke. (Some desktops may let you run it at unlock)

Tim50001 avatar
ai flag
Oh my god, this sounds so promising. Months ago I asked for some way to just save current display settings into the ~/.xprofile instead of manually writing them (and again executing it not doing what was written at all). I don't quite have time to get hooked into troubleshooting this right now, but maybe tonight or tomorrow. Thank you so much for the optimism!
Ntrcessor avatar
bd flag
How did the testing/searching go? The easy test would be a temporary user, then apply the script generated by arandr under the new user. If it works right, then you can look to weed out those settings. If you have a different video card (ATI/AMD/Intel) then there may be equivalent things that they set. Basically a contention issue between things the driver can do, and things that X.org/Wayland can do.
Tim50001 avatar
ai flag
I don't know for sure. But it's somehow in a stable state for now. I ran the arandr stuff. The arandr GUI was wonky and reminded me of Windows XP exceeding the 256 MB of RAM it had. The buttons at the top would turn invisible until moused over. Anyway, I managed to save a profile, with the directions you gave about it being default.sh and everything. But I never run it from the terminal, I've not had the resolution whack out yet. One thing I tried simultaneously was toggling to wayland on the lock screen. That broke my old script as HDMI0 and HDMI1 were replaced with Wayland0 and Wayland1.
Tim50001 avatar
ai flag
So I had to research steps to disable Wayland again and somewhere in that mess, it's stabilized. So I'm back on Xorg, but I think the monitors are still identified as Wayland. (Just tested with xrandr in the terminal. My monitors are now Wayland1 and Wayland11.) Whatever. I also got upset because audio kept defaulting to go through my poor monitor with scratchy speakers and nothing software wise ever fixed it. I thought to just swap the HDMI cables around and that works. In other words, I swapped which monitor connects to which port out of my GPU and now audio defaults to my good monitor.
Tim50001 avatar
ai flag
Because I haven't had the resolution mess up and I really don't want to try to purposefully break it in case I can't unbreak it again, I'm leaving it in limbo. I'll mark the answer as solved as maybe it's done something critical, but I unfortunately can't be absolutely confident it wasn't some other step like toggling Wayland for the very first time or the HDMI cable swap.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.