-
Notifications
You must be signed in to change notification settings - Fork 18
/
dpi.sh
executable file
·44 lines (37 loc) · 1.01 KB
/
dpi.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env bash
#
# Quickly change HiDpi settings to 'high' or 'low'
# N.B: You may need to reboot to see the changes.
#
# Usage:
# $ dpi.sh high|low
#
process_arguments() {
if [ $# -eq 0 ]; then
echo "Usage: dpi.sh high|low"
exit 1
fi
while [ -n "$1" ]
do
case $1 in
high) hidpi; shift; break;;
low) lowdpi; shift; break;;
*) echo "Usage: dpi.sh high|low"; exit 1;;
esac
done
}
hidpi() {
# Write Xft.dpi in .Xresources
echo -e "Xft.dpi: 125" > ~/.Xresources
# Replace GDK_DPI_SCALE in .profile
sed -i '/GDK_DPI_SCALE/d' ~/.profile
echo -e "export GDK_DPI_SCALE=1.25 # High\n# export GDK_DPI_SCALE=1 # Low" >> ~/.profile
}
lowdpi() {
# Write Xft.dpi in .Xresources
echo -e "Xft.dpi: 96" > ~/.Xresources
# Replace GDK_DPI_SCALE in .profile
sed -i '/GDK_DPI_SCALE/d' ~/.profile
echo -e "export GDK_DPI_SCALE=1 # Low\n# export GDK_DPI_SCALE=1.25 # High" >> ~/.profile
}
process_arguments "$@"