Difference between revisions of "Ubuntu 18 04 modifications"
(→Mirror display) |
(→Activate only one display) |
||
Line 6: | Line 6: | ||
</pre> | </pre> | ||
− | == | + | ==Mirror displays== |
+ | There are four situations to take care of | ||
+ | # No external display connected | ||
+ | # VGA display connected | ||
+ | # HDMI display connected | ||
+ | # VGA and HDMI display connected | ||
+ | |||
+ | If no external display is connected only the internal display eDP-1 is in use. You can see eDP-1 when connecting via VNC. | ||
+ | |||
+ | If the VGA display is connected eDP-1 and DP-3 are in use. To mirror the content of eDP-1 to DP-3 run the VGA.sh script. | ||
+ | |||
+ | If the HDMI display is connected eDP-1 and HDMI-1 are in use. To mirror the content of eDP-1 to HDMI-1 run the HDMI.sh script. | ||
+ | |||
+ | If the VGA and HDMI displays are connected, eDP-1, DP-3 and HDMI-1 are in use. To mirror the content of eDP-1 to DP-3 and HDMI-1 run the VGA-HDMI.sh script. | ||
+ | |||
Script to check which display is connected. If VGA is connected make it the primary display and disable the others. If HDMI-1 is connected make it the primary display and disable the others. If non is connected use the internal display. | Script to check which display is connected. If VGA is connected make it the primary display and disable the others. If HDMI-1 is connected make it the primary display and disable the others. If non is connected use the internal display. | ||
Line 13: | Line 27: | ||
<pre> | <pre> | ||
#!/bin/bash | #!/bin/bash | ||
+ | |||
+ | VGAprev=0 | ||
+ | HDMIprev=0 | ||
for (( ; ; )) | for (( ; ; )) | ||
Line 18: | Line 35: | ||
xrandrout=$(xrandr) | xrandrout=$(xrandr) | ||
+ | |||
+ | VGA=0 | ||
+ | HDMI=0 | ||
if [[ $xrandrout == *"DP-3 connected"* ]] ; then | if [[ $xrandrout == *"DP-3 connected"* ]] ; then | ||
− | + | VGA=1 | |
− | + | fi | |
− | + | ||
− | + | if [[ $xrandrout == *"HDMI-1 connected"* ]] ; then | |
− | + | HDMI=1 | |
− | + | fi | |
− | + | ||
− | + | if (( VGAprev != VGA || HDMIprev != HDMI )) ; then | |
+ | VGAprev=$VGA | ||
+ | HDMIprev=$HDMI | ||
+ | |||
+ | if (( VGA == 1 && HDMI == 1 )) ; then | ||
+ | echo VGA and HDMI | ||
+ | /home/robotino/.screenlayout/VGA-HDMI.sh | ||
+ | elif (( VGA == 1 )) ; then | ||
+ | echo VGA only | ||
+ | /home/robotino/.screenlayout/VGA.sh | ||
+ | elif (( HDMI == 1 )) ; then | ||
+ | echo HDMI only | ||
+ | /home/robotino/.screenlayout/HDMI.sh | ||
+ | fi | ||
fi | fi | ||
sleep 5 | sleep 5 | ||
done | done | ||
+ | </pre> | ||
+ | |||
+ | VGA.sh | ||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --off --output DP-3 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --off | ||
+ | </pre> | ||
+ | |||
+ | HDMI.sh | ||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-3 --off --output DP-2 --off --output DP-1 --off | ||
+ | </pre> | ||
+ | VGA-HDMI.sh | ||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-3 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --off | ||
</pre> | </pre> | ||
Revision as of 12:09, 23 April 2019
Graphics drivers
add-apt-repository ppa:oibaf/graphics-drivers apt-get update apt-get upgrade
Mirror displays
There are four situations to take care of
- No external display connected
- VGA display connected
- HDMI display connected
- VGA and HDMI display connected
If no external display is connected only the internal display eDP-1 is in use. You can see eDP-1 when connecting via VNC.
If the VGA display is connected eDP-1 and DP-3 are in use. To mirror the content of eDP-1 to DP-3 run the VGA.sh script.
If the HDMI display is connected eDP-1 and HDMI-1 are in use. To mirror the content of eDP-1 to HDMI-1 run the HDMI.sh script.
If the VGA and HDMI displays are connected, eDP-1, DP-3 and HDMI-1 are in use. To mirror the content of eDP-1 to DP-3 and HDMI-1 run the VGA-HDMI.sh script.
Script to check which display is connected. If VGA is connected make it the primary display and disable the others. If HDMI-1 is connected make it the primary display and disable the others. If non is connected use the internal display.
Add it to Startup Applications Alt+F2 and run the gnome-session-properties
#!/bin/bash VGAprev=0 HDMIprev=0 for (( ; ; )) do xrandrout=$(xrandr) VGA=0 HDMI=0 if [[ $xrandrout == *"DP-3 connected"* ]] ; then VGA=1 fi if [[ $xrandrout == *"HDMI-1 connected"* ]] ; then HDMI=1 fi if (( VGAprev != VGA || HDMIprev != HDMI )) ; then VGAprev=$VGA HDMIprev=$HDMI if (( VGA == 1 && HDMI == 1 )) ; then echo VGA and HDMI /home/robotino/.screenlayout/VGA-HDMI.sh elif (( VGA == 1 )) ; then echo VGA only /home/robotino/.screenlayout/VGA.sh elif (( HDMI == 1 )) ; then echo HDMI only /home/robotino/.screenlayout/HDMI.sh fi fi sleep 5 done
VGA.sh
#!/bin/sh xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --off --output DP-3 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --off
HDMI.sh
#!/bin/sh xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-3 --off --output DP-2 --off --output DP-1 --off
VGA-HDMI.sh
#!/bin/sh xrandr --output eDP-1 --primary --mode 1600x1200 --pos 0x0 --rotate normal --output HDMI-3 --off --output HDMI-2 --off --output HDMI-1 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-3 --mode 1600x1200 --pos 0x0 --rotate normal --output DP-2 --off --output DP-1 --off
VNC
apt-get install x11vnc
/etc/systemd/system/x11vnc.service
[Unit] Description="x11vnc" [Service] ExecStart=/usr/bin/x11vnc -auth /run/user/1000/gdm/Xauthority -forever -loop -noxdamage -repeat -rfbport 5900 -shared Restart=on-failure [Install] WantedBy=display-manager.service
systemctl enable x11vnc.service
Realsense
sudo apt-key adv --keyserver keys.gnupg.net --recv-key C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C8B3A55A6F3EFCDE sudo add-apt-repository "deb http://realsense-hw-public.s3.amazonaws.com/Debian/apt-repo bionic main" -u sudo apt-get install librealsense2-utils sudo apt-get install librealsense2-dev optinal sudo apt-get install librealsense2-dbg