Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'util.py')
-rw-r--r--util.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/util.py b/util.py
index ee6e509..4a35b70 100644
--- a/util.py
+++ b/util.py
@@ -79,17 +79,10 @@ def dimensions_mm(dpi, w, h):
def calc_dpi():
- '''Looking for 'dimensions' line in xdpyinfo
- dimensions: 1280x800 pixels (339x212 millimeters)'''
- (status, output) = commands.getstatusoutput('/usr/bin/xdpyinfo')
- if status == 0:
- strings = output[find(output, 'dimensions:'):].split()
- w = int(strings[1].split('x')[0]) # e.g., 1280x800
- mm = int(strings[3][1:].split('x')[0]) # e.g., (339x212)
- return int((w * 25.4 / mm) + 0.5), True
- else:
- # just in case the above fails
- return 96, False
+ ''' Return screen DPI '''
+ xft_dpi = gtk.settings_get_default().get_property('gtk-xft-dpi')
+ dpi = float(xft_dpi / 1024)
+ return dpi, True
#