summaryrefslogtreecommitdiff
path: root/xfce4-change-dpi
blob: 4472f6c3aaf3f66496b69908c4090801bb8600ca (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# Toggles Xft DPI setting between 96 (default) and 130 (custom) for UI scaling
# Useful for switching between displays with different scaling requirements

set -euo pipefail

DEFAULT_DPI=96
CUSTOM_DPI=130

xdpi() {
  xfconf-query -c xsettings -p /Xft/DPI "$@"
}

main() {
  local current_dpi
  current_dpi=$(xdpi)
  if [ "$current_dpi" = "$CUSTOM_DPI" ]; then
    xdpi -s "$DEFAULT_DPI"
  else
    xdpi -s "$CUSTOM_DPI"
  fi
}

main "$@"