Make a bar constructor function
[khome.git] / home / .xlaunch
CommitLineData
d6c84e8b
SK
1#! /bin/bash
2
3set -e
4
e2b9f534
SK
5launch_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
14dpi_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}
d6c84e8b
SK
31
32launch_common() {
33 xbindkeys
34 xscreensaver &
e2b9f534
SK
35 dpi_scale&
36 #mpd --kill || true
37 #mpd
d6c84e8b
SK
38 for script in ~/.xlaunch.d/*; do
39 "$script"
40 done
41}
42
43launch_specialized() {
44 # XXX dunst lazily started by dbus
658bbf0d
SK
45 local -r scripts_dir=~/.xlaunch.d."$(hostname)"
46
57081bde 47 if test -d "$scripts_dir"
658bbf0d
SK
48 then
49 for script in "$scripts_dir"/*; do
50 "$script"
51 done
57081bde
SK
52 else
53 printf '[error] scripts_dir not found: %s\n' "$scripts_dir" >&2
658bbf0d 54 fi
d6c84e8b
SK
55}
56
57launch_common
58launch_specialized
59
60exec dwm
This page took 0.037811 seconds and 4 git commands to generate.