Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
xrandr
# RandR extension
xrandr --output VGA1 --off
xrandr --orientation normal
xrandr -o normal
xrandr --output LVDS --auto --rotate normal --pos 0x0 --output VGA --auto --rotate left --right-of LVDS 
xrandr | grep connected
xrandr --output eDP1 --brightness 0.95
xrandr --output eDP1 --brightness 0.5
xrandr --output eDP1 --brightness 0.25
xrandr --output eDP1 --brightness 0.15
xrandr --output HDMI-0 --set underscan on
xrandr --output HDMI-0 --mode 1220x686 --set underscan on --set "underscan hborder" 30 --set "underscan vborder" 16
xrandr --output eDP1 --mode 1366x768 --panning 1920x1080 --scale 1366x768 --scale-from 1920x1080
xrandr --newmode "1776x1000" 147.05 1776 1880 2072 2368 1000 1001 1004 1035 +hsync
xrandr --addmode HDMI1 "1776x1000"
xrandr --output HDMI1 --mode 1776x1000 --panning 1776x1000 --primary \
      --output eDP1 --mode 1366x768 --panning 1776x1000
xrandr --verbose
  Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
  DP1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x42
    Timestamp:  2055750
    Subpixel:   unknown
    Clones:     HDMI1
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    Broadcast RGB: Automatic 
      supported: Automatic, Full, Limited 16:235
    audio: auto 
      supported: force-dvi, off, auto, on
  DP2 connected primary 1920x1080+0+0 (0x48) normal (normal left inverted right x axis y axis) 509mm x 286mm
    Identifier: 0x43
    Timestamp:  2055750
    Subpixel:   unknown
    Gamma:      1.0:1.0:1.0
    Brightness: 1.0
    Clones:    
    CRTC:       0
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    EDID: 
      00ffffffffffff000469fa2335250000
      12160104a5331d7822d945a2554da027
      125054b7ef00714f814081809500b300
      d1c081c08100023a801871382d40582c
      4500fd1e1100001e000000ff0043354c
      4d54463030393532350a000000fd0032
      4b185311000a202020202020000000fc
      00415355532056533233380a20200036
    Broadcast RGB: Automatic 
      supported: Automatic, Full, Limited 16:235
    audio: auto 
      supported: force-dvi, off, auto, on
    1920x1080 (0x48) 148.500MHz +HSync +VSync *current +preferred
          h: width  1920 start 2008 end 2052 total 2200 skew    0 clock  67.50KHz
          v: height 1080 start 1084 end 1089 total 1125           clock  60.00Hz
    1680x1050 (0x49) 146.250MHz -HSync +VSync
          h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
          v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
    1280x1024 (0x4a) 135.000MHz +HSync +VSync
          h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
          v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
    1280x1024 (0x4b) 108.000MHz +HSync +VSync
          h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
          v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
    1440x900 (0x4c) 106.500MHz -HSync +VSync
          h: width  1440 start 1520 end 1672 total 1904 skew    0 clock  55.93KHz
          v: height  900 start  903 end  909 total  934           clock  59.89Hz
    1280x960 (0x4d) 108.000MHz +HSync +VSync
          h: width  1280 start 1376 end 1488 total 1800 skew    0 clock  60.00KHz
          v: height  960 start  961 end  964 total 1000           clock  60.00Hz
    1280x800 (0x4e) 83.500MHz -HSync +VSync
          h: width  1280 start 1352 end 1480 total 1680 skew    0 clock  49.70KHz
          v: height  800 start  803 end  809 total  831           clock  59.81Hz
    1152x864 (0x4f) 108.000MHz +HSync +VSync
          h: width  1152 start 1216 end 1344 total 1600 skew    0 clock  67.50KHz
          v: height  864 start  865 end  868 total  900           clock  75.00Hz
    1280x720 (0x50) 74.250MHz +HSync +VSync
          h: width  1280 start 1390 end 1430 total 1650 skew    0 clock  45.00KHz
          v: height  720 start  725 end  730 total  750           clock  60.00Hz
    1024x768 (0x51) 78.800MHz +HSync +VSync
          h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.06KHz
          v: height  768 start  769 end  772 total  800           clock  75.08Hz
    1024x768 (0x52) 75.000MHz -HSync -VSync
          h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
          v: height  768 start  771 end  777 total  806           clock  70.07Hz
    1024x768 (0x53) 65.000MHz -HSync -VSync
          h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
          v: height  768 start  771 end  777 total  806           clock  60.00Hz
    832x624 (0x54) 57.284MHz -HSync -VSync
          h: width   832 start  864 end  928 total 1152 skew    0 clock  49.73KHz
          v: height  624 start  625 end  628 total  667           clock  74.55Hz
    800x600 (0x55) 50.000MHz +HSync +VSync
          h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
          v: height  600 start  637 end  643 total  666           clock  72.19Hz
    800x600 (0x56) 49.500MHz +HSync +VSync
          h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
          v: height  600 start  601 end  604 total  625           clock  75.00Hz
    800x600 (0x57) 40.000MHz +HSync +VSync
          h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
          v: height  600 start  601 end  605 total  628           clock  60.32Hz
    800x600 (0x58) 36.000MHz +HSync +VSync
          h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
          v: height  600 start  601 end  603 total  625           clock  56.25Hz
    640x480 (0x59) 31.500MHz -HSync -VSync
          h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
          v: height  480 start  481 end  484 total  500           clock  75.00Hz
    640x480 (0x5a) 30.240MHz -HSync -VSync
          h: width   640 start  704 end  768 total  864 skew    0 clock  35.00KHz
          v: height  480 start  483 end  486 total  525           clock  66.67Hz
    640x480 (0x5b) 25.200MHz -HSync -VSync
          h: width   640 start  656 end  752 total  800 skew    0 clock  31.50KHz
          v: height  480 start  490 end  492 total  525           clock  60.00Hz
    720x400 (0x5c) 28.320MHz -HSync +VSync
          h: width   720 start  738 end  846 total  900 skew    0 clock  31.47KHz
          v: height  400 start  412 end  414 total  449           clock  70.08Hz
  HDMI1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x44
    Timestamp:  2055750
    Subpixel:   unknown
    Clones:     DP1
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
      supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
      supported: Automatic, Full, Limited 16:235
    audio: auto 
      supported: force-dvi, off, auto, on
  HDMI2 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x45
    Timestamp:  2055750
    Subpixel:   unknown
    Clones:    
    CRTCs:      0 1
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
               filter: 
    aspect ratio: Automatic 
      supported: Automatic, 4:3, 16:9
    Broadcast RGB: Automatic 
      supported: Automatic, Full, Limited 16:235
    audio: auto 
      supported: force-dvi, off, auto, on
  VIRTUAL1 disconnected (normal left inverted right x axis y axis)
    Identifier: 0x46
    Timestamp:  2055750
    Subpixel:   no subpixels
    Clones:    
    CRTCs:      2
    Transform:  1.000000 0.000000 0.000000
                0.000000 1.000000 0.000000
                0.000000 0.000000 1.000000
