dotfiles

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

commit 1403e630fba4d25e29b8e350d2357ff1ece15165
parent 77aa93f26cbade8c224b5d043589f84a508ce1a5
Author: Chris Noxz <chris@noxz.tech>
Date:   Fri,  1 May 2020 19:13:31 +0200

[bin] setup monitor script for x220

Diffstat:
Mbin/.local/bin/monitor | 29+++++++++++------------------
1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/bin/.local/bin/monitor b/bin/.local/bin/monitor @@ -1,10 +1,10 @@ #!/bin/sh -hdmi_status="/tmp/.hdmi_status" +dp_status="/tmp/.dp_status" 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" +dp="$drm_dir/$int_card-DP-2/status" gpu_count="$(ls "$drm_dir" | grep -o card. | sort -u | wc -l)" print_help() { @@ -22,7 +22,7 @@ install_udev_rule() { rule="${rule}ACTION==\"change\", " rule="${rule}SUBSYSTEM==\"drm\", " rule="${rule}ENV{HOTPLUG}==\"1\", " - rule="${rule}RUN+=\"/bin/sh -c 'cat ${hdmi} > ${hdmi_status}'\"" + rule="${rule}RUN+=\"/bin/sh -c 'cat ${dp} > ${dp_status}'\"" mkdir -p /etc/udev/rules.d printf "$rule" > /etc/udev/rules.d/95-hotplug-drm.rules else @@ -35,19 +35,12 @@ enable_egpu() { } enable_lvds() { - xrandr --output LVDS1 --mode 1280x800 --rate 60 - xrandr --output HDMI2 --off + xrandr --output LVDS1 --mode 1366x768 --rate 60 + xrandr --output DP2 --off } -enable_hdmi() { - # create new resolution for 21:9 (under 160 mhz bandwidth) - xrandr --delmode HDMI2 2560x1080_43 - xrandr --rmmode 2560x1080_43 - xrandr --newmode "2560x1080_43" \ - 159.94 2560 2688 2960 3360 1080 1081 1084 1107 -HSync +Vsync - xrandr --addmode HDMI2 2560x1080_43 - - xrandr --output HDMI2 --mode 2560x1080_43 --rate 43.0 +enable_dp() { + xrandr --output DP2 --mode 2560x1080 --rate 60 xrandr --output LVDS1 --off } @@ -58,16 +51,16 @@ force-lvds) fi ;; setup) - if grep -q ^connected$ $hdmi; then - enable_hdmi + if grep -q ^connected$ $dp; then + enable_dp enable_egpu else enable_lvds fi ;; daemon) - [ ! -f ${hdmi_status} ] && touch ${hdmi_status} - echo "${hdmi_status}" | entr -n -p "${0}" setup + [ ! -f ${dp_status} ] && touch ${dp_status} + echo "${dp_status}" | entr -n -p "${0}" setup ;; install-udev-rule) install_udev_rule