Adjust dk border widths based on monitor DPI
This commit is contained in:
parent
00ce6f6d6c
commit
0dd6b4aa34
@ -20,19 +20,20 @@ if hash lemonbar bar >/dev/null 2>&1; then
|
|||||||
bar 2>/dev/null &
|
bar 2>/dev/null &
|
||||||
fi
|
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)
|
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//')
|
mm=$(xrandr | grep ' connected' | tail -n1 | grep -o '[0-9]\+mm' | tail -n1 | sed 's/mm//')
|
||||||
dpi=$(( (px / mm) * 25 ))
|
dpi=$(( (px / mm) * 25 ))
|
||||||
|
|
||||||
if (( dpi >= 140 )); then
|
if [ $dpi -ge 140 ]; then
|
||||||
:
|
border_width=5
|
||||||
elif (( dpi >= 120 )); then
|
border_outer_width=3
|
||||||
:
|
elif [ $dpi -ge 120 ]; then
|
||||||
elif (( dpi >= 100 )); then
|
border_width=4
|
||||||
:
|
border_outer_width=2
|
||||||
else
|
else
|
||||||
:
|
border_width=2
|
||||||
|
border_outer_width=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +115,7 @@ fi
|
|||||||
# alternative
|
# alternative
|
||||||
# enable split borders and colours, width is overall width, outer width consumes some of width.
|
# 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
|
# 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 \
|
colour \
|
||||||
focus='#6699cc' \
|
focus='#6699cc' \
|
||||||
unfocus='#444444' \
|
unfocus='#444444' \
|
||||||
|
Reference in New Issue
Block a user