...
xrandr [-help] [-display display] [-q] [-v] [--verbose] [--dryrun] [--screen snum] [--q1] [--q12] [--current] [--noprimary] [--panning widthxheight[+x+y[/track_widthxtrack_height+track_x+track_y[/border_left/border_top/border_right/border_bottom]]]] [--scale xxy] [--scale-from wxh] [--transform a,b,c,d,e,f,g,h,i] [--primary] [--prop] [--fb widthxheight] [--fbmm widthxheight] [--dpi dpi] [--newmode name mode] [--rmmode name] [--addmode output name] [--delmode output name] [--output output] [--auto] [--mode mode] [--preferred] [--pos xxy] [--rate rate] [--reflect reflection] [--rotate orientation] [--left-of output] [--right-of output] [--above output] [--below output] [--same-as output] [--set property value] [--off] [--crtc crtc] [--gamma red:green:blue] [--brightness brightness] [-o orientation] [-s size] [-r rate] [-x] [-y]
...
xrandr --output HDMI1 --mode 1920x1080 --panning 1920x1080 --primary --output eDP1 --mode 1366x768 --panning 1920x1080
xrandr --output HDMI1 --transform 1.0735,0,-72,0,1.075,-41,0,0,1
xrandr --output HDMI1 --brightness 1.05 --gamma 0.95:0.95:0.95
xset -dpms s noblank s noexpose
# xrandr.verbose.parse;
{
    connected: /^(\S+) connected (?:(\d+)x(\d+)\+(\d+)\+(\d))*\s*(\(\w+\))*\s*(\w*)/,
    disconnected: /^(\S+) disconnected/,
    mode: /^\s+(\d+)x([0-9i]+)\s+(\(\w+\))\s+([0-9]+\.[0-9]+)MHz\s+((\s*[\+]*[\-]*\w*\s)*)/,
    dimension_horizontal: /^\s+h\:\s+width\s+(\d+)\s+start\s+(\d+)\s+end\s+(\d+)\s+total\s+(\d+)\s*skew\s*(\w)\s*clock\s*([0-9]*.[0-9]*)/,
    dimension_vertical: /^\s+v\:\s+height\s+(\d+)\s+start\s+(\d+)\s+end\s+(\d+)\s+total\s+(\d+)\s*clock\s*([0-9]*.[0-9]*)/
}
const exec = require('child_process').exec;
exec('xrandr --verbose', (err, stdout) => {
    console.log(`query:: ${JSON.stringify(parse(stdout), null, 2)}`);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment