-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuser-config.bash
216 lines (166 loc) · 7.66 KB
/
user-config.bash
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash
# options used
# $LUBUILD_HARDWARE_TYPE_EXTERNAL_SCREEN
# $LUBUILD_HARDWARE_TYPE_LAPTOP
### Screen locking issues in 14.04 & 14.10
# do we want to force screensaver to lock, or let user config manually?
#
if \
[[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "Lubuntu 14.04" ]] \
|| [[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "Lubuntu 14.10" ]] \
; then
echo === change C-A-L lock shortcut to use light locker
cp ~/.config/openbox/lubuntu-rc.xml{,.`date +%y%m%d.%H%M%S`}
sed -i 's/lxsession-default lock/light-locker-command -l/' \
~/.config/openbox/lubuntu-rc.xml
fi
## NB: is above also an issue in Lubuntu 17.10? (was at Alpha2)
if [[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "QLubuntu 17.10" ]] ; then
cat > $HOME/.config/lxqt/globalkeyshortcuts.conf <<EOF!
[Control%2BAlt%2BL.27]
Comment=Lock screen
Enabled=true
path=lxqt-leave --lockscreen
EOF!
fi
# consider changing (unconditionally) shortcut from key="C-A-l" to key="W-l"
# or at least adding in a copy (like W-p below) to use both shortcuts
### Set laptop mode ###
if [[ $LUBUILD_HARDWARE_TYPE_LAPTOP -eq TRUE ]] ; then (
if \
[[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "Lubuntu 14.04" ]] \
; then
# credit > http://askubuntu.com/a/361286
cp ~/.config/lxsession/Lubuntu/desktop.conf{,.`date +%y%m%d.%H%M%S`}
echo modify the following setting in the named section ; \
echo [State] ; \
echo laptop_mode=yes ; \
sudo leafpad ~/.config/lxsession/Lubuntu/desktop.conf
fi
) ; fi
## enable Sleep Key in Lubuntu 16.10
#
# Manual
#
# e.g. (Fn-F4) on AO722
# * Right-click on battery - (Xfce) Power Managment Settings
# * xfce4-power-manager-settings
# * "When sleep button is pressed" = Suspend
# * ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
# * <property name="sleep-button-action" type="uint" value="1"/>
######### toggle external screen display using SUPER-P ###########################
#
# Lubuntu's (LXDE's) LXRandR gui allows you to set a specific configuration,
# but not toggle / cycle between alternative modes you choose to predefine
#
# Use ARandR scripts instead...
# help - http://christian.amsuess.com/tools/arandr/
# proc - http://askubuntu.com/questions/162028/how-to-use-shortcuts-to-switch-between-displays-in-lxde
#
# NOT required under LXQT: lxqt-config-monitor is based on KScreen, handles monitor changes automatically
if [[ "$DESKTOP_SESSION" -ne "QLubuntu" ] && [ "$LUBUILD_HARDWARE_TYPE_LAPTOP" -eq "TRUE" ] && [ "$LUBUILD_HARDWARE_TYPE_EXTERNAL_SCREEN" -eq "TRUE" ]] ; then (
# This installs the GUI and the notify-send util the script uses for notification bubbles / toasts
sudo apt-get install -y arandr libnotify-bin
# This sets up the script to cycle modes
mkdir -p ~/.screenlayout
cd ~/.screenlayout
wget https://github.com/bmnz/arandr-cycle/raw/master/arandr-cycle.sh ./.arandr-cycle.sh
mv arandr-cycle.sh .arandr-cycle.sh
chmod +x .arandr-cycle.sh
# This sets up the Function key as Win-P
cp ~/.config/openbox/lubuntu-rc.xml{,.`date +%y%m%d`}
cat ~/.config/openbox/lubuntu-rc.xml.`date +%y%m%d` \
| xmlstarlet ed \
-s "/_:openbox_config/_:keyboard" \
-t elem -n keybind \
| xmlstarlet ed \
-i "/_:openbox_config/_:keyboard/_:keybind[last()]" \
-t attr -n key -v W-p \
-s "/_:openbox_config/_:keyboard/_:keybind[last()]" \
-t elem -n action \
| xmlstarlet ed \
-i "/_:openbox_config/_:keyboard/_:keybind[last()]/_:action" \
-t attr -n name -v Execute \
-s "/_:openbox_config/_:keyboard/_:keybind[last()]/_:action" \
-t elem -n command \
| xmlstarlet ed \
-s "/_:openbox_config/_:keyboard/_:keybind[last()]/_:action/_:command" \
-t text -n text -v "~/.screenlayout/.arandr-cycle.sh" \
> ~/.config/openbox/lubuntu-rc.xml
openbox --reconfigure
# Now use the GUI to save one file for each of your preferred modes
arandr
) ; fi
# NB: If mouse pointer does not appear when you switch external monitor on then try the following:
# EITHER re-awaken X by switching consoles - CTRL-ALT-F1 then CTRL-ALT-F7 - credit https://bbs.archlinux.org/viewtopic.php?pid=648767#p648767
# OR suspend and resume
# for alternative scripts that can cycle between 3 or more modes,
# see... (in ascending order of complexity)
# http://crunchbang.org/forums/viewtopic.php?id=10182
# http://unix.stackexchange.com/a/168141
# https://gist.github.com/davidfraser/4131369
# https://awesome.naquadah.org/wiki/Using_Multiple_Screens
##############################################
# Laptop Lid settings - ignore lid close
if [[ $LUBUILD_HARDWARE_TYPE_LAPTOP -eq TRUE ] && [ $LUBUILD_HARDWARE_TYPE_EXTERNAL_SCREEN -eq TRUE ]] ; then (
# credit - http://askubuntu.com/questions/407287/change-xfce4-power-manager-option-from-terminal
# credit - http://docs.xfce.org/xfce/xfce4-power-manager/preferences
# help - http://docs.xfce.org/xfce/xfconf/xfconf-query
# help - http://git.xfce.org/xfce/xfce4-power-manager/plain/src/xfpm-xfconf.c
# if you want to check current settings
# xfconf-query -c xfce4-power-manager -l -v
# or
# cat ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-power-manager.xml
# No action on lid close
xfconf-query -c xfce4-power-manager -n -p "/xfce4-power-manager/lid-action-on-ac" -t int -s 0
xfconf-query -c xfce4-power-manager -n -p "/xfce4-power-manager/lid-action-on-battery" -t int -s 0
) ; fi
### The rest of this used to be in user-fixes.bash
#### Sound controls
# some Laptops not adjusting volume with Fn VolUp and Fn VolDn keys
# credit - http://ubuntuforums.org/archive/index.php/t-1977849.html
# credit - https://bugs.launchpad.net/ubuntu/+source/lxpanel/+bug/1262572
MODEL_NO=`sudo dmidecode -s system-product-name`
AFFECTED_MODELS='|AO722|Latitude E7240|sample other|'
if [[ $AFFECTED_MODELS == *\|$MODEL_NO\|* ]] ; then
sudo cp $HOME/.config/openbox/lubuntu-rc.xml{,.`date +%y%m%d.%H%M%S`} # backup original config
# find the text XF86AudioRaiseVolume
# after each of the three commands amixer -q insert the following text before sset
# -D pulse
sed -i -e 's|amixer -q sset|amixer -q -D pulse sset|' \
$HOME/.config/openbox/lubuntu-rc.xml ;
openbox --reconfigure
fi
##### Power cord beep
# Acer One has a loudly annoying beep when inserting or removing the power cord.
# credit - http://housegeekatheart.blogspot.co.uk/2011/10/disable-ac-adaptor-beep-in-portables-in.html
# Windows-side fix: [http://www.jdhodges.com/blog/disable-beep-on-acer-ao722-netbook-solved-two-ways/]
MODEL_NO=`sudo dmidecode -s system-product-name`
AFFECTED_MODELS='|AO722|'
if [[ $AFFECTED_MODELS == *\|$MODEL_NO\|* ]] ; then
# check which card is the non HD audio card with
cat /proc/asound/cards
# set the card's Beep setting to almost silent
amixer -c 1 sset Beep 1
fi
# now fixed and backported
## "lxsession-default tasks" (CTRL-ALT-DEL) kills xorg / logs user out
# sed -i -e 's|lxsession-default tasks|lxtask|' \
# $HOME/.config/openbox/lubuntu-rc.xml ;
# openbox --reconfigure
## http://ubuntuforums.org/showthread.php?t=2218356
## http://askubuntu.com/questions/499036/
## https://bugs.launchpad.net/ubuntu/+source/lxsession/+bug/1316832
# no longer needed per user as it's fixed system-wide
## credit - https://bugs.launchpad.net/ubuntu/+source/pcmanfm/+bug/975152/comments/17
## still an issue in Lubuntu 14.10 (Beta 2)
#if \
# [[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "Lubuntu 14.04" ]] \
# || [[ "${DESKTOP_SESSION} $(lsb_release -sr)" == "Lubuntu 14.10" ]] \
# ; then
# echo === open bash scripts in Terminal from File Manager - Lub 14.04 ;
### This would fail anyhow, as config file not created until you go into GUI preferences
# sudo cp $HOME/.config/lxpanel/Lubuntu/config{,.`date +%y%m%d.%H%M%S`}
# sed -i -e 's|lxsession-default terminal|x-terminal-emulator|' \
# $HOME/.config/lxpanel/Lubuntu/config ;
#fi