From 0dd6b4aa3488e7849ec57228db371c046ab60295 Mon Sep 17 00:00:00 2001 From: natemaia Date: Sat, 26 Nov 2022 11:33:45 -0800 Subject: [PATCH] Adjust dk border widths based on monitor DPI --- dk-home/.config/dk/dkrc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/dk-home/.config/dk/dkrc b/dk-home/.config/dk/dkrc index aecda290..8873f97b 100755 --- a/dk-home/.config/dk/dkrc +++ b/dk-home/.config/dk/dkrc @@ -20,19 +20,20 @@ if hash lemonbar bar >/dev/null 2>&1; then bar 2>/dev/null & fi - +# adjust border widths based on the DPI of the monitor px=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+x[0-9]\+' | cut -d'x' -f2) mm=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+mm' | tail -n1 | sed 's/mm//') dpi=$(( (px / mm) * 25 )) -if (( dpi >= 140 )); then - : -elif (( dpi >= 120 )); then - : -elif (( dpi >= 100 )); then - : +if [ $dpi -ge 140 ]; then + border_width=5 + border_outer_width=3 +elif [ $dpi -ge 120 ]; then + border_width=4 + border_outer_width=2 else - : + border_width=2 + border_outer_width=1 fi @@ -114,7 +115,7 @@ fi # alternative # enable split borders and colours, width is overall width, outer width consumes some of width. # outer width must be less than width, outer width of 0 will be single borders - dkcmd set border width=5 outer_width=3 \ + dkcmd set border width=$border_width outer_width=$border_outer_width \ colour \ focus='#6699cc' \ unfocus='#444444' \