From owner-freebsd-questions@freebsd.org Sat Jan 20 13:43:12 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CA77ED1D4A for ; Sat, 20 Jan 2018 13:43:12 +0000 (UTC) (envelope-from ralf.mardorf@rocketmail.com) Received: from sonic310-12.consmr.mail.ir2.yahoo.com (sonic310-12.consmr.mail.ir2.yahoo.com [77.238.177.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F0E47A7DD for ; Sat, 20 Jan 2018 13:43:10 +0000 (UTC) (envelope-from ralf.mardorf@rocketmail.com) X-YMail-OSG: V4.IJMAVM1ms8onNrh44opXuLVRlhm2QzUMFczV5zTFRNyPlFxNZ6_ckkOpAbDo 96xQNAZAOHje1v0NK6ceKdKlLHmfFOv0vzJM63xUkz4HxhWRlyDQRnk.EnQOFvN5HepmVCzZvr8n seMXV80x3oHC1hU3RrLRg.h2pxROGBBSXsuBc.YL2Zhu2gMa8VXknDSNL2zx1mQEEcyG81axVzMp JAQOp_l8IshqJMYunitrDSdB_TgIvpNetuk1gZMemq3csIOoQQO8S4wAwlAwLXh1Km9LU2fFs60V TfDqhn8bptr.phnijhHj4Dulnb2JTz1a6V.dCkdjsrXSAgB3lVxFGZr8eWfZ3wt8KmnIuzRnWun4 pTIPooSAiW7_iHogZmOpKseI8Z0U7m9Anl7aWVRXrSq1b2a.7H9O9FbIuQ8abNxwAHlaRe0wAMJd tmG8TejGfRmaZLxW6vGb7bRrx3qpbVKmnUpA3G91Xatpr4v_OD1bd1L1_UvloUUWJlcjWC4XrgQb QJyLD1IYIgjgfcaa2sdcdBRKbIXkWxMiLLVbez2MhBZ_s.y3ioQ-- Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sat, 20 Jan 2018 13:43:03 +0000 Received: from smtp172.mail.ir2.yahoo.com (EHLO archlinux.localdomain) ([46.228.39.39]) by smtp401.mail.ir2.yahoo.com (JAMES SMTP Server ) with ESMTPA ID 16574bd2e1ce9eb53afbc1414610abeb for ; Sat, 20 Jan 2018 13:43:01 +0000 (UTC) Date: Sat, 20 Jan 2018 14:43:01 +0100 From: Ralf Mardorf To: freebsd-questions@freebsd.org Subject: Re: xfce4 reverts to mirrored dislays Message-ID: <20180120144301.170645e6@archlinux.localdomain> In-Reply-To: <20180120141518.7a85ed99@planb.netng.org> References: <20180120125636.6ad88128.freebsd@edvax.de> <20180120134001.65ddb697@archlinux.localdomain> <20180120141518.7a85ed99@planb.netng.org> X-Mailer: Claws Mail 3.16.0git3 (GTK+ 2.24.32; x86_64-arch-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jan 2018 13:43:12 -0000 On Sat, 20 Jan 2018 14:15:18 +0100, Vladimir Botka wrote: >+1. FWIW, example of xrandr: Unfortunately I can't provide such a plain example, however apart from irrelevant content in xorg.conf.d/ and some irrelevant customization scripts, a dirty hacked scripted named xdh-feh calls another dirty hacked script /usr/local/bin/xdh. I doubt in a hurry dirty written scripts do help a lot, however, a script could work around issues that GUIs using xrandr don't. I recommend to use Google (not another search engine, because sometimes Google unfortunately still provides the best hits on top), if the man page doesn't help. [rocketmouse@archlinux ~]$ cat /etc/X11/xorg.conf Section "Monitor" Identifier "HDMI2" DisplaySize 526 296 Option "PreferredMode" "1920x1080" Option "Primary" "true" EndSection Section "Monitor" Identifier "VGA1" DisplaySize 367 278 Modeline "1024x768" 65.00 1024 1048 1184 1344 768 771 777 806 Option "PreferredMode" "1024x768" Option "RightOf" "HDMI2" EndSection Section "Device" Identifier "Card0" Driver "intel" #Driver "vesa" EndSection Section "ServerFlags" Option "BlankTime" "0" Option "StandbyTime" "0" Option "SuspendTime" "0" Option "OffTime" "0" EndSection [rocketmouse@archlinux ~]$ cat /usr/local/bin/xdh #!/bin/dash version=2017-08-10 exit_status=0 xdh_usage() { case $1 in too_many_arguments) printf "\ntoo many arguments\n" exit_status=127 ;; missing_argument) printf "\nmissing argument\n" exit_status=128 ;; unknown_argument) printf "\nunknown argument\n" exit_status=129 ;; unknown_second_argument) printf "\nunknown second argument\n" exit_status=130 ;; esac cat</dev/null xrandr --rmmode "$name" 2>/dev/null ;; esac case $1 in add) xrandr --newmode "$name" $mode -hsync -vsync &&\ xrandr --addmode VGA1 "$name" exstat=$? output=$(expr $exit_status + $exstat) exit_status=$output ;; esac ;; esac done return $exit_status } hdmi2_aspect_ratio () { case $1 in 4:3) scale=1.33333333x1 ;; *) scale=1x1 ;; esac xrandr --output HDMI2 --scale $scale } xdh_xrandr () { case "$1" in off) xrandr --output VGA1 --off --output HDMI2 --mode "$2" ;; *) case $2 in off) xrandr --output VGA1 --mode "$1" --output HDMI2 --off ;; *) xrandr --output VGA1 --mode "$1" --$2 HDMI2 --output HDMI2 --mode "$3" ;; esac ;; esac } case $1 in --help) case $2 in default) xdh_default_presets ;; *) xdh_usage ;; esac exit ;; --xrdb) case $3 in "") case $2 in "") xrdb -query ;; xresorc) printf "xrdb -query\n" xrdb -query "$EDITOR" "$HOME/.Xresources" printf "\nxrdb -merge \"$HOME/.Xresources\"\n" xrdb -merge "$HOME/.Xresources" printf "\nxrdb -query\n" xrdb -query ;; *) xdh_usage unknown_second_argument ;; esac ;; *) xdh_usage too_many_arguments ;; esac exit $exit_status ;; esac arg1=${1:-no_argument} arg2=${2:-default} arg3=${3:-no_argument} case $arg3 in no_argument) case $arg1 in --hdmi) case $arg2 in default) xdh_mode add &&\ xdh_xrandr off "1920x1080" &&\ hdmi2_aspect_ratio 16:9 ;; *) xdh_usage unknown_second_argument ;; esac ;; --dual) case $arg2 in default) xdh_mode add &&\ xdh_xrandr "1152x864_90hz_xdh_default" right-of "1920x1080" &&\ hdmi2_aspect_ratio 16:9 ;; music-1) xdh_mode add &&\ xdh_xrandr "1440x960_86hz_xdh_music-1" right-of "1920x1080" &&\ hdmi2_aspect_ratio 16:9 ;; music-2) xdh_mode add &&\ xdh_xrandr "1368x768_90hz_xdh_music-2" right-of "1920x1080" &&\ hdmi2_aspect_ratio 16:9 ;; no-risk) xdh_mode add &&\ xdh_xrandr "1024x768_60hz_xdh_no-risk" right-of "1920x1080" &&\ hdmi2_aspect_ratio 16:9 ;; *) xdh_usage unknown_second_argument ;; esac ;; --same) case $arg2 in default) xdh_mode add &&\ xdh_xrandr "1024x768_60hz_xdh_no-risk" same-as "1024x768" &&\ hdmi2_aspect_ratio 4:3 ;; noscale) xdh_mode add &&\ xdh_xrandr "1024x768_60hz_xdh_no-risk" same-as "1024x768" &&\ hdmi2_aspect_ratio 16:9 ;; *) xdh_usage unknown_second_argument ;; esac ;; --tube) case $arg2 in default) xdh_mode add &&\ xdh_xrandr "1152x864_90hz_xdh_default" off &&\ hdmi2_aspect_ratio 16:9 ;; music-1) xdh_mode add &&\ xdh_xrandr "1440x960_86hz_xdh_music-1" off &&\ hdmi2_aspect_ratio 16:9 ;; music-2) xdh_mode add &&\ xdh_xrandr "1368x768_90hz_xdh_music-2" off &&\ hdmi2_aspect_ratio 16:9 ;; no-risk) xdh_mode add &&\ xdh_xrandr "1024x768_60hz_xdh_no-risk" off &&\ hdmi2_aspect_ratio 16:9 ;; *) xdh_usage unknown_second_argument ;; esac ;; --list) case $arg2 in default) xrandr ;; verbose) xrandr --verbose ;; screen) echo "xdpyinfo | grep screen -A2" xdpyinfo | grep screen -A2 echo "cat /sys/class/drm/card0-HDMI-A-2/edid | edid-decode | grep \"Detailed mode\" | cut -f2 -d, | sort -u" cat /sys/class/drm/card0-HDMI-A-2/edid | edid-decode | grep "Detailed mode" | cut -f2 -d, | sort -u echo "cat /sys/class/drm/card0-VGA-1/edid | edid-decode | grep \"Detailed mode\" | cut -f2 -d, | sort -u" cat /sys/class/drm/card0-VGA-1/edid | edid-decode | grep "Detailed mode" | cut -f2 -d, | sort -u ;; *) xdh_usage unknown_second_argument ;; esac ;; --asra) case $arg2 in default) hdmi2_aspect_ratio 16:9 ;; 4:3) hdmi2_aspect_ratio 4:3 ;; *) xdh_usage unknown_second_argument ;; esac ;; --mode) case $arg2 in default) xdh_mode add ;; expunge) xdh_mode ;; *) xdh_usage unknown_second_argument ;; esac ;; no_argument) xdh_usage missing_argument ;; *) xdh_usage unknown_argument ;; esac ;; *) xdh_usage too_many_arguments ;; esac exit $exit_status [rocketmouse@archlinux ~]$ cat /usr/local/bin/xdh-feh #!/bin/dash rp=$(echo $1 | cut -d\ -f1) on=$(echo $1 | cut -d\ -f2) f1=$(echo $1 | cut -d\ -f5) f2=$(echo $1 | cut -d\ -f6) f3=$(echo $1 | cut -d\ -f7) f4=$(echo $1 | cut -d\ -f8) f5=$(echo $1 | cut -d\ -f9) f6=$(echo $1 | cut -d\ -f10) f7=$(echo $1 | cut -d\ -f11) f8=$(echo $1 | cut -d\ -f12) f9=$(echo $1 | cut -d\ -f13) xdh_feh_wrapper () { case $f1 in "") ;; *) feh $f1 $f2 $f3 $f4 $f5 $f6 $f7 $f8 $f9 ;; esac } case $on in xdh) x1=$(echo $1 | cut -d\ -f3) x2=$(echo $1 | cut -d\ -f4) xdh "$x1" "$x2" &&\ xdh_feh_wrapper ;; esac case $(xrandr | grep HDMI2 | grep disconnected) in "") # HDMI2 connected case $(xrandr | grep VGA1 | grep disconnected) in "") # VGA1 connected case $(xrandr | grep VGA1 | grep -v disconnected | grep connected | awk '{ print $3 }' | cut -c1) in "(") # VGA1 off case $x1 in --tube) xdh --dual "$x2" &&\ xdh_feh_wrapper ;; esac "$HOME"/.customization/restart-panels-lcd.sh "$rp" 2>/dev/null ;; *) # VGA1 on case $(xrandr | grep HDMI2 | grep -v disconnected | grep connected | awk '{ print $3 }' | cut -c1) in "(") # HDMI2 off case $x1 in --hdmi|--dual) xdh --tube "$x2" &&\ xdh_feh_wrapper ;; esac "$HOME"/.customization/restart-panels-lcd.sh "$rp" 2>/dev/null ;; *) # VGA1 on and HDMI2 on case $x1 in --same) "$HOME"/.customization/restart-panels-lcd.sh "$rp" 2>/dev/null ;; *) # --dual or "" to restart panels only "$HOME"/.customization/restart-panels-lcd.sh "$rp-alt" 2>/dev/null ;; esac ;; esac ;; esac ;; *) # VGA1 disconnected case $x1 in --tube) xdh --dual "$x2" &&\ xdh_feh_wrapper ;; esac "$HOME"/.customization/restart-panels-lcd.sh "$rp" 2>/dev/null ;; esac ;; *) # HDMI2 disconnected case $x1 in --hdmi|--dual) xdh --tube "$x2" &&\ xdh_feh_wrapper ;; "") xdh --tube default &&\ xdh_feh_wrapper ;; esac "$HOME"/.customization/restart-panels-lcd.sh "$rp" 2>/dev/null ;; esac exit