Use latinize git default branch
[khome.git] / home / .xlaunch
... / ...
CommitLineData
1#! /bin/bash
2
3set -e
4
5LOG_FILE=~/var/log/xlaunch.log
6
7log() {
8 local -r fmt="$1"
9 shift
10
11 printf "${fmt}\n" $@ | twrap.sh >> "$LOG_FILE"
12}
13
14launch_then_killall() {
15 local -r program="$1"
16 local -r timeout="${2:-1}" # 2nd arg or default to 1.
17
18 "$program"&
19 sleep "$timeout"
20 killall "$program"
21}
22
23dpi_scale() {
24 # IDK what magic is at work here, but launching mate-appearance-properties
25 # does the job better than setting scaling variables.
26 # TODO Get to the bottom of how it works and replicate directly.
27 # TODO Try this: https://wiki.archlinux.org/title/HiDPI#Xorg
28 launch_then_killall 'mate-appearance-properties' 1
29
30 # GDK 3 (GTK 3)
31 # https://wiki.archlinux.org/index.php/HiDPI#GDK_3_(GTK_3)
32 #export GDK_SCALE=2
33
34 # QT
35 # https://wiki.archlinux.org/index.php/HiDPI#Qt_5
36 # https://doc.qt.io/qt-5/highdpi.html
37 # https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/
38 #export QT_SCALE_FACTOR=2 # Causes qutebrowser UI fonts to have large gaps.
39 #export QT_FONT_DPI=192 # Scales qutebrowser UI fonts as expected.
40}
41
42launch_common() {
43 local -r scripts_dir=~/.xlaunch.d
44
45 # XXX dunst lazily started by dbus?
46 dunst --startup_notification -conf ~/.config/dunst/dunstrc &
47 xbindkeys
48 xscreensaver &
49 dpi_scale&
50 #mpd --kill || true
51 #mpd
52 log '[error] Looking for scripts in directory: "%s"' "$scripts_dir"
53 for script in "$scripts_dir"/*; do
54 log '[debug] Launching script: "%s"' "$script"
55 "$script"
56 done
57}
58
59launch_specialized() {
60 local -r scripts_dir=~/.xlaunch.d."$(hostname)"
61
62 log '[error] Looking for scripts in directory: "%s"' "$scripts_dir"
63 if test -d "$scripts_dir"
64 then
65 for script in "$scripts_dir"/*; do
66 log '[debug] Launching script: "%s"' "$script"
67 "$script"
68 done
69 else
70 log '[error] scripts_dir not found: %s' "$scripts_dir"
71 fi
72}
73
74main() {
75 log '[info] Starting X11'
76
77 launch_common
78 launch_specialized
79
80 log '[info] Launching dwm'
81 exec dwm
82}
83
84main
This page took 0.029088 seconds and 4 git commands to generate.