2019. augusztus 3.

Display settings lost on reboot

As described here, this problem is affecting others as well:
Here are the steps I tool to assemble the little script below:

How many displays do you have right now?
xrandr | grep -w connected | wc -l
How to position your displays?
How to rotate a display?
xrandr --output SCREEN-ID --rotate [normal|left|right|inverted]
How to get your display IDs?
primary display:
xrandr | grep -w connected | grep primary | cut -d' ' -f1
secondary display:
xrandr | grep -w connected | grep -v primary | cut -d' ' -f1
How to position your gnome-panels?
Apparently there is no easy way, but for the note, here's where to find these setting:
org.gnome.gnome-panel.layout.toplevels.bottom-panel monitor 0
org.gnome.gnome-panel.layout.toplevels.top-panel monitor 1

Here's the script I put into my .bashrc (.profile would be also a good place for it) to restore the positions of my displays (I have the laptop below the monitor).

# set dual display positions
# because they are forgotten after logout
function reset_displays {
 display_count=`xrandr | grep -w connected | wc -l`
 if [ "$display_count" -eq "2" ]; then
  id1=`xrandr | grep -w connected | grep primary | cut -d' ' -f1`
  id2=`xrandr | grep -w connected | grep -v primary | cut -d' ' -f1`
  xrandr --output $id2 --rotate normal
  xrandr --output $id1 --below $id2

Nincsenek megjegyzések: