dotfiles/config/i3/hotplug.fish
2018-11-26 10:38:46 +01:00

50 lines
1.3 KiB
Fish
Executable file

#!/usr/bin/fish
## DOES NOT WORK YET :(
sleep 2
set dp1 (cat /sys/class/drm/card0-DP-1/status)
set dp2 (cat /sys/class/drm/card0-DP-2/status)
set hdmi1 (cat /sys/class/drm/card0-HDMI-A-1/status)
set hdmi2 (cat /sys/class/drm/card0-HDMI-A-2/status)
set rightof "eDP1"
if [ $dp1 = "connected" ]
xrandr --output DP1 --right-of $rightof --auto
set rightof "DP1"
notify-send --urgency=low -t 2000 "Graphics Update" "USB-C display plugged in"
else
xrandr --output DP1 --off
end
if [ $dp2 = "connected" ]
xrandr --output DP2 --right-of $rightof --auto
set rightof "DP2"
notify-send --urgency=low -t 2000 "Graphics Update" "USB-C display plugged in"
else
xrandr --output DP2 --off
end
if [ $hdmi1 = "connected" ]
xrandr --output HDMI1 --right-of $rightof --auto
set rightof "HDMI1"
notify-send --urgency=low -t 2000 "Graphics Update" "USB-C display plugged in"
else
xrandr --output HDMI1 --off
end
if [ $hdmi2 = "connected" ]
notify-send --urgency=low -t 2000 "Graphics Update" "HDMI display plugged in"
xrandr --output HDMI2 --right-of $rightof --auto
set rightof "HDMI2"
set identifier (parse-edid < /sys/class/drm/card0-HDMI-A-2/edid | grep Identifier | cut -d' ' -f 2-)
if [ $identifier = '"LG ULTRAWIDE"' ]
xrandr --output HDMI2 --scale 2x2
end
else
xrandr --output HDMI2 --off
end