From b8ba4f882142f3eb92c3131253d05f1c293486ac Mon Sep 17 00:00:00 2001 From: Harald Hope Date: Mon, 6 Nov 2023 22:47:56 -0800 Subject: [PATCH] monitor id fix --- pinxi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pinxi b/pinxi index a89d5a8..337b426 100755 --- a/pinxi +++ b/pinxi @@ -17533,7 +17533,10 @@ sub xrandr_data { # print "x:$size_x y:$size_y rx:$res_x ry:$res_y dpi:$dpi\n"; ($res_x,$res_y,$size_x,$size_x_i,$size_y,$size_y_i,$set_as) = (0,0,0,0,0,0,0,0,undef); } - else { + elsif (/^([^\s]+)\s+disconnected\s/){ + undef $monitor_id; + } + elsif ($monitor_id && %monitors) { my @working = split(/\s+/,$_); # this is the monitor current dimensions # 5120x1440 59.98* 29.98 @@ -17543,16 +17546,14 @@ sub xrandr_data { # print "$working[1] :: $working[2]\n"; $working[2] =~ s/\*|\+//g; $working[2] = sprintf("%.0f",$working[2]); - if ($monitor_id && %monitors){ - $monitors{$monitor_id}->{'hz'} = $working[2]; - } + $monitors{$monitor_id}->{'hz'} = $working[2]; ($diagonal,$dpi) = ('',''); # print Data::Dumper::Dumper \@monitors; } # \tCONNECTOR_ID: 52 elsif ($working[1] eq 'CONNECTOR_ID:'){ # print "$working[1] :: $working[2]\n"; - if ($monitor_id && %monitors){ + if (!$monitors{$monitor_id}->{'connector-id'}){ push(@{$ids[$#ids]},$working[2]); $monitors{$monitor_id}->{'connector-id'} = $working[2]; }