summaryrefslogtreecommitdiff
path: root/bin/xstartup
blob: 112694798c460657cd557b4848669cead048a1c6 (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
#!/bin/sh

. $HOME/.shenv

# stuff to start in XFCE or GNOME3

# ---- no bell please

xset b off

# ---- keyboard settings

setxkbmap -option ctrl:nocaps
setxkbmap -option "compose:ralt"
setxkbmap -layout gb
xmodmap ~/.Xmodmap
xbindkeys

# set US layout if my US usb keyboard is plugged in :(
lsusb | grep -q "Chicony Electronics Co., Ltd" \
    && setxkbmap -layout us

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

# disable built-in laptop keyboard if US usb keyboard plugged in :)
# turn this off for now since lid closed anyway and laptopinput script
# broken
# [ "$(hostname -s)" = "artemis" ] \
#     && laptopinput --maybe-disable

# settings for (currently out of action) Apple USB keyboard

if lsusb | grep -q "Aluminum Keyboard"; then
    echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode > /dev/null
    xmodmap $HOME/.Xmodmap-Apple
    xset r rate 300
    sleep 2
    pkill zenity
fi

# ---- GTK settings

# Note that at least some of these won't take effect until logging in
# again to restart services.

# 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'

# ---- 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 &

# ---- screen locking

if [ -e "/etc/systemd/system/goodmorning.timer" ]; then

    # if alarm clock service is in place on this machine, turn over lid
    # switch handling to logind
    xfconf-query -c xfce4-power-manager -n \
                 -p /xfce4-power-manager/logind-handle-lid-switch \
                 -t bool -s true

    # ... and then use xss-lock to make sure the screen still gets locked
    xss-lock -- xscreensaver-command -lock &

fi

# ---- other stuff to launch

redshift-gtk -l 53.57:1.5 -t 6500:3700 &
caffeine-indicator &
workrave &
firefox &

# ---- fire up my window manager

xmonad --replace