Ignore disabled monitors for -m

Don't check monitors without dimensions in xrandr's output.
Addresses #26.
break
noctuid 8 years ago
parent 45e9d72711
commit e9e222f6fa

22
tdrop

@ -244,16 +244,18 @@ update_geometry_settings_for_monitor() {
monitors_info=$(xrandr --query | awk '/ connected/ {gsub("primary ",""); print}') monitors_info=$(xrandr --query | awk '/ connected/ {gsub("primary ",""); print}')
while read -r monitor; do while read -r monitor; do
monitor_geo=$(echo "$monitor" | awk '{print $3}') monitor_geo=$(echo "$monitor" | awk '{print $3}')
x_begin=$(echo "$monitor_geo" | awk -F '+' '{print $2}') if [[ $monitor_geo =~ ^[0-9]+x[0-9]+\+[0-9]+\+[0-9]+$ ]]; then
y_begin=$(echo "$monitor_geo" | awk -F '+' '{print $3}') x_begin=$(echo "$monitor_geo" | awk -F '+' '{print $2}')
x_width=$(echo "$monitor_geo" | awk -F 'x' '{print $1}') y_begin=$(echo "$monitor_geo" | awk -F '+' '{print $3}')
y_height=$(echo "$monitor_geo" | awk -F 'x|+' '{print $2}') x_width=$(echo "$monitor_geo" | awk -F 'x' '{print $1}')
x_end=$((x_begin+x_width)) y_height=$(echo "$monitor_geo" | awk -F 'x|+' '{print $2}')
y_end=$((y_begin+y_height)) x_end=$((x_begin+x_width))
if [[ $window_x -ge $x_begin ]] && [[ $window_x -lt $x_end ]] && \ y_end=$((y_begin+y_height))
[[ $window_y -ge $y_begin ]] && [[ $window_y -lt $y_end ]]; then if [[ $window_x -ge $x_begin ]] && [[ $window_x -lt $x_end ]] && \
current_monitor=$(echo "$monitor" | awk '{print $1}') [[ $window_y -ge $y_begin ]] && [[ $window_y -lt $y_end ]]; then
break current_monitor=$(echo "$monitor" | awk '{print $1}')
break
fi
fi fi
done <<< "$monitors_info" done <<< "$monitors_info"
fi fi

Loading…
Cancel
Save