| 1 | #! /bin/bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | launch_then_killall() { |
| 6 | local -r program="$1" |
| 7 | local -r timeout="${2:-1}" # 2nd arg or default to 1. |
| 8 | |
| 9 | "$program"& |
| 10 | sleep "$timeout" |
| 11 | killall "$program" |
| 12 | } |
| 13 | |
| 14 | dpi_scale() { |
| 15 | # IDK what magic is at work here, but launching mate-appearance-properties |
| 16 | # does the job better than setting scaling variables. |
| 17 | # TODO Get to the bottom of how it works and replicate directly. |
| 18 | launch_then_killall 'mate-appearance-properties' 1 |
| 19 | |
| 20 | # GDK 3 (GTK 3) |
| 21 | # https://wiki.archlinux.org/index.php/HiDPI#GDK_3_(GTK_3) |
| 22 | #export GDK_SCALE=2 |
| 23 | |
| 24 | # QT |
| 25 | # https://wiki.archlinux.org/index.php/HiDPI#Qt_5 |
| 26 | # https://doc.qt.io/qt-5/highdpi.html |
| 27 | # https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ |
| 28 | #export QT_SCALE_FACTOR=2 # Causes qutebrowser UI fonts to have large gaps. |
| 29 | #export QT_FONT_DPI=192 # Scales qutebrowser UI fonts as expected. |
| 30 | } |
| 31 | |
| 32 | launch_common() { |
| 33 | xbindkeys |
| 34 | xscreensaver & |
| 35 | dpi_scale& |
| 36 | #mpd --kill || true |
| 37 | #mpd |
| 38 | for script in ~/.xlaunch.d/*; do |
| 39 | "$script" |
| 40 | done |
| 41 | } |
| 42 | |
| 43 | launch_specialized() { |
| 44 | # XXX dunst lazily started by dbus |
| 45 | local -r scripts_dir=~/.xlaunch.d."$(hostname)" |
| 46 | |
| 47 | if test -d "$scripts_dir" |
| 48 | then |
| 49 | for script in "$scripts_dir"/*; do |
| 50 | "$script" |
| 51 | done |
| 52 | else |
| 53 | printf '[error] scripts_dir not found: %s\n' "$scripts_dir" >&2 |
| 54 | fi |
| 55 | } |
| 56 | |
| 57 | launch_common |
| 58 | launch_specialized |
| 59 | |
| 60 | exec dwm |