summaryrefslogtreecommitdiff
path: root/post-autorandr
blob: 9ec7c5d48635eb89d8cd2694967dc2e715394e70 (plain)
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
45
46
47
48
49
50
51
#!/usr/bin/env zsh
#------------------------------------------------------------------------------
# xsettingsd systemd unit:
# --
# [Unit]
# Description=xsettingsd magic
#
# [Service]
# ExecStart=/usr/bin/xsettingsd
# ExecReload=/bin/kill -HUP $MAINPID
#
# [Install]
# WantedBy=default.target
# --
XSETTINGSD_TEMPLATE='Xft/Hinting 1\nXft/HintStyle "hintslight"\nXft/Antialias 1\nXft/RGBA "rgb"\nXft/DPI %s\n'
XSETTINGSD_CONFIG=/run/user/$UID/xsettingsd-config

XKB_OPTS='grp:win_space_toggle,compose:menu'
XKB_LAYOUTS='us(altgr-intl),ru(typewriter)'

WALLPAPER=$HOME/.wallpaper

TOUCHPAD_DEV='SynPS/2 Synaptics TouchPad'

DPI=${1:-96}
#------------------------------------------------------------------------------

# reset xkbmap, set xkbmap
setxkbmap us -option
setxkbmap $XKB_LAYOUTS -option $XKB_OPTS

# configure touchpad
xinput set-prop $TOUCHPAD_DEV 'libinput Click Method Enabled' 0 1
xinput set-prop $TOUCHPAD_DEV 'libinput Middle Emulation Enabled' 1

# background
feh --bg-fill $WALLPAPER

# dpi - xsettignsd, has to be started here because config is absent on boot
printf $XSETTINGSD_TEMPLATE $(($DPI * 1024)) > $XSETTINGSD_CONFIG
systemctl --quiet --user is-active xsettingsd || systemctl --user start xsettingsd
systemctl --user reload xsettingsd.service

# dpi - other
xrdb -merge <(echo "Xft.dpi: $DPI")
xrandr --dpi $DPI
i3-msg restart

# report
current_config=$(autorandr --current)
notify-send "$current_config config applied"