mirror of
https://git.adityakumar.xyz/betterlockscreen-openrc.git
synced 2025-02-06 01:10:00 +00:00
fix: return default dpi pixel coordinates if no dpi is set
This commit is contained in:
parent
271bb03368
commit
e33fc1dacb
1 changed files with 11 additions and 5 deletions
|
@ -123,13 +123,19 @@ lockselect() {
|
||||||
logical_px() {
|
logical_px() {
|
||||||
# get dpi value from xrdb
|
# get dpi value from xrdb
|
||||||
local DPI=$(xrdb -query | awk '/Xft.dpi/ {print $2}')
|
local DPI=$(xrdb -query | awk '/Xft.dpi/ {print $2}')
|
||||||
local SCALE=$(echo "scale=2; $DPI / 96.0" | bc)
|
|
||||||
|
|
||||||
# check if scaling the value is worthy
|
# return the default value if no DPI is set
|
||||||
if [ $(echo "$SCALE > 1.25" | bc -l) -eq 0 ]; then
|
if [ -z "$DPI"]; then
|
||||||
echo $1
|
echo $1
|
||||||
else
|
else
|
||||||
echo "$SCALE * $1 / 1" | bc
|
local SCALE=$(echo "scale=2; $DPI / 96.0" | bc)
|
||||||
|
|
||||||
|
# check if scaling the value is worthy
|
||||||
|
if [ $(echo "$SCALE > 1.25" | bc -l) -eq 0 ]; then
|
||||||
|
echo $1
|
||||||
|
else
|
||||||
|
echo "$SCALE * $1 / 1" | bc
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue