dotfiles

My collection of dotfiles
git clone git://git.noxz.tech/dotfiles
Log | Files | Refs

commit b440650810a1f3b132c02f0de36386bb89dcb71a
parent cc66772a3a694526764082ebd4f3fb891232072e
Author: Chris Noxz <chris@noxz.tech>
Date:   Sat, 16 Nov 2019 17:23:23 +0100

[bin] Experimenting with eGPU

Diffstat:
Mbin/.bin/monitor | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/bin/.bin/monitor b/bin/.bin/monitor @@ -1,8 +1,11 @@ #!/bin/sh hdmi_status="/tmp/.hdmi_status" -hdmi="/sys/class/drm/card0-HDMI-A-2/status" -lvds="/sys/class/drm/card0-LVDS-1/enabled" +drm_dir="/sys/class/drm" +int_card="$(ls "$drm_dir" | grep .*LVDS.* | grep -o 'card.')" +lvds="$drm_dir/$int_card-LVDS-1/enabled" +hdmi="$drm_dir/$int_card-HDMI-*/status" +gpu_count="$(ls "$drm_dir" | grep -o card. | sort -u | wc -l)" print_help() { echo "Usage: ${0##*/} ACTION\n" @@ -27,6 +30,10 @@ install_udev_rule() { fi } +enable_egpu() { + [ "$gpu_count" = "2" ] && xrandr --setprovideroutputsource 1 0 +} + enable_lvds() { xrandr --output LVDS1 --mode 1280x800 --rate 60 xrandr --output HDMI2 --off @@ -51,8 +58,9 @@ force-lvds) fi ;; setup) - if [ "$(cat ${hdmi})" = "connected" ]; then + if grep -q ^connected$ $hdmi; then enable_hdmi + enable_egpu else enable_lvds fi