Created
August 7, 2019 17:21
-
-
Save mxdevmanuel/17f52326a7089164f08c08530005d591 to your computer and use it in GitHub Desktop.
i3 hdmi detect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export DISPLAY=:0 | |
export XAUTHORITY=/home/manuel/.Xauthority | |
export XDG_RUNTIME_DIR=/run/user/$(id -u) | |
hdmi_active="$(cat /sys/class/drm/card0/*HDMI*/status | grep '^connected')" | |
echo $hdmi_active | |
if [[ "$hdmi_active" == "connected" ]]; then | |
notify-send -i "/usr/share/icons/Paper/16x16/devices/computer.png" -t 3000 "HDMI: connected" | |
exec /home/manuel/.screenlayout/i3.sh & | |
else | |
notify-send -i "/usr/share/icons/Paper/16x16/devices/computer.png" -t 3000 "HDMI: disconnected" | |
exec /home/manuel/.screenlayout/single.sh & | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
xrandr --output HDMI1 --mode 1920x1080 --pos 0x0 --rotate normal --output LVDS1 --primary --mode 1366x768 --pos 1920x312 --rotate normal --output VIRTUAL1 --off --output DP1 --off --output VGA1 --off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
xrandr --output HDMI1 --off --output LVDS1 --primary --mode 1366x768 --pos 0x0 --rotate normal --output VIRTUAL1 --off --output DP1 --off --output VGA1 --off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment