Skip to content

Commit 528cd7e

Browse files
committed
feat: script to get french azerty keyboard profile
Specify the device name (amongst files under /usr/local/share/bristol/memory/profiles) with env var PROFILE_FILE_NAME ('mini' by default) The key mapping format is changed and now is: KM: Extended_ASCII MIDI_note [MIDI_chan [key_code]] If the changes are made with an editor, the file must be saved with any ISO 8859 encoding scheme. Nothing is changed for usual keys. For a dead key: - Extended_ASCII is any arbitrary character not present on the keyboard - key_code is the code returned by the keyboard on hitting the dead key See issue nomadbyte#26
1 parent 3a01f53 commit 528cd7e

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

tools/azerty4bristol.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
3+
# azerty4bristol.sh
4+
#
5+
# Run:
6+
# [PROFILE_FILE_NAME=<emulator name>] [PROFILE_SRC_DIR=<qwerty emulator file directory>] azerty4bristol.sh
7+
#
8+
# By default:
9+
# - PROFILE_FILE_NAME: mini
10+
# - PROFILE_SRC_DIR: /usr/local/share/bristol/memory/profiles/ (i.e. default bristol manual installation, see HOWTO § 2.5)
11+
#
12+
# If needed, launch this script as sudoer.
13+
# In any case, owner and group will be set up as current user.
14+
15+
pushd ~/.bristol/memory/profiles/
16+
17+
if [ "$PROFILE_FILE_NAME" = "" ]
18+
then
19+
PROFILE_FILE_NAME="mini"
20+
fi
21+
echo "Azerty profile for emulator: $PROFILE_FILE_NAME"
22+
23+
if [ "$PROFILE_SRC_DIR" = "" ]
24+
then
25+
PROFILE_SRC_DIR="/usr/local/share/bristol/memory/profiles/"
26+
fi
27+
echo "New profile based on: $PROFILE_SRC_DIR/$PROFILE_FILE_NAME"
28+
29+
[ -e "$PROFILE_FILE_NAME" ] && mv "$PROFILE_FILE_NAME" "${PROFILE_FILE_NAME}.$(date --utc +%Y%m%d_%H%M%SZ)" || true
30+
31+
install -C -o $USER -g $USER "$PROFILE_SRC_DIR/$PROFILE_FILE_NAME" .
32+
33+
sed -i 's/\(^# Keyboard map format is "KM: \)\(.*MIDI_chan\)\(.*$\)/\1Extended_\2 [key_code]\3/' "$PROFILE_FILE_NAME"
34+
35+
sed -i -e '0,/^KM: / {/^KM: /i\KM: * 19 1' -e'}' "$PROFILE_FILE_NAME"
36+
sed -i -e '0,/^KM: / {/^KM: /i\KM: < 0 1' -e'}' "$PROFILE_FILE_NAME"
37+
sed -i -e '0,/^KM: / {/^KM: /i\KM: & 23 0' -e'}' "$PROFILE_FILE_NAME"
38+
39+
sed -i -e 's/\(^KM: \)0/\1à/' -e 's/\(^KM: \)2/\1é/' -e 's/\(^KM: \)3/\1"/' "$PROFILE_FILE_NAME"
40+
sed -i -e 's/\(^KM: \)5/\1(/' -e 's/\(^KM: \)6/\1-/' -e 's/\(^KM: \)7/\1è/' "$PROFILE_FILE_NAME"
41+
sed -i 's/\(^KM: \)9/\1ç/' "$PROFILE_FILE_NAME"
42+
43+
sed -i 's/\(^KM: \)\[\(.*\)$/\1Æ\2 65106/' "$PROFILE_FILE_NAME"
44+
sed -i 's/\(^KM: \)\]/\1$/' "$PROFILE_FILE_NAME"
45+
46+
sed -i -e '/^KM:/ s/q/\[q\]/' -e '/^KM:/ s/a/q/' -e '/^KM:/ s/\[q\]/a/' "$PROFILE_FILE_NAME"
47+
sed -i -e '/^KM:/ s/z/\[z\]/' -e '/^KM:/ s/w/z/' -e '/^KM:/ s/\[z\]/w/' "$PROFILE_FILE_NAME"
48+
sed -i -e '/^KM:/ s/m/\[m\]/' -e '/^KM:/ s/,/\[,\]/' "$PROFILE_FILE_NAME"
49+
sed -i -e '/^KM:/ s/\[m\]/,/' -e '/^KM:/ s/\[,\]/;/' "$PROFILE_FILE_NAME"
50+
sed -i -e '/^KM:/ s|/|!|' -e '/^KM:/ s/\./:/' -e "/^KM:/ s/'/ù/" "$PROFILE_FILE_NAME"
51+
52+
iconv -f UTF8 -t ISO_8859-1 -o "$PROFILE_FILE_NAME" "$PROFILE_FILE_NAME"
53+
54+
popd

0 commit comments

Comments
 (0)