summaryrefslogtreecommitdiff
path: root/dpi
blob: bd49dd4d2e912b622fd5a408bae142ab9311d5b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env zsh

res=$(xdpyinfo  | grep 'dimensions:' | strips | cut -d" " -f 5)
res_x=$(echo $res | cut -d"x" -f 1)
res_y=$(echo $res | cut -d"x" -f 2)
size_x=$(xrandr | grep " connected" | cut -d" " -f 13 | sed "s|mm||")
size_y=$(xrandr | grep " connected" | cut -d" " -f 15 | sed "s|mm||")
dpi=$(python -c "import math; print(round(math.sqrt($res_x**2 + $res_y**2) / math.sqrt(($size_x*0.0393701)**2 + ($size_y*0.0393701)**2)))")

echo $dpi