summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh')
-rw-r--r--meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh92
1 files changed, 0 insertions, 92 deletions
diff --git a/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh b/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh
deleted file mode 100644
index 04a2edd6c..000000000
--- a/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/setDPI.sh
+++ /dev/null
@@ -1,92 +0,0 @@
1#! /bin/sh
2#
3# Copyright Matthias Hentges <devel@hentges.net> (c) 2006
4# License: GPL (see http://www.gnu.org/licenses/gpl.txt for a copy of the license)
5#
6# Filename: setDPI.sh
7# Date: 09-Apr-06
8
9# This script configures Xft.dpi dependent on your screens DPI. This insures that the same font-size
10# setting of 7 can be used on all machines.
11
12
13XDEFAULTS="/etc/X11/Xdefaults"
14
15
16
17set_dpi() {
18
19 CURRENT_SETTING="`cat ${XDEFAULTS} | sed -n "/Xft.dpi\:/s/.*\:\(.*\)/\1/p" | sed -n "s/\ //p"`"
20
21 if test "$CURRENT_SETTING" != "$1"
22 then
23 echo "Using Xft.dpi of $SET_SCREEN_DPI for your $SCREEN_DPI DPI screen"
24
25 if grep -q "Xft.dpi" "$XDEFAULTS"
26 then
27 cat "${XDEFAULTS}" | sed "s/^Xft.dpi\:.*/Xft.dpi\: $SET_SCREEN_DPI/" > "${XDEFAULTS}_"
28 mv "${XDEFAULTS}_" "${XDEFAULTS}"
29 else
30 echo -e "Xft.dpi: $SET_SCREEN_DPI\n" >> "$XDEFAULTS"
31 fi
32 else
33 echo "Your $SCREEN_DPI DPI screen is already configured."
34 fi
35}
36
37set_rxvt_font() {
38
39 CURRENT_SETTING="`cat ${XDEFAULTS} | sed -n "/Rxvt\*font/s/\(.*\pixelsize=\)\(.*\)/\2/p"`"
40
41 if test "$1" -gt 100
42 then
43
44 # Configure the rxvt font-size for your screen here:
45 test "$1" -gt 180 -a "$1" -lt "221" && RXVT_FONT_SIZE=16
46
47 if test -z "$RXVT_FONT_SIZE"
48 then
49 echo "WARNING: No rxvt font-size configured for a $SCREEN_DPI DPI screen!"
50 echo "Defaulting to size 9"
51 RXVT_FONT_SIZE=9
52 fi
53
54 if test "$CURRENT_SETTING" != "$RXVT_FONT_SIZE"
55 then
56 echo "Using a rxvt font-size of $RXVT_FONT_SIZE"
57 cat ${XDEFAULTS} | sed "/Rxvt\*font/s/\(.*\pixelsize\)\(=*.*\)/\1=$RXVT_FONT_SIZE/" > ${XDEFAULTS}_
58 mv ${XDEFAULTS}_ ${XDEFAULTS}
59 else
60 echo "The rxvt font-size is already configured"
61 fi
62 fi
63}
64
65if test -z "$DISPLAY"
66then
67 echo "DISPLAY is not set, aborting..."
68 exit 0
69fi
70
71SCREEN_DPI="`/usr/bin/xdpyinfo | grep "dots per inch" | awk '{print $2}'| sed -n "s/\(.*\)x\(.*\)/\2/p"`"
72
73if test -z "$SCREEN_DPI"
74then
75 echo "WARNING: Couldn't read your screens DPI, defaulting to 100"
76 SCREEN_DPI=100
77fi
78
79# Configure your screen here:
80test "$SCREEN_DPI" -gt 180 -a "$SCREEN_DPI" -lt "221" && SET_SCREEN_DPI=160
81test "$SCREEN_DPI" -gt 90 -a "$SCREEN_DPI" -lt "121" && SET_SCREEN_DPI=100
82
83
84if test -z "$SET_SCREEN_DPI"
85then
86 echo "WARNING: No default configuration found for your $SCREEN_DPI DPI screen!"
87 echo "Using 100 DPI"
88 SET_SCREEN_DPI=100
89fi
90
91set_dpi "$SET_SCREEN_DPI"
92set_rxvt_font "$SCREEN_DPI"