-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmonad-session-rc
executable file
·149 lines (120 loc) · 4.95 KB
/
xmonad-session-rc
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/bin/bash
# By default, xmonad looks for this in ~/.xmonad/xmonad-session-rc.
# If this file does not exist, create it, or a link to this content.
export XMONAD_LOG_FILE="/tmp/xmonad.log"
rm $XMONAD_LOG_FILE
echo "xmonad-session-rc" >> "$XMONAD_LOG_FILE"
# Deal with default multi-monitor config
# Set awk Output Record Separator to one space, since records are separated by \n by
# default (unlike fields).
ALL_MONITORS_STR=$(xrandr --current | grep " connected " | awk 'BEGIN { ORS = " "}; {print $1}' )
read -r -a ALL_MONITORS <<< "$ALL_MONITORS_STR"
NB_CONNECT_OUTPUT="${#ALL_MONITORS[@]}"
## why does the following not output to /tmp/xmonad.log??
xrandr --current >> "$XMONAD_LOG_FILE"
xrandr --current | grep " connected " | awk 'BEGIN { ORS = " "}; {print $1}' >> "$XMONAD_LOG_FILE"
# Path is not set yet, and sourcing ~/.bashrc does not seem to work.
PATH=~/bin:$PATH
echo "Debug variable: $NB_CONNECT_OUTPUT" >> "$XMONAD_LOG_FILE"
if [ "$NB_CONNECT_OUTPUT" == 1 ] ; then
echo "One X output" >> "$XMONAD_LOG_FILE"
fi
if [ "$NB_CONNECT_OUTPUT" == 3 ] ; then
echo "Docking on login" >> "$XMONAD_LOG_FILE"
dock
else
echo "Undocking on login" >> "$XMONAD_LOG_FILE"
# Undocking here does not work on my thinkpad??
undock
fi
# Compositor
if [[ -x "/usr/bin/compton" ]]; then
# Explicit glx required for xsecurelock to succeed with background
compton --config "$HOME/.xmonad/compton.conf" --backend glx --paint-on-overlay &
fi
if [[ -x "$HOME/bin/mylock" ]]; then
export LOCK_CMD="$HOME/bin/mylock"
fi
# Theming
if [[ -d /usr/share/themes/Nordic-darker-standard-buttons ]] ; then
export GTK_THEME=Nordic-darker-standard-buttons
fi
export QT_QPA_PLATFORMTHEME=qt5ct
ort QT_STYLE_OVERRIDE=kvantum
# Tray for skype and other icons
# Nowadays dealing with trayer on user request only, see xmonad.hs. Even using xfce4-panel.
#trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --widthtype request --transparent true --alpha 0 --tint 0x333333 --height 16 --monitor 0 &
# Keyboard layout switcher
#if [[ -f $HOME/kinesis/kinesis_swe_us.conf ]]; then
# # See https://github.com/fleutot/kinesis
# #xkbcomp -i 3 $HOME/kinesis/kinesis_swe_us.conf $DISPLAY
# # The commented row above did not work at startup. Maybe $DISPLAY cannot be used too early?
# xkbcomp -i 3 $HOME/kinesis/kinesis_swe_us.conf :0
#else
# # alt_shift_toggle stopped working (switching on press instead of release, breaking shortcuts with alt+shift).
# # alt_caps might be better anyway, preventing rogue presses in eg emacs (M-< and M->).
# #setxkbmap -layout us,us,se -variant ,dvp, -option 'grp:alt_caps_toggle' &
setxkbmap -layout us,se -option 'grp:alt_caps_toggle'
#fi
# Per window keyboard layout
kbdd
# Java applications don't detect xmonad as a non-reparenting WM, resulting in grey empty windows.
# (under investigation, this might have to move to ~/.bashrc)
#Trying to do that in xmonad.hs, check after restart and remove this if setting
# from xmonad.hs worked.
# Now not done in xmonad.hs since upgrade, yet Cooja is happy. Java detects
# non-reparenting automatically, maybe? Or xmonad sets it by itself?
#export _JAVA_AWT_WM_NONREPARENTING=1
# Startup apps
# Notifier
if type dunst ; then
dunst &
fi
if type xscreensaver ; then
xscreensaver -nosplash &
fi
if type dropbox ; then
dropbox start
fi
if type emacs ; then
emacs &
fi
if type gnome-power-manager ; then
sleep 3
gnome-power-manager &
elif type xfce4-power-manager ; then
sleep 2
# This might require superuser in order to allow hibernate.
xfce4-power-manager &
fi
if type unclutter-xfixes ; then
# jitter required for ignore-scrolling to work: https://github.com/Airblader/unclutter-xfixes/issues/47
unclutter-xfixes --timeout 2 --ignore-scrolling --jitter 1&
elif type unclutter ; then
# unclutter starts a default version by itself, see (and modify)
# /etc/default/unclutter
# -noevents is needed in order not to give focus to the window under the
# possibly hidden cursor upon switching workspace. Try without -grab to let
# xscreensaver use the mouse, and lock faster (otherwise it tries and fails
# to grab the mouse pointer, and times out). -grab was added earlier to
# "avoid erroneous focus changes", let's test and see.
# First try to run unclutter from apt. If it doesn't work (-noevents not
# supported), try the other one.
unclutter -noevents -idle .5 &
if ! pgrep unclutter ; then
# --ignore-scrolling doesn't seem to work. Might require
# jitter?: https://github.com/Airblader/unclutter-xfixes/issues/47
unclutter --timeout 1 --ignore-scrolling&
fi
fi
if type blueman-applet ; then
blueman-applet &
fi
if type nm-applet ; then
nm-applet &
fi
# Make ssh-agent prompt for key passphrase once and for all.
# Problem: this does not seem to prompt for password, can it really be run from this file?
eval "$(ssh-agent)"
ssh-add
echo "end of xmonad-session-rc" >> "$XMONAD_LOG_FILE"