-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure-keyboard.sh
executable file
·75 lines (60 loc) · 2.29 KB
/
configure-keyboard.sh
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
#! /bin/sh
# configure keyboard
# by Bachir Soussi Chiadmi www.g-u-i.net
# @bachysoucychymy
urpmi --auto xev
# set fucntions key as default (https://help.ubuntu.com/community/AppleKeyboard)
echo 2 | sudo tee /sys/module/hid_apple/parameters/fnmode
# permanently : add the command in /etc/rc.local if exists (use the create-rclocal-service.sh script)
if [ -f /etc/rc.local ]; then
sed -i 's/exit 0/echo 2 | sudo tee \/sys\/module\/hid_apple\/parameters\/fnmode \nexit 0/g' /etc/rc.local
fi
# swap missplaced keys on usb external apple keyboard(ctr/<>)
# mbp keyboard wont work properly after that, you'll have to reverse the process to sue it
echo 0 | sudo tee /sys/module/hid_apple/parameters/iso_layout
# permanently : add the command in /etc/rc.local if exists (use the create-rclocal-service.sh script)
if [ -f /etc/rc.local ]; then
sed -i 's/exit 0/echo 0 | sudo tee \/sys\/module\/hid_apple\/parameters\/iso_layout \nexit 0/g' /etc/rc.local
fi
# swap ctrl and command keys (two options tested the frist one)
# http://stackoverflow.com/questions/7099602/cmd-control-keys-swap-in-ubuntu
echo "clear control
clear mod4
keycode 105 =
keycode 206 =
keycode 133 = Control_L NoSymbol Control_L
keycode 134 = Control_R NoSymbol Control_R
keycode 37 = Super_L NoSymbol Super_L
add control = Control_L
add control = Control_R
add mod4 = Super_L" > ~/.Xmodmap
sudo echo "xmodmap ~/.Xmodmap" >> ~/.xinitrc
# following is not working
# echo "[Desktop Entry]
# Name=Xmodmap
# GenericName=Keyboard Remapping
# Comment=Remap the Control and Command Keys on the MBP 8,2
# Exec=xmodmap ~/.Xmodmap
# Terminal=false
# Type=Application
# Categories=Keyboard;
# StartupNotify=false" > ~/.config/autostart/xmodmap.desktop
# OR
# from https://bbs.archlinux.org/viewtopic.php?id=156257"
# echo "remove control = Control_L
# remove mod4 = Super_L Super_R
# keysym Control_L = Super_L
# keysym Super_L = Control_L
# keysym Super_R = Control_L
# add control = Control_L Control_R
# add mod4 = Super_L Super_R" > /etc/X11/xinit/.Xmodmap
# echo "[Desktop Entry]
# Name=Xmodmap
# GenericName=Keyboard Remapping
# Comment=Remap the Control and Command Keys on the MBP 8,2
# Exec=xmodmap /etc/X11/xinit/.Xmodmap
# Terminal=false
# Type=Application
# Categories=Keyboard;
# StartupNotify=false" > ~/.config/autostart/xmodmap.desktop