summaryrefslogtreecommitdiff
path: root/.xsessionrc
blob: 42f83f6982b342c975ba6cbfb9cdc50cf3eee7a0 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh

. $HOME/.shenv

# ---- no bell please

xset b off

# ---- keyboard settings

xset r rate 380 25
setxkbmap -option ctrl:nocaps
xmodmap ~/.xmodmaprc

# enable numlock if using USB keyboard
lsusb | grep -q "Chicony Electronics Co., Ltd" \
    && numlockx on

# ---- monitor settings

xset dpms 600

# ---- screen locking

# Due to the ways the X root window and i3lock work, if we use
# wallpaper then we have to resize it, set the root window and restart
# i3lock each time an external monitor is added or removed.  That
# requires some serious logic and probably isn't worth it.  Since I
# plug and unplug my laptop from an external monitor a lot, just use
# solid colour for now.  Could easily add some commits to set a
# background and lockscreen on the dotfiles branches of machines that
# have only one monitor

# kill any other lockers that might have snuck in
pkill -u $USER light-locker
pkill -u $USER xscreensaver

# turn over lid switch handling to logind, if needed
if which xfconf-query; then
    xfconf-query -c xfce4-power-manager -n \
                 -p /xfce4-power-manager/logind-handle-lid-switch \
                 -t bool -s true
fi

# ... and then hook i3lock into logind
xss-lock -- i3lock -c 3f3f3f -n &

# ---- GNOME daemons & GTK

# Have the GNOME keyring daemon cache our GPG key passphrase for no
# more than 20 minutes.  Cache time cannot be controlled for SSH keys
gsettings set org.gnome.crypto.cache gpg-cache-ttl 1200
gsettings set org.gnome.crypto.cache gpg-cache-method 'timeout'

eval $(gnome-keyring-daemon --start --components=gpg,pkcs11,secrets,ssh)
export GNOME_KEYRING_CONTROL GNOME_KEYRING_PID GPG_AGENT_INFO SSH_AUTH_SOCK

gnome-settings-daemon &

# ---- brightness keys

xfce4-power-manager &

# ---- clear SSH keys out of gnome-keyring-daemon when idle (per GNOME
# ---- bug #525574 it can't do this itself yet)

pkill -u $USER idlesshclear
idlesshclear &

# ---- audio

if ! pgrep -u $USER pulseaudio; then
    pulseaudio &
fi

# ---- startup applications

redshift-gtk &                  # co-ords from config file
nm-applet &
caffeine-indicator &

firefox &
emacs --daemon &
evolution &
pgrep mpd || mpd