Hacker News new | ask | show | jobs
by charris0 3278 days ago
My thinkpad running Linux is a bit temperamental when changing displays, often enumerating an existing display port as a new one.

I use the following script to switch to dual external monitors at a standard resolution, and a counterpart script to switch back to the internal hidef monitor.

If only I could reliably fix xfce4's panel placement all of the time...and not have to restart chrome and pycharm/intelliJ on each display change!

  #!/bin/bash
  
  EXT1=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^eDP | head -n 1`
  EXT2=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep HDMI | head -n 1`
  INT=`xrandr --current | sed 's/^\(.*\) connected.*$/\1/p;d' | grep -v ^DP | head -n 1`
  
  
  xfconf-query -c xsettings -p /Xft/DPI -s 96
  xfconf-query -c xfce4-panel -p /panels/panel-1/size -s 28
  
  xrandr \
  --output VIRTUAL1 --off \
  --output ${INT} --off \
  --output ${EXT2} --mode 1680x1050 --pos 0x150 --rotate normal \
  --output ${EXT1} --mode 1920x1200 --pos 1680x0 --rotate normal --primary