Skip to content

Commit a2baf65

Browse files
committed
fix #25 - remap alt key and meta key
1 parent 292f7f6 commit a2baf65

File tree

7 files changed

+57
-8
lines changed

7 files changed

+57
-8
lines changed

Mouth/.idea/misc.xml

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Mouth/app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
<category android:name="android.intent.category.LAUNCHER" />
2323
</intent-filter>
2424
</activity>
25+
<receiver
26+
android:name=".DummyInputDeviceReceiver"
27+
android:label="@string/keyboard_layouts_label">
28+
<intent-filter>
29+
<action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" />
30+
</intent-filter>
31+
<meta-data
32+
android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS"
33+
android:resource="@xml/shun_feng_er_map" />
34+
</receiver>
2535
</application>
2636

2737
</manifest>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.miidio.audio.client;
2+
3+
import android.content.BroadcastReceiver;
4+
import android.content.Context;
5+
import android.content.Intent;
6+
7+
/**
8+
* This is a dummy Input Device Receiver for removing the warning of manifest file.
9+
*/
10+
public class DummyInputDeviceReceiver extends BroadcastReceiver {
11+
@Override
12+
public void onReceive(Context context, Intent intent) {
13+
// Do nothing
14+
}
15+
}

Mouth/app/src/main/java/com/miidio/audio/client/PCKeyMapper.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ public class PCKeyMapper {
7171
map.put(138, 119);//F8
7272
map.put(139, 120);//F9
7373
map.put(140, 121);//F10
74-
map.put(141, 122);//F11
75-
map.put(142, 123);//F12
74+
// We use F11 and F12 to replace meta and alt for overriding android shortcuts.
75+
// map.put(141, 122);//F11
76+
// map.put(142, 123);//F12
7677
map.put(120, 154);//SRNPRT
7778
map.put(116, 145);//SCROLLLOCK
7879
map.put(121, 19);//PAUSE
@@ -111,14 +112,16 @@ public class PCKeyMapper {
111112
// map.put(25, ??);//VOLUME_DOWN
112113
map.put(158, 44);//NUMPAD_COMMA
113114
map.put(76, 111);//DIVIDE
114-
map.put(57, 18);//LEFTALT
115-
map.put(58, 18);//RIGHTALT
115+
// map.put(57, 18);//LEFTALT
116+
// map.put(58, 18);//RIGHTALT
117+
map.put(141, 18);// remap F11 to alt, that's on purpose
116118
map.put(59, 16);//LEFTSHIFT
117119
map.put(60, 16);//RIGHTSHIFT
118120
map.put(113, 17);//LEFTCTRL
119121
map.put(114, 17);//RIGHTCTRL
120-
map.put(117, 157);//LEFTMETA
121-
map.put(118, 157);//RIGHTMETA
122+
// map.put(117, 157);//LEFTMETA
123+
// map.put(118, 157);//RIGHTMETA
124+
map.put(142, 157);// remap F12 to meta, that's on purpose
122125
}
123126

124127
public static int get(int key) {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Remap some shortcuts to nothing
2+
# UTF-8 encoded
3+
type OVERLAY
4+
5+
# remap meta key
6+
map key 125 F12
7+
map key 126 F12
8+
9+
# remap alt key
10+
map key 56 F11
11+
map key 100 F11

Mouth/app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,5 @@
1111
<string name="status_connected">Connected to %1$s</string>
1212
<string name="status_error_no_address">Please specify IP or DNS before connect.</string>
1313
<string name="label_password">Password:</string>
14+
<string name="keyboard_layouts_label">Remap meta and alt keys</string>
1415
</resources>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android">
3+
<keyboard-layout
4+
android:name="shun_feng_er_map"
5+
android:keyboardLayout="@raw/shun_feng_er_layout"
6+
android:label="@string/app_name" />
7+
</keyboard-layouts>

0 commit comments

Comments
 (0)