Bugzilla – Attachment 737389 Details for
Bug 1054645
xrandr: scaling breaks multi screen placement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
script that shows correct xrandr command for scaling and placing of multi monitor setup
mngdisp (text/x-matlab), 3.60 KB, created by
rens groenewegen
on 2017-08-20 23:09:26 UTC
(
hide
)
Description:
script that shows correct xrandr command for scaling and placing of multi monitor setup
Filename:
MIME Type:
Creator:
rens groenewegen
Created:
2017-08-20 23:09:26 UTC
Size:
3.60 KB
patch
obsolete
>function showmons >{ >xrandr --current|grep -w connected |sed 's/[x,+]/ /g' >} > >function getMaX >{ >xrandr --current|grep -w connected |sed 's/[x,+]/ /g'|awk 'BEGIN{x=0}{ >t=$3 >if ( x < t ) { x=t } > >} END{print x}' >} > >function getMaY >{ >xrandr --current|grep -w connected |sed 's/[x,+]/ /g'|awk 'BEGIN{y=0}{ >t=$4 >if ( y < t ) { y=t } > >} END{print y}' >} > >function totX >{ >xrandr --current|grep -w connected |sed 's/[x,+]/ /g'|awk 'BEGIN{x=0}{ >x=x+$3 >} END{print x}' >} > >function totY >{ >xrandr --current|grep -w connected |sed 's/[x,+]/ /g'|awk 'BEGIN{y=0}{ >y=y+$4 >} END{print y}' >} > >screen0() >{ >xrandr --listactivemonitors |grep 0:|awk '{print $1,$NF}' >} > >screen1() >{ >xrandr --listactivemonitors |grep 1:|awk '{print $1,$NF}' >} > >function showit >{ > >cat <<EOF > >usage: >screens next to each other, top-side aligned : > $0 <screen 0> right-of <screen 1> > OR > $0 <screen 1> right-of <screen 0> > >screens on top of each other, left side aligned. > $0 <screen 0> below <screen 1> > OR > $0 <screen 1> below <screen 0> >EOF > > >} > > >function connected >{ >xrandr --current|grep -w connected | sed 's/[x,+]/ /g' >} > >function setfb >{ >case $placem in >left-of) >echo $sc0 $placem $sc1, 1 sec..... >totwidth=`totX` >tothigh=`getMaY` >;; >top-of) >echo $sc0 $placem $sc1, 1 sec..... >totwidth=`getMaX` >tothigh=`totY` >;; >esac >echo xrandr -d :0 --fb ${totwidth}x${tothigh} >xrandr -d :0 --fb ${totwidth}x${tothigh} >} >export widsc0=0 >export highsc0=0 >export scal0=1 >export scal1=1 >export fbx=0 >export fby=0 > >function setscalwxh >{ >widsc0=`xrandr --current|grep -A 5 -e $sc0 |grep -e \* |sed 's/x/ /g'|awk -v fact=$scal0 '{print $1 * fact }'` >highsc0=`xrandr --current|grep -A 5 -e $sc0|grep -e \* |sed 's/x/ /g'|awk -v fact=$scal0 '{print $2 * fact }'` >widsc1=`xrandr --current|grep -A 5 -e $sc1 |grep -e \* |sed 's/x/ /g'|awk -v fact=$scal1 '{print $1 * fact }'` >highsc1=`xrandr --current|grep -A 5 -e $sc1|grep -e \* |sed 's/x/ /g'|awk -v fact=$scal1 '{print $2 * fact }'` > >case $placem in >left-of) ># screen next to each other, sum of x width and y = highest y value. >fbx=$(( $widsc0 + $widsc1 )) >fby=$highsc0 >[ $fby -lt $highsc1 ] && fby=$highsc1 >;; >top-of) ># screen above each other, sum of y height and widest x = highest x value. >fby=$(( $highsc0 + $highsc1 )) >fbx=$widsc0 >[ $fbx -lt $widsc1 ] && fbx=$widsc1 >;; >esac > > > >cat <<EOF >=================== >scal0 $scal0 >widsc0 $widsc0 >highsc0 $highsc0 >scal1 $scal1 >widsc1 $widsc1 >highsc1 $highsc1 >fbx $fbx >fby $fby >=================== >EOF >} > >function doit >{ > >cat <<EOF >this is hard >0 - check if monitors exist. >1 - scale the monitors. assume 1.0 if not given. >2 - plase second monitor according to right-of or below or same-as > >note: first monitor mentioned is always at 0x0 > >EOF > > >sc0ok=`xrandr --listactivemonitors| grep -c -w $sc0 ` >sc1ok=`xrandr --listactivemonitors| grep -c -w $sc1 ` >echo sc0ok $sc0ok >echo sc1ok $sc1ok > >if [ $(($sc0ok - $sc1ok )) -eq 0 ] >then >echo monitors seem to exist and to be active >else >echo monitors do not exist or are NOT active >xrandr --listactivemonitors >exit 4 >fi > >echo display status : >connected > > > > echo $sc0 is always at position x,y = 0,0 > echo $sc1 is either at position x,y = left-of-width, 0 OR 0,top-of-height > >setscalwxh >case $placem in >left-of) >newx=$widsc0 >newy=0 >;; >above|top-of) >newx=0 >newy=$highsc0 >;; >esac > >echo display command to exec >echo xrandr --fb ${fbx}x${fby} --output $sc0 --pos 0x0 --scale ${scal0}x$scal0 --output $sc1 --scale ${scal1}x$scal1 --pos ${newx}x${newy} > >} > >case $# in >0) >showit >doit >;; >3|4|5) ># either we just place monitors, or also apply scaling on 1 or even 2 (4 en 5 params) >;; >esac > >sc0=$1 >placem=$2 >sc1=$3 >scal0="1.0" >scal1="1.0" >[ $# -gt 3 ] && scal0=$4 >[ $# -gt 4 ] && scal1=$5 > >doit >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 1054645
:
737389
|
767473
|
767907