aboutsummaryrefslogtreecommitdiff
path: root/betterlockscreen
diff options
context:
space:
mode:
authorYohann Leon <yohann@leon.re>2018-12-12 00:29:17 +0100
committerYohann Leon <yohann@leon.re>2018-12-12 00:29:17 +0100
commite33fc1dacb7b3ed4e84fb007b72ad486f462cc87 (patch)
tree23e6b5f092f4e942fb7fe8684749153edcff698d /betterlockscreen
parent271bb033685aeb7cfc5e1e0e4cb850ae5fcba3f7 (diff)
fix: return default dpi pixel coordinates if no dpi is set
Diffstat (limited to 'betterlockscreen')
-rwxr-xr-xbetterlockscreen16
1 files changed, 11 insertions, 5 deletions
diff --git a/betterlockscreen b/betterlockscreen
index 0cef78d..2ef6208 100755
--- a/betterlockscreen
+++ b/betterlockscreen
@@ -123,13 +123,19 @@ lockselect() {
logical_px() {
# get dpi value from xrdb
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
- if [ $(echo "$SCALE > 1.25" | bc -l) -eq 0 ]; then
+
+ # return the default value if no DPI is set
+ if [ -z "$DPI"]; then
echo $1
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
}