Dotfiles and stuff
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 

11 lines
565 B

#!/bin/sh
conectados=$(xrandr | awk '( $2 == "connected" ) { count++ } END { print count }')
pri=$(xrandr | awk '( $2 == "connected" ) {print $1}' | sed -sn 1p)
sec=$(xrandr | awk '( $2 == "connected" ) {print $1}' | sed -sn 2p)
if [ "$conectados" = 1 ]; then
xrandr --output "$pri" --primary --auto --scale 1.0x1.0 "$(xrandr | awk '( $2 "disconnected" ) {print "--output", $1, "--off"}' | paste -sd ' ')"
elif [ "$conectados" = 2 ]; then
xrandr --output "$pri" --primary --auto --scale 1.0x1.0 --output "$sec" --right-of "$pri" --auto --scale 1.0x1.0
fi