Score:0

Define display positions from bash in Wayland?

ng flag

So xrandr is broken in Wayland. As is, well the list is too long...

It is impossible to set display positions precisely with the GUI display settings.

Is there no means of defining display positions from bash? Any configuration file that can be edited?

My config if it's pertinent:

inxi -SG

System:
  Host: cview Kernel: 5.15.0-70-generic x86_64 bits: 64 Desktop: GNOME 42.5
    Distro: Ubuntu 22.04.2 LTS (Jammy Jellyfish)
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] driver: i915 v: kernel
  Device-2: NVIDIA GM107GL [Quadro K1200] driver: nouveau v: kernel
  Display: wayland server: X.Org v: 1.22.1.1 with: Xwayland v: 22.1.1
    compositor: gnome-shell driver: X: loaded: modesetting unloaded: fbdev,vesa
    gpu: nouveau resolution: 1: 1920x1080~60Hz 2: 1080x1920~60Hz
    3: 1080x1920~60Hz 4: 1920x1080~60Hz
  OpenGL: renderer: NV117 v: 4.3 Mesa 22.2.5
vanadium avatar
cn flag
It is unclear what exactly you want to do/achieve. Display positions? You want to precisely define where a window is positioned? Want to change resolution?
Frobozz avatar
ng flag
Position. Resolution is always presets and easily enough set. I need a means of setting my display positions to the pixel.
Score:0
ng flag

Monitor "positions" for Gnome (gdm3) can be adjusted precisely by editing ~/.config/monitors.xml for a user's session. Apparently, this works whether your session is XOrg or Wayland, though they will each have their own "configuration" section due, I believe, to assigning "connectors" differently.

Set the "x" and "y" elements relative to an upper-left origin of 0,0 to position each display. Take care to ensure that all displays are contiguous - a void will block mouse navigation to/from an isolated display.

<monitors version="2">
  <configuration>
    <logicalmonitor>
      <x>0</x>
      <y>480</y>
      <scale>1</scale>
      <primary>yes</primary>
      <transform>
        <rotation>left</rotation>
        <flipped>no</flipped>
      </transform>
      <monitor>
        <monitorspec>
          <connector>DP-4</connector>
          <vendor>DEL</vendor>
          <product>DELL U2414H</product>
          <serial>R9F1P4CC33PL</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>1080</x>
      <y>0</y>
      <scale>1</scale>
      <transform>
        <rotation>upside_down</rotation>
        <flipped>no</flipped>
      </transform>
      <monitor>
        <monitorspec>
          <connector>DP-6</connector>
          <vendor>DEL</vendor>
          <product>DELL U2414H</product>
          <serial>JH8WC8BT0C7L</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>1080</x>
      <y>1080</y>
      <scale>1</scale>
      <monitor>
        <monitorspec>
          <connector>DP-5</connector>
          <vendor>DEL</vendor>
          <product>DELL U2414H</product>
          <serial>R9F1P4CC32EL</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <logicalmonitor>
      <x>3000</x>
      <y>480</y>
      <scale>1</scale>
      <transform>
        <rotation>right</rotation>
        <flipped>no</flipped>
      </transform>
      <monitor>
        <monitorspec>
          <connector>DP-7</connector>
          <vendor>DEL</vendor>
          <product>DELL U2414H</product>
          <serial>R9F1P58S2P3S</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
        </mode>
      </monitor>
    </logicalmonitor>
  </configuration>
</monitors>

This same file can be edited and copied (as root) to the /var/lib/gdm3/.config folder to apply to the GDM "Greeter" (the screen you log in from). In my case, I prefer to log in on my central monitor so I disabled the other three, set it's origin to 0,0, and set it as primary thusly:

<monitors version="2">
  <configuration>
    <logicalmonitor>
      <x>0</x>
      <y>0</y>
      <scale>1</scale>
      <primary>yes</primary>
      <monitor>
        <monitorspec>
          <connector>DP-5</connector>
          <vendor>DEL</vendor>
          <product>DELL U2414H</product>
          <serial>R9F1P4CC32EL</serial>
        </monitorspec>
        <mode>
          <width>1920</width>
          <height>1080</height>
          <rate>60</rate>
        </mode>
      </monitor>
    </logicalmonitor>
    <disabled>
      <monitorspec>
        <connector>DP-7</connector>
        <vendor>DEL</vendor>
        <product>DELL U2414H</product>
        <serial>R9F1P58S2P3S</serial>
      </monitorspec>
      <monitorspec>
        <connector>DP-6</connector>
        <vendor>DEL</vendor>
        <product>DELL U2414H</product>
        <serial>JH8WC8BT0C7L</serial>
      </monitorspec>
      <monitorspec>
        <connector>DP-4</connector>
        <vendor>DEL</vendor>
        <product>DELL U2414H</product>
        <serial>R9F1P4CC33PL</serial>
      </monitorspec>
    </disabled>
  </configuration>
</monitors>

A final word of caution: be sure you backup and have means of recovering either file if you intend to edit them. You can leave no monitors operable. In my case, I had OpenSSH_Server installed and was able to recover the files and reboot from another system.

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.