The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 2,470     Votes:  5 
Tag : xrandr  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1173410
Title: Can I automatically generate a command-line for xrandr based on the current set-up?
ID: /2019/09/11/Can-I-automatically-generate-a-command-line-for-xrandr-based-on-the-current-set-up_
Created: September 11, 2019
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


I’ve had the same problem before which led me to create a function in ~/.bashrc called xreset:

xreset () {

    xrandr --output HDMI-0  --mode 1920x1080 --pos 0x0       --rotate normal \
           --output eDP-1-1 --mode 1920x1080 --pos 3840x2160 --rotate normal \
           --output DP-1-1  --mode 3840x2160 --pos 1920x0    --rotate normal

} # xreset

After you get your monitors arranged by position and resolution, grab the current setup with:

$ xrandr | grep " connected"

HDMI-0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 1107mm x 623mm
eDP-1-1 connected primary 1920x1080+3840+2160 (normal left inverted right x axis y axis) 382mm x 215mm
DP-1-1 connected 3840x2160+1920+0 (normal left inverted right x axis y axis) 1600mm x 900mm

All the information is there for you to create your own xreset function.

⇧ Ubuntu 18.04.3 LTS in start up Output channel for audio resets after every reboot  ⇩