yannickperrenet / dotfiles

💛 My dotfiles.
https://github.com/yannickperrenet/iscripts
MIT License
3 stars 0 forks source link

Persist display mirroring between laptop and external screen #4

Closed yannickperrenet closed 3 years ago

yannickperrenet commented 3 years ago

It should be able to handle it dynamically, since the screen might change in different setups.

xrandr --output DP-3 --same-as eDP-1
yannickperrenet commented 3 years ago

https://github.com/Ventto/mons seems to do exactly what I want

yannickperrenet commented 3 years ago

A shell script that uses the earlier specified command

xrandr --output DP-3 --same-as eDP-1

but determines the values for the displays through code instead of the values being hardcoded.

#!/bin/sh

xrandr_out="$(xrandr | grep '\sconnected' | cut -d' ' -f1)"
primary="$(echo "$xrandr_out" | head -1)"
secondary="$(echo "$xrandr_out" | tail -1)"

xrandr --output "$secondary" --same-as "$primary"
yannickperrenet commented 3 years ago

The custom script is used in https://github.com/yannickperrenet/dotfiles/commit/b78261903caf0cc8fdba3d0ce2c26450694b14ae and points to https://github.com/yannickperrenet/bin/commit/70ec19e479b0b8e08ba4ac43112f372647a0b317.

Also added to the installation script repo in: https://github.com/yannickperrenet/iscripts/commit/3176d6d27faeb3a88a03fc67e54e988c15f2fe4b