aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/lid-switch-action17
1 files changed, 7 insertions, 10 deletions
diff --git a/bin/lid-switch-action b/bin/lid-switch-action
index f543d86..e4b45a7 100755
--- a/bin/lid-switch-action
+++ b/bin/lid-switch-action
@@ -49,7 +49,6 @@ done < <(xrandr)
# Loop all connected displays
for i in ${connected[@]}
do
- echo "Display connected: $i" >> $log_file
case $i in
"HDMI1")
HDMI1=1
@@ -72,8 +71,7 @@ done
# Now checking which autorandr profile to use
case "$call" in
"0")
- echo "Called to close">> $log_file
- if [[ $connections -gt 1 ]];then
+ if [[ $connections -gt 1 ]];then # check if more than one connection
if [[ $HDMI1 -gt 0 ]];then
echo "HDMI1 connected." >> $log_file
/usr/bin/autorandr -l external-plugged & >> $log_file
@@ -81,10 +79,10 @@ case "$call" in
echo "DP2 connected." >> $log_file
/usr/bin/autorandr -l external-docked & >> $log_file
fi
- else
- echo "Only one screen connected" >> $log_file
+ else # else suspend
+ echo "Only one screen connected." >> $log_file
if [[ -f "/home/dave/.config/awesome/i3lock" ]];then
- echo "Using i3lock" >> $log_file
+ echo "Using i3lock to lock screen." >> $log_file
su dave -c "/home/dave/.config/awesome/i3lock"
fi
echo "Suspending." >> $log_file
@@ -92,13 +90,12 @@ case "$call" in
fi
;;
"1")
- echo "Called to open">> $log_file
- if [[ $connections -gt 1 ]];then
+ if [[ $connections -gt 1 ]];then # check if more than one connection
if [[ $HDMI1 -gt 0 ]];then
- echo "HDMI1 connected" >> $log_file
+ echo "HDMI1 connected." >> $log_file
/usr/bin/autorandr -l multi-plugged & >> $log_file
elif [[ $DP2 -gt 0 ]];then
- echo "DP2 connected" >> $log_file
+ echo "DP2 connected." >> $log_file
/usr/bin/autorandr -l multi-docked & >> $log_file
fi
fi