aboutsummaryrefslogtreecommitdiff
path: root/modules/profile/xsession.dot.link
blob: 6af48b3d3454909bfabca2f1641400d7aaf1fb9f (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
#!/bin/bash
#
# .xsession: set basic X11 environment
#

# Background image
BACKGROUND=""

# Session applications
PROGRAMS=""

# OS Version
OSVERSION="`cut -d . -f 1 /etc/debian_version`"

# Hostname
HOSTNAME="`cat /etc/hostname`"

# Make sure to load the profile
. $HOME/.profile

# Start xscreensaver
xscreensaver -no-splash &

# Custom
if [ -e "$HOME/.custom/xsession" ]; then
  . $HOME/.custom/xsession
fi

# Set background
if [ ! -z "$BACKGROUND" ]; then
  Esetroot -scale $HOME/.config/themes/backgrounds/$BACKGROUND
else
  xsetroot -solid black
fi

# Additional applications depending on the machine type
if laptop-detect; then
  PROGRAMS="$PROGRAMS xwicd"
else
  PROGRAMS="$PROGRAMS"
fi

# Start session applications
for program in $PROGRAMS; do
  $program &
done

# Apply custom keyboard configuration
if [ -f "$HOME/.Xmodmaps/$HOSTNAME" ]; then
  xmodmap $HOME/.Xmodmaps/$HOSTNAME

  # Why xmodmap has to run twice to some changes take place?
  # https://faq.i3wm.org/question/558/xmodmap-loading/
  # https://bugs.launchpad.net/ubuntu/+source/gdm/+bug/700309
  xmodmap $HOME/.Xmodmaps/$HOSTNAME
fi

# Fix mumble configuration, which varies depending on machine audio
if [ -f "$HOME/.config/Mumble/Mumble-$HOSTNAME.conf" ]; then
  (
    cd $HOME/.config/Mumble
    mv Mumble.conf Mumble-$HOSTNAME.conf.backup
    ln -s Mumble-$HOSTNAME.conf Mumble.conf
  )
fi

# Execute window manager
if [ "$OSVERSION" = "7" ]; then
  # See https://bugzilla.redhat.com/show_bug.cgi?id=783568
  #     https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/932177
  #     http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653011
  #     https://bugzilla.gnome.org/show_bug.cgi?id=660240
  #unset GNOME_KEYRING_PID
  #unset GNOME_KEYRING_CONTROL
  eval $(gnome-keyring-daemon --start --components=pkcs11,gpg,secrets)

  # Start window manager
  awesome
fi