mirror of
https://git.adityakumar.xyz/betterlockscreen-openrc.git
synced 2024-11-09 10:39:45 +00:00
Merge pull request #86 from obynio/master
Add support for HiDPI screens
This commit is contained in:
commit
e26ff2d2f9
1 changed files with 21 additions and 3 deletions
|
@ -120,6 +120,24 @@ lockselect() {
|
||||||
postlock
|
postlock
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logical_px() {
|
||||||
|
# get dpi value from xrdb
|
||||||
|
local DPI=$(xrdb -query | awk '/Xft.dpi/ {print $2}')
|
||||||
|
|
||||||
|
# return the default value if no DPI is set
|
||||||
|
if [ -z "$DPI" ]; then
|
||||||
|
echo $1
|
||||||
|
else
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
update() {
|
update() {
|
||||||
# use
|
# use
|
||||||
|
@ -132,9 +150,9 @@ update() {
|
||||||
SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*')
|
SR=$(xrandr --query | grep ' connected' | grep -o '[0-9][0-9]*x[0-9][0-9]*[^ ]*')
|
||||||
for RES in $SR; do
|
for RES in $SR; do
|
||||||
SRA=(${RES//[x+]/ })
|
SRA=(${RES//[x+]/ })
|
||||||
CX=$((${SRA[2]} + 25))
|
CX=$((${SRA[2]} + $(logical_px 25)))
|
||||||
CY=$((${SRA[1]} - 30))
|
CY=$((${SRA[1]} - $(logical_px 30)))
|
||||||
rectangles+="rectangle $CX,$CY $((CX+300)),$((CY-80)) "
|
rectangles+="rectangle $CX,$CY $((CX+$(logical_px 300))),$((CY-$(logical_px 80))) "
|
||||||
done
|
done
|
||||||
|
|
||||||
# User supplied Image
|
# User supplied Image
|
||||||
|
|
Loading…
Reference in a new issue