Commit ea6ac055 authored by Dr. Michael Petter's avatar Dr. Michael Petter
Browse files

16:9 on non 16:9 screens

parent e58674f3
......@@ -39,6 +39,17 @@ DEBUG echo desired resolution "$res"
DEBUG echo ---------------{==============[ Detecting connected Screens ]=============}--------------------
#find out primary display
allprimaryresolutions=$(xrandr | awk '/primary/{flag=1;next}/connect/{flag=0}flag' | cut -f 4 -d " ")
for foundres in $allprimaryresolutions; do
x=$(echo $foundres| cut -f 1 -d "x")
y=$(echo $foundres| cut -f 2 -d "x")
ratio=$(((9*$x)/(16*$y)))
if [ $ratio == "1" ]; then
DEBUG echo maximally available 16:9 resolution is $foundres
primres16to9=$foundres
break
fi
done
primaryid=$(xrandr|grep primary)
prim=${primaryid% connected*}
#find out resolutions
......@@ -48,6 +59,7 @@ primres=${primres#*primary }
DEBUG echo Main Laptop display is $prim
DEBUG echo Main Laptop resolution is $primres
DEBUG echo Main Laptop 16:9 resolution is $primres16to9
# determine connected displays
alldisplays=$(xrandr | grep " connected" | cut -f 1 -d " ")
......@@ -65,8 +77,14 @@ DEBUG echo ---------------{==============[ Configure Screen Placement and Resolu
#don't know if this is really needed:
DEBUG echo xrandr --output "$prim" --auto
xrandr --output "$prim" --auto
DEBUG echo xrandr --output "$prim" --mode "$primres16to9"
if [[ -z $1 ]]
xrandr --output "$prim" --auto
screenres=${primres%+0+0*}
else
xrandr --output "$prim" --mode "$primres16to9"
screenres="$primres16to9"
fi
DEBUG echo "in case the screen becomes black, consider automatically switching to virtual console 2 and back"
# in case, sudo asks for a passwd, do
# -> sudo visudo username ALL=NOPASSWD: /bin/chvt
......@@ -77,7 +95,7 @@ DEBUG echo "in case the screen becomes black, consider automatically switching t
#clone main to all other
for disp in $otherdisplays; do
DEBUG echo xrandr --output $disp "$res" --scale-from "${primres%+0+0*}" --same-as "$prim"
xrandr --output $disp "$res" --scale-from "${primres%+0+0*}" --same-as "$prim"
DEBUG echo xrandr --output $disp "$res" --scale-from "$screenres" --same-as "$prim"
xrandr --output $disp "$res" --scale-from "$screenres" --same-as "$prim"
DEBUG echo TODO: Insert aspect ratio independent code from pendisplay here too
done
\ No newline at end of file
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment