0

How can I set the display mode to "mirror" in a bash script? (Without using the GUI gnome settings). And only once (not everytime a new display is attached)

Edit I got a suggestion to use xrandr "same-as" argument (How to enable "mirror" feature in the display settings using command line?). Thanks for that. But the problem with that solution is that it needs to be done each time a display is attached. I need the "mirror" option to be the default action when attaching a new display. We basically provide devices to a client, but if the client attaches multiple displays, he/she shouldn't need to execute anything. We actually got it working that way on Xubuntu 18.04 (Xfce), but I have no idea if that's default behavior or not.

Display Mode

  • If the existing answer isn't sufficient, another possible solution should rather be added to the existing thread on the same topic. – Artur Meinild Nov 30 '22 at 10:37
  • Have a look at the suggestions in this thread: Run script when monitor is connected – BeastOfCaerbannog Nov 30 '22 at 14:25
  • @ArturMeinild I am not sure but there might be a trick here? Up until 20.04 we could safely assume that Xorg will be the display server, so answers pointing to the very versatile and helpful xrandr command were reliable. But 22.04 comes by default with Wayland. I would be surprised if xrandr worked on Wayland, as it appears to be specific to Xorg... So, does xrandr work on Wayland? If not, then does Wayland has an equivalent thing? – Levente Dec 01 '22 at 09:25
  • @OP are you using Xorg as display server? It's highly relevant to the correct answer. Your account seems to suggest that you could execute the xrandr command with success and the desired effect? It would worth clarifying then that you use Xorg. – Levente Dec 01 '22 at 09:49
  • @Levente: we indeed disabled Wayland because of other issues. – fre_der Dec 01 '22 at 14:15
  • I was actually looking for a setting (in Gnome, Ubuntu) that would just change the default behavior of newly attached displays to just "mirror" instead of "extend", just like Xubuntu 18.04. But I guess I'll have to live with the fact that this is no longer possible, and build a scripted solution based on the suggestions – fre_der Dec 01 '22 at 14:23
  • 1
  • I already switched back to Xubuntu, not only for this but also for other issues (https://askubuntu.com/questions/1442443/disable-overview-on-startup-not-working-when-booting-without-display-connected) I appreciate the comments, I really do, but why does a trivial thing (new monitor = mirroring by default) need this much effort? I'm aware the term "much effort" is relative, but I just think this should be a lot easier, as in: set setting X to "mirror". – fre_der Dec 08 '22 at 10:58

0 Answers0