monitor id fix

This commit is contained in:
Harald Hope 2023-11-06 22:47:56 -08:00
parent 1765e88f2e
commit b8ba4f8821

9
pinxi
View file

@ -17533,7 +17533,10 @@ sub xrandr_data {
# print "x:$size_x y:$size_y rx:$res_x ry:$res_y dpi:$dpi\n"; # 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); ($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+/,$_); my @working = split(/\s+/,$_);
# this is the monitor current dimensions # this is the monitor current dimensions
# 5120x1440 59.98* 29.98 # 5120x1440 59.98* 29.98
@ -17543,16 +17546,14 @@ sub xrandr_data {
# print "$working[1] :: $working[2]\n"; # print "$working[1] :: $working[2]\n";
$working[2] =~ s/\*|\+//g; $working[2] =~ s/\*|\+//g;
$working[2] = sprintf("%.0f",$working[2]); $working[2] = sprintf("%.0f",$working[2]);
if ($monitor_id && %monitors){
$monitors{$monitor_id}->{'hz'} = $working[2]; $monitors{$monitor_id}->{'hz'} = $working[2];
}
($diagonal,$dpi) = ('',''); ($diagonal,$dpi) = ('','');
# print Data::Dumper::Dumper \@monitors; # print Data::Dumper::Dumper \@monitors;
} }
# \tCONNECTOR_ID: 52 # \tCONNECTOR_ID: 52
elsif ($working[1] eq 'CONNECTOR_ID:'){ elsif ($working[1] eq 'CONNECTOR_ID:'){
# print "$working[1] :: $working[2]\n"; # print "$working[1] :: $working[2]\n";
if ($monitor_id && %monitors){ if (!$monitors{$monitor_id}->{'connector-id'}){
push(@{$ids[$#ids]},$working[2]); push(@{$ids[$#ids]},$working[2]);
$monitors{$monitor_id}->{'connector-id'} = $working[2]; $monitors{$monitor_id}->{'connector-id'} = $working[2];
} }