Hi all,
On Thu, Sep 30, 2021 at 11:52 (+0200), Slávek Banko wrote:
On Thursday 30 of September 2021 10:28:55 Felix Miata
wrote:
> Slávek Banko composed on 2021-09-30 10:07 (UTC+0200):
>> Question: It could be useful to add another usual resolutions of HIDPI
>> monitors to the list of resolutions in TDE Control Center?
> Providing only 96, 120 and none is arbitrarily
limiting. If it was up to
> me, there would be a checkbox to enable forcing, and an input box
> instead of a select list, which would reject irrational entries, such as
> those <36 or >360, and be prefilled with either 96, or if greater than
> 96, a value calculated from any image size reported in Xorg.0.log.
Ok, I see, the possibility of entering your own value
is beneficial. It
seems that it could be ideal to use combobox, which will provide a list,
but also allows to adjust the value. One of the values in the list could
be calculated from the real dimensions of the monitor.
Keep in mind that not all monitors correctly report their dimensions,
and even for those that do, sometimes you have to bend backwards to
get the info. For example, while get-edid works fine (for me) on some
monitors, no others it returns incorrect information, and on yet
others it returns no info at all (in my case, this happens on some
external monitors; YMMV). In the end, I use the following function
and command-line below (the function was glommed from some place on
the internet and modified somewhat, I regret I've lost the original
author, so I can't give proper credit.
my_get_edid_as_ascii_hex ()
{
while read -r output hex conn
do
echo "$hex"
done < <(xrandr --prop | awk '
!/^[ \t]/ {
if (output && hex) print output, hex, conn
output=$1
hex=""
}
/ConnectorType:/ {conn=$2}
/[:.]/ && h {
h=0
}
h {sub(/[ \t]+/, ""); hex = hex $0}
/EDID.*:/ {h=1}
END {if (output && hex) print output, hex, conn}
'
)
}
The following command line spits out all the information, you could
add ' | grep DisplaySize ' to output just the line which has the size.
my_get_edid_as_ascii_hex | xxd -p -r | parse-edid
Having said that, some monitors report the wrong size with that
function, and for my own purposes I use the following function
get_screen_name ()
{
while read -r output hex conn
do
# original:
# [[ -z "$conn" ]] && conn=${output%%-*}
# echo "# $output $conn $(xxd -r -p <<< "$hex")"
printf "%s %s\n" $output $(xxd -r -p <<< "$hex")
done < <(xrandr --prop | awk '
!/^[ \t]/ {
if (output && hex) print output, hex, conn
output=$1
hex=""
}
/ConnectorType:/ {conn=$2}
/[:.]/ && h {
sub(/.*000000fc00/, "", hex)
hex = substr(hex, 0echo a, 26) "0a"
sub(/0a.*/, "", hex)
h=0
}
h {sub(/[ \t]+/, ""); hex = hex $0}
/EDID.*:/ {h=1}
END {if (output && hex) print output, hex, conn}
' | grep $1
)
}
which was modified from the one found at
https://stackoverflow.com/questions/10500521/linux-retrieve-monitor-names
Finally, I have a function which uses the screen name returned by
get_screen_name() to see if it is a monitor I know (which otherwise
reports the wrong size) and pick the correct size, and otherwise the
function crosses its fingers and uses the reported size and number of
pixels to calculate the DPI. This works fine for me because I can
update the function with monitors that I use which give the wrong
info, but it is not a very general solution for the world at large.
This whole thing is a vessel of fertilizer and it stinks. You'd think
it would be easier in 2021.
Cheers.
Jim