aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/lid-switch-action16
1 files changed, 10 insertions, 6 deletions
diff --git a/bin/lid-switch-action b/bin/lid-switch-action
index e8376aa..94c05c3 100755
--- a/bin/lid-switch-action
+++ b/bin/lid-switch-action
@@ -26,15 +26,19 @@ IFS=$'\r\n' connectedOutputs=($(xrandr | grep " connected" | sed -e "s/\([A-Z0-9
# TODO: Add checks for other ports
#Check for HDMI1 connection
-HDMI=$(containsElement "HDMI1" "${connectedOutputs}")
+HDMI1=$(containsElement "HDMI1" "${connectedOutputs}")
+HDMI2=$(containsElement "HDMI2" "${connectedOutputs}")
+VGA1=$(containsElement "VGA1" "${connectedOutputs}")
+DP1=$(containsElement "DP1" "${connectedOutputs}")
+DP2=$(containsElement "DP2" "${connectedOutputs}")
# Suspend or switch screen setup, depending on how many screens are connected
# If the lid was closed
if [ $1 = 0 ];then
- # Check if more than one screen or HDMI1 is connected
- if [[ ${#connectedOutputs[@]} -gt 1 || $HDMI ]];then
- echo "More than one screen connected, or HDMI1 connected"
- echo "Not suspending, disabling eDP1, making HDMI1 primary screen."
+ # Check if more than one screen is connected
+ if [[ ${#connectedOutputs[@]} -gt 1 || $HDMI1 || $HDMI2 || $VGA1 || $DP1 || $DP2 ]];then
+ echo "More than one screen connected."
+ echo "Not suspending, disabling eDP1, making other screen primary."
autorandr -l external-docked
else
echo "Only one screen connected"
@@ -44,7 +48,7 @@ if [ $1 = 0 ];then
# If the lid was opened
elif [ $1 = 1 ];then
# Check if more than one screen or HDMI1 is connected
- if [[ ${#connectedOutputs[@]} -gt 1 || $HDMI ]];then
+ if [[ ${#connectedOutputs[@]} -gt 1 || $HDMI || $HDMI2 || $VGA1 || $DP1 || $DP2 ]];then
echo "More than one screen connected, or HDMI1 connected"
echo "Setting up all connected screens."
autorandr -l multi-docked