diff options
author | Patrick Simianer <pks@pks.rocks> | 2019-09-03 22:11:47 +0200 |
---|---|---|
committer | Patrick Simianer <pks@pks.rocks> | 2019-09-03 22:11:47 +0200 |
commit | d6686698b8fdd11b0cddd5ce4e0c288c00965776 (patch) | |
tree | 55d80548313005b1c1af1395bd5e20fa2d13064d | |
parent | 9a20271749adf9b04527af4d738008ace425c919 (diff) |
dpi script
-rwxr-xr-x | dpi | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -0,0 +1,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 + |