Welcome to SparkyLinux forums
Zapraszamy również na polsko-języczne Forum

How change monitors from terminal ? "xrandr: Cant open display"

Started by vic131, May 24, 2021, 10:55:10 PM

Previous topic - Next topic


I'm booting sparklinux from a live-usb in a notebook with broken screen, so there is a external monitor conected by VGA. The external monitor is booted dual with the notebook monitor. And the external monitor resolution is booted with some issues. To fix it i need to put the external monitor as the primary monitor, or even better, shutdown the notebook monior. In Ubuntu i cant use the fn+special key to change monitors. In Lubuntu i can open the start menu, type 'monitor' and change it manually. In Sparkylinux the special key dosent work and start menu is tricky, so i cant acess the monitor menu whitout seeing. I'm trying xrandr to change it then, but aparently i cant open the terminal ( ctrl+alt+T), the bad resolution sends it to another realm. So i used alt+ctrl+f1 to try xrandr, but for most but not all xrandr comands i get "xrandr: Cant open display". Help.


You should be able to use this command in a bash script.  I'm not currently using two monitors (lost my displayport cable) or else I'd fix it for you.

if you export an environmental variable called `DISPLAY` ...

(in the shell)  you should be able to change monitors in the *Console*  ( which is what you were doing with Ctrl+alt+f1)

/usr/bin/lxqt-config-globalkeyshortcuts aka "shortcut keys" will be able to run your script when you press special keys, or when you logon.

I hope this helps, I might check this thread  again next week.

so really you should be able to do this I think.  Maybe hop on IRC for more help?

View the most recent posts on the forum