Compare commits

..

2 Commits

Author SHA1 Message Date
Jules Aguillon
408d80b26c Remove the old implementation of the Caps lock button 2024-02-17 12:04:02 +01:00
Jules Aguillon
95e7494ad7 Define Caps lock as a modifier
The previous implementation has unintended interactions with
auto-capitalisation.

Caps lock can now be locked twice at the same time, independently:
- Long press on shift
- Tap on Caps lock

Both have to be disabled independently. This might seem weird.
2024-02-17 11:59:38 +01:00
435 changed files with 7003 additions and 26391 deletions

1
.gitattributes vendored
View File

@@ -1 +0,0 @@
srcs/juloo.keyboard2/ComposeKeyData.java -diff

View File

@@ -1,26 +1,19 @@
name: Check layouts
# Runs 'gen_layouts.py' and checks that the generated file were uptodate.
# This doesn't run 'check_layout.py'.
on:
workflow_dispatch:
push:
pull_request:
jobs:
gen-layouts:
name: Generated files
check-layouts:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- run: python3 gen_layouts.py
- name: "Run 'python3 gen_layouts.py' to update generated files"
run: git diff --exit-code
check-layouts:
name: check_layout.output
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- run: python3 check_layout.py
- name: "Fix your layout accordingly or run 'python3 check_layout.py' to promote the warnings"
- name: Check that the generated layouts.xml is uptodate, run python3 gen_layouts.py otherwise
run: git diff --exit-code

View File

@@ -12,5 +12,5 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- run: python3 sync_translations.py
- name: "Check that strings files are uptodate, otherwise run 'python3 sync_translations.py'"
run: git add -N . && git diff --exit-code
- name: Check that strings files are uptodate, run python3 sync_translations.py otherwise
run: git diff --exit-code

1
.gitignore vendored
View File

@@ -10,4 +10,3 @@
/build
# Directory _build is not used anymore
/_build
/release

View File

@@ -10,13 +10,11 @@
</intent-filter>
<meta-data android:name="android.view.im" android:resource="@xml/method"/>
</service>
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:theme="@style/settingsTheme" android:exported="true" android:directBootAware="true">
<activity android:name="juloo.keyboard2.SettingsActivity" android:icon="@mipmap/ic_launcher" android:label="@string/settings_activity_label" android:theme="@style/appTheme" android:exported="true" android:directBootAware="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
</intent-filter>
</activity>
<activity android:name="juloo.keyboard2.LauncherActivity" android:icon="@mipmap/ic_launcher" android:theme="@style/appTheme" android:exported="true" android:directBootAware="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>

View File

@@ -14,7 +14,7 @@ Python 3 is required to update generated files but not to build the app.
For Android Studio users, no more setup is needed.
For Nix users, the right environment can be obtained with `nix-shell ./shell.nix`.
Instructions to install Nix are [here](https://wiki.nixos.org/wiki/Nix_Installation_Guide).
Instructions to install Nix are [here](https://nixos.wiki/wiki/Nix_Installation_Guide).
If you don't use Android Studio or Nix, you have to inform Gradle about the
location of your Android SDK by either:
@@ -110,10 +110,6 @@ Run `./gradlew checkKeyboardLayouts` to check some properties about your
layout. This will change the file `check_layout.output`, which you should
commit.
Layouts are CC0 licensed by default. If you do not want your layout to be
released into the public domain, add a copyright notice at the top of the file
and a mention in `srcs/layouts/LICENSE`.
#### Adding a programming layout
A programming layout must contain all ASCII characters.
@@ -180,7 +176,7 @@ the file and the English strings.
To check that `strings.xml` is formatted correctly, run
`python sync_translations.py`. This will modify your files.
Store descriptions in `fastlane/metadata/android/` are updated automatically.
Store descriptions in `metadata/` are updated automatically.
Translating changelogs is not useful.
The app name might be partially translated, the "Unexpected" word should remain
@@ -190,46 +186,12 @@ As translations need to be updated regularly, you can subscribe to this issue
to receive a notification when an update is needed:
https://github.com/Julow/Unexpected-Keyboard/issues/373
### Adding symbols to Shift, Fn, Compose and other modifiers
### Adding key combinations
New key combinations can be added to builtin modifiers in the following files:
Key combinations are defined in `srcs/juloo.keyboard2/KeyModifier.java`.
For example, keys modified by the `Fn` key are defined in method
`apply_fn_char`.
- Shift in `srcs/compose/shift.json`.
- Fn in `srcs/compose/fn.json`.
- Compose in `srcs/compose/compose/extra.json`.
- Other modifiers are defined in the `accent_*.json` files in `srcs/compose`.
Generated code must then be updated by running:
```
./gradlew compileComposeSequences
```
These files describe each symbols that get transformed when a given modifier is
activated, in JSON format. For example:
Example from `fn.json`, when `Fn` is activated, `<` becomes `«`:
```json
{
"<": "«",
}
```
The result of a sequence can be a key name. See the list of key names in
[doc/Possible-key-values.md](doc/Possible-key-values.md). For example from
`fn.json`, when `Fn` is activated, space becomes `nbsp`:
```json
{
" ": "nbsp",
}
```
Compose sequences are made of several steps. For example, the sequence
`Compose V s = Š` is defined as:
```json
{
"V": {
"s": "Š"
}
}
```
Keys with special meaning are defined in `KeyValue.java` in method
`getKeyByName`. Their special action are defined in `KeyEventHandler.java` in
method `key_up`

View File

@@ -1,3 +0,0 @@
github: [ Julow ]
liberapay: Julow
custom: [ "https://paypal.me/JulesAguillon" ]

View File

@@ -1,4 +1,4 @@
# Unexpected Keyboard [<img src="https://hosted.weblate.org/widget/unexpected-keyboard/svg-badge.svg" alt="État de la traduction" />](https://hosted.weblate.org/engage/unexpected-keyboard/)
# Unexpected Keyboard
[<img src="https://fdroid.gitlab.io/artwork/badge/get-it-on.png"
alt="Get it on F-Droid"
@@ -20,19 +20,12 @@ This application contains no ads, doesn't make any network requests and is Open
Usage: to apply the symbols located in the corners of each key, slide your finger in the direction of the symbols. For example, the Settings are opened by sliding in the left down corner.
| <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/1.png" alt="Screenshot-1" /> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/2.png" alt="Screenshot-2"/> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/3.png" alt="Screenshot-3"/> |
| <img src="/metadata/android/en-US/images/phoneScreenshots/1.png" alt="Screenshot-1" /> | <img src="/metadata/android/en-US/images/phoneScreenshots/2.png" alt="Screenshot-2"/> | <img src="/metadata/android/en-US/images/phoneScreenshots/3.png" alt="Screenshot-3"/> |
| --- | --- | --- |
| <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/4.png" alt="Screenshot-4" /> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/5.png" alt="Screenshot-5" /> | <img src="/fastlane/metadata/android/en-US/images/phoneScreenshots/6.png" alt="Screenshot-6" /> |
## Help translate the application
Improve the application translations [using Weblate](https://hosted.weblate.org/engage/unexpected-keyboard/).
[<img src="https://hosted.weblate.org/widget/unexpected-keyboard/multi-auto.svg" alt="État de la traduction" />](https://hosted.weblate.org/engage/unexpected-keyboard/)
| <img src="/metadata/android/en-US/images/phoneScreenshots/4.png" alt="Screenshot-4" /> | <img src="/metadata/android/en-US/images/phoneScreenshots/5.png" alt="Screenshot-5" /> | <img src="/metadata/android/en-US/images/phoneScreenshots/6.png" alt="Screenshot-6" /> |
## Similar apps
* [Calculator++](https://git.bubu1.eu/Bubu/android-calculatorpp) - Calculator with a similar UX, swipe to corners for advanced math symbols and operators.
* [Calculator++](https://github.com/Bubu/android-calculatorpp) - Calculator with a similar UX, swipe to corners for advanced math symbols and operators. Works up to Android 13 but maybe unmaintained.
## Contributing

Binary file not shown.

View File

@@ -1,36 +1,26 @@
plugins {
id 'com.android.application' version '8.6.0'
}
dependencies {
implementation "androidx.window:window-java:1.3.0"
implementation "androidx.core:core:1.16.0"
testImplementation "junit:junit:4.13.2"
id 'com.android.application' version '8.1.1'
}
android {
namespace 'juloo.keyboard2'
compileSdk 35
compileSdk 33
defaultConfig {
applicationId "juloo.keyboard2"
minSdk 21
targetSdkVersion 35
versionCode 48
versionName "1.31.1"
minSdk 11
targetSdkVersion 33
versionCode 38
versionName "1.26.0"
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['srcs/juloo.keyboard2']
java.srcDirs = ['srcs']
res.srcDirs = ['res', 'build/generated-resources']
assets.srcDirs = ['assets']
}
test {
java.srcDirs = ['test']
}
}
signingConfigs {
@@ -84,8 +74,8 @@ android {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
@@ -94,6 +84,10 @@ android {
}
}
dependencies {
}
tasks.register('buildKeyboardFont') {
println "\nBuilding assets/special_font.ttf"
mkdir "$buildDir"
@@ -110,19 +104,10 @@ tasks.register('buildKeyboardFont') {
}
}
tasks.register('genEmojis') {
println "\nGenerating res/raw/emojis.txt"
exec {
workingDir = projectDir
commandLine "python", "gen_emoji.py"
}
}
tasks.withType(Test).configureEach {
dependsOn 'genLayoutsList'
dependsOn 'checkKeyboardLayouts'
dependsOn 'syncTranslations'
dependsOn 'compileComposeSequences'
}
tasks.register('genLayoutsList') {
@@ -136,8 +121,12 @@ tasks.register('genLayoutsList') {
tasks.register('checkKeyboardLayouts') {
println "\nChecking layouts"
exec {
def layouts = new File(projectDir, "srcs/layouts").listFiles().findAll {
it.name.endsWith(".xml")
}
workingDir = projectDir
commandLine("python", "check_layout.py")
commandLine("python", "check_layout.py", *layouts)
standardOutput = new FileOutputStream("${projectDir}/check_layout.output")
}
}
@@ -149,19 +138,6 @@ tasks.register('syncTranslations') {
}
}
tasks.register('compileComposeSequences') {
def out = "srcs/juloo.keyboard2/ComposeKeyData.java"
println "\nGenerating ${out}"
exec {
def sequences = new File(projectDir, "srcs/compose").listFiles().findAll {
!it.name.endsWith(".py") && !it.name.endsWith(".md")
}
workingDir = projectDir
commandLine("python", "srcs/compose/compile.py", *sequences)
standardOutput = new FileOutputStream("${projectDir}/${out}")
}
}
tasks.named("preBuild") {
dependsOn += "initDebugKeystore"
dependsOn += "copyRawQwertyUS"
@@ -191,7 +167,6 @@ tasks.register('copyLayoutDefinitions')
{
copy {
from "srcs/layouts"
include "*.xml"
into "build/generated-resources/xml"
}
}

View File

@@ -1,22 +1,135 @@
arab_alt: Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~
arab_hamvaj_tly: Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], _, `, {, |, }
arab_pc: Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
arab_pc_ckb: Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ;, <, =, >, ?, `, |, ~
arab_pc_ckb_fa: Layout includes some ASCII punctuation but not all, missing: ", #, $, %, &, ', ,, /, ;, ?, @, \, ^, `, |, ~
arab_pc_hindu: Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
arab_pc_ir: Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, }
beng_national: Layout includes some ASCII punctuation but not all, missing: $
beng_provat: Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, }
cyrl_yaverti: Layout includes some ASCII punctuation but not all, missing: ~
cyrl_yxukeng_os: Layout includes some ASCII punctuation but not all, missing: ", #, $, &, ', @, [, ], ~
deva_alt: Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), *, +, ., /, :, <, =, >, [, \, ], ^, _, `, {, |, }, ~
deva_inscript: Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, |
hebr_1_il: Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
hebr_2_il: Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
kann_kannada: Layout includes some ASCII punctuation but not all, missing: #, $, %, (, ), *, +, /, <, =, >, [, \, ], ^, `, {, |, }, ~
latn_colemak: Some keys contain whitespaces, unexpected: ́
latn_dvorak: Missing important key, missing: loc capslock
latn_neo2: Layout redefines the bottom row but some important keys are missing, missing: loc switch_clipboard
latn_qwertz_cz_multifunctional: Layout includes some ASCII punctuation but not all, missing: `
latn_qwertz_sk: Layout includes some ASCII punctuation but not all, missing: `
urdu_phonetic_ur: Layout includes some ASCII punctuation but not all, missing: <, >, ?, `, |, ~
# arab_alt
Layout includes some ASCII punctuation but not all, missing: !, ", ', +, -, /, :, ;, <, =, >, ?, [, \, ], _, |, ~
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# arab_hamvaj_tly
Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], _, `, {, |, }
Layout doesn't define some important keys, missing: esc, f11_placeholder, f12_placeholder
2 warnings
# arab_pc
Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
1 warnings
# arab_pc_ckb
Layout includes some ASCII punctuation but not all, missing: ", %, ', +, ,, ., :, ;, <, =, >, ?, `, |, ~
1 warnings
# arab_pc_hindu
Layout includes some ASCII punctuation but not all, missing: !, ', +, ;, ?, \, |
1 warnings
# arab_pc_ir
Layout includes some ASCII punctuation but not all, missing: ", %, ', ,, /, ;, <, =, >, ?, [, \, ], `, {, |, }
1 warnings
# armenian_ph_am
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
1 warnings
# beng_national
Layout includes some ASCII punctuation but not all, missing: $
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# beng_provat
Layout includes some ASCII punctuation but not all, missing: $, &, *, ., /, <, >, [, \, ], `, {, |, }
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# cyrl_jcuken_ru
0 warnings
# cyrl_jcuken_uk
0 warnings
# cyrl_ueishsht
0 warnings
# cyrl_yaverti
Layout includes some ASCII punctuation but not all, missing: ~
1 warnings
# deva_alt
Layout includes some ASCII punctuation but not all, missing: #, $, %, &, ', (, ), +, ., /, :, <, =, >, [, \, ], ^, _, `, {, |, }, ~
Layout doesn't define some important keys, missing: esc, f11_placeholder, f12_placeholder, tab
2 warnings
# deva_inscript
Duplicate keys: ।
Layout includes some ASCII punctuation but not all, missing: ", $, ', ^, _, `, |
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
3 warnings
# grek_qwerty
Duplicate keys: ;
1 warnings
# hang_dubeolsik_kr
0 warnings
# hebr_1_il
Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
1 warnings
# hebr_2_il
Layout includes some ASCII punctuation but not all, missing: (, ), <, >, [, ], {, }
1 warnings
# latn_azerty_fr
0 warnings
# latn_bepo_fr
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
1 warnings
# latn_bone
Layout includes some ASCII punctuation but not all, missing: $
Layout redefines the bottom row but some important keys are missing, missing: cursor_left, cursor_right, loc end, loc home, loc page_down, loc page_up, loc switch_greekmath, loc voice_typing, switch_backward
2 warnings
# latn_colemak
Some keys contain whitespaces, unexpected: ́
1 warnings
# latn_dvorak
0 warnings
# latn_neo2
Layout redefines the bottom row but some important keys are missing, missing: loc end, loc home, loc page_down, loc page_up
1 warnings
# latn_qwerty_br
0 warnings
# latn_qwerty_cz
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
1 warnings
# latn_qwerty_es
0 warnings
# latn_qwerty_gb
0 warnings
# latn_qwerty_hu
0 warnings
# latn_qwerty_lv
0 warnings
# latn_qwerty_no
0 warnings
# latn_qwerty_pl
0 warnings
# latn_qwerty_ro
0 warnings
# latn_qwerty_se
Duplicate keys: !, ', ,, -, ., ?
1 warnings
# latn_qwerty_tly
Duplicate keys: a, c, j, q
Layout doesn't define some important keys, missing: esc, f11_placeholder, f12_placeholder, tab
2 warnings
# latn_qwerty_tr
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
1 warnings
# latn_qwerty_us
0 warnings
# latn_qwerty_vi
0 warnings
# latn_qwertz
0 warnings
# latn_qwertz_cz
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
1 warnings
# latn_qwertz_cz_multifunctional
Layout includes some ASCII punctuation but not all, missing: `
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# latn_qwertz_de
0 warnings
# latn_qwertz_fr_ch
0 warnings
# latn_qwertz_hu
0 warnings
# latn_qwertz_sk
Layout includes some ASCII punctuation but not all, missing: `
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
2 warnings
# urdu_phonetic_ur
Duplicate keys:
Layout includes some ASCII punctuation but not all, missing: <, >, ?, `, |, ~
Layout doesn't define some important keys, missing: f11_placeholder, f12_placeholder
Some keys contain whitespaces, unexpected:
4 warnings

View File

@@ -1,26 +1,17 @@
import xml.etree.ElementTree as ET
import sys, os, glob, re
import sys, os
layout_file_name = 0
warnings = []
warning_count = 0
KNOWN_NOT_LAYOUT = set([
"number_row", "numpad", "pin",
"bottom_row", "settings", "method",
"greekmath", "numeric", "emoji_bottom_row",
"clipboard_bottom_row" ])
KEY_ATTRIBUTES = set([
"key0", "key1", "key2", "key3", "key4", "key5", "key6", "key7", "key8",
"c", "nw", "ne", "sw", "se", "w", "e", "n", "s"
])
# Keys defined in KeyValue.java
known_keys = set()
"greekmath", "numeric", "emoji_bottom_row" ])
def warn(msg):
global warnings
warnings.append("%s: %s" % (layout_file_name, msg))
global warning_count
print(msg)
warning_count += 1
def key_list_str(keys):
return ", ".join(sorted(list(keys)))
@@ -47,7 +38,7 @@ def unexpected_keys(keys, symbols, msg):
def parse_row_from_et(row, keys, dup):
for key in row:
for attr in key.keys():
if attr in KEY_ATTRIBUTES:
if attr.startswith("key"):
k = key.get(attr).removeprefix("\\")
if k in keys: dup.add(k)
keys.add(k)
@@ -76,7 +67,10 @@ def check_layout(layout):
if len(dup) > 0: warn("Duplicate keys: " + key_list_str(dup))
missing_some_of(keys, "~!@#$%^&*(){}`[]=\\-_;:/.,?<>'\"+|", "ASCII punctuation")
missing_some_of(keys, "0123456789", "digits")
missing_required(keys, ["backspace", "delete"], "Layout doesn't define some important keys")
missing_required(keys,
["esc", "tab", "backspace", "delete",
"f11_placeholder", "f12_placeholder"],
"Layout doesn't define some important keys")
unexpected_keys(keys,
["copy", "paste", "cut", "selectAll", "shareText",
"pasteAsPlainText", "undo", "redo" ],
@@ -88,11 +82,6 @@ def check_layout(layout):
unexpected_keys(keys, [""], "Layout contains empty strings")
unexpected_keys(keys, ["loc"], "Special keyword cannot be a symbol")
unexpected_keys(keys, filter(lambda k: k.strip()!=k, keys), "Some keys contain whitespaces")
unexpected_keys(keys, ["f11_placeholder", "f12_placeholder"], "These keys are now added automatically")
if root.get("script", "latin") == "latin":
missing_required(keys, ["shift", "loc capslock"], "Missing important key")
missing_required(keys, ["loc esc", "loc tab"], "Missing programming keys")
_, bottom_row_keys, _ = parse_row("res/xml/bottom_row.xml")
@@ -106,34 +95,15 @@ def check_layout(layout):
if root.get("script") == None:
warn("Layout doesn't specify a script.")
keys_without_loc = set(( k.removeprefix("loc ") for k in keys ))
# Keys with a len under 3 are often composed characters
special_keys = set(( k for k in keys_without_loc if len(k) > 3 and ":" not in k ))
unknown = special_keys.difference(known_keys)
if len(unknown) > 0:
warn("Layout contains unknown keys: %s" % key_list_str(unknown))
# Fill 'known_keys', which is used for some checks
def parse_known_keys():
global known_keys
with open("srcs/juloo.keyboard2/KeyValue.java", "r") as f:
known_keys = set(
( m.group(1) for m in re.finditer('case "([^"]+)":', f.read()) )
)
parse_known_keys()
for fname in sorted(glob.glob("srcs/layouts/*.xml")):
for fname in sorted(sys.argv[1:]):
layout_id, _ = os.path.splitext(os.path.basename(fname))
if layout_id in KNOWN_NOT_LAYOUT:
continue
layout_file_name = layout_id
layout = parse_layout(fname)
if layout == None:
warn("Not a layout file")
print("Not a layout file: %s" % layout_id)
else:
print("# %s" % layout_id)
warning_count = 0
check_layout(layout)
with open("check_layout.output", "w") as out:
for w in warnings:
print(w, file=out)
print("%d warnings" % warning_count)

View File

@@ -1,156 +0,0 @@
# Custom layouts
You select a key layout for Unexpected Keyboard by calling up the Settings page (swipe the gear icon) and, at the top of the page, either tapping an existing layout or tapping _Add an alternate layout_. This displays a menu of available layouts. You can define your own layout by choosing _Custom layout_ at the bottom of this menu. Unexpected Keyboard now displays code in the XML format. You make changes by replacing this with different code and tapping OK.
We recommend you keep your work in a file outside Unexpected Keyboard (named something like `MyChanges.xml`). If you installed a new version of Unexpected from a different website (with a different signature), then the work you did solely by editing the XML inside Unexpected would be lost.
Put initial contents into your file in one of these ways:
* Copypaste the code Unexpected displays for _Custom layout_.
* Make a copy of one of the built-in layouts found in [`/srcs/layouts`](https://github.com/Julow/Unexpected-Keyboard/tree/master/srcs/layouts).
* Use the [web-based editor](https://unexpected-keyboard-layout-editor.lixquid.com/). Interact with this web page to define keys and swipes and move keys to desired positions, and it will write the XML code for you. You can make the web page put the XML in a text file or copy it to the clipboard.
When you have prepared suitable XML code in one of these ways, copy it to the clipboard and paste it into Unexpected Keyboard.
## XML language overview
A layout XML file comprises tags that start with `<` and end with `>`.
* Every layout file starts with this declaration:
`<?xml version="1.0" encoding="utf-8"?>`
* Certain tags come in pairs—an opening tag and a closing tag—and apply to everything between them.
* The `<keyboard>`...`</keyboard>` pair says that the material between them is the definition of your keyboard. There can be only one of these.
* The `<row>`...`</row>` pair encloses the definition of a single row.
* An optional `<modmap>`...`</modmap>` pair contains instructions if you want to change the behavior of a modifier key such as Shift.
* Stand-alone tags include `<key`...`/>`, which defines a single key.
A tag can have properties, defined using an equals sign and a pair of ASCII double quotes. For example, `<key c="a" />` defines the "a" key. The `c` property of the `key` tag says which key you are defining, and the tag's location inside `<row>`...`</row>` specifies where it will go in the row.
### Example
Here is a complete keyboard file with a single row containing an "a" key on the left and a "b" key on the right:
<?xml version="1.0" encoding="utf-8"?>
<keyboard name="Simple example" script="latin">
<row>
<key c="a" />
<key c="b" />
</row>
</keyboard>
## Keyboard metadata
The `<keyboard>`...`</keyboard>` pair follows the declaration tag and encloses the whole keyboard. The following properties may be used (The first two appear in the example above):
* `name`: The name of the keyboard. The name you specify will appear in the Settings menu. If not present, the layout will just appear as “Custom layout”.
* `script`: The (main) writing system that the keyboard supports. The possible values are `arabic`, `armenian`, `bengali`, `cyrillic`, `devanagari`, `gujarati`, `hangul`, `hebrew`, `latin`, `persian`, `shavian`, and `urdu`. It defaults to `latin`.
* `numpad_script`: The script to use for the numpad. This is useful for scripts where a different, non-ASCII set of numerals is used, like Devanagari and Arabic. It defaults to the same as `script`.
* `bottom_row`: Whether or not to show the built-in bottom row. It accepts `true` or `false`, and defaults to `true`. If your custom layout defines the bottom row, then specify `bottom_row="false"` to disable the built-in bottom row.
+ We recommend your layout use the built-in bottom row, because it is still evolving and your layout will incorporate innovations in future versions. However, to define your own, the current definition of the bottom row is in [bottom_row.xml](https://github.com/Julow/Unexpected-Keyboard/res/xml/bottom_row.xml). You can copypaste this XML into your custom layout as a starting point.
+ Likewise, the current definition of the top (number) row is in [number_row.xml](https://github.com/Julow/Unexpected-Keyboard/res/xml/number_row.xml).
* `embedded_number_row`: Whether the layout has an embedded number row, and thus the "Show number row" setting shouldn't add another one. It accepts `true` or `false`, and defaults to `false`.
* `locale_extra_keys`: Whether Unexpected should add language-dependent extra keys from [method.xml](../res/xml/method.xml) to this layout. It accepts `true` or `false`, and defaults to `true`. To disable these automatic additions, specify `locale_extra_keys="false"`.
## Row
The `<row>`...`</row>` pair encloses one row on the keyboard. It has only one optional property:
* `height`: The height of the row: a positive floating-point value.
A row's default height is 1.0 (one quarter of the keyboard height specified on the Settings menu). The `height` property makes the row taller or shorter than this. For example, if you define a 5-row keyboard but one row has `height="0.7"`, then the keyboard's total height is 4.7 units. If the total is different from 4.0, the keyboard will be taller or shorter than that specified in Settings.
## Key
The `<key />` tag defines a key on the keyboard. Its position in the sequence of keys inside `<row>`...`</row>` indicates its position in the row from left to right. What the key does is defined by optional properties.
### Taps
What the key does when tapped is defined by the optional `c` property. For example, `<key c="a" />` defines the "a" key. Unexpected Keyboard provides a legend in the middle of the key.
When the Shift modifier is tapped, the "a" key becomes the "A" key and the legend temporarily changes. The Fn modifier makes a different change. You can override this behavior with a modmap (see below).
### Swipes
The following optional properties define the effects of swipes:
* `n`, `ne`, `e`, `se`, `s`, `sw`, `w`, `nw`: What the key should do when it is swiped in the direction of that compass point. ("North" means upward and "East" is to the right.)
<TABLE ALIGN=CENTER>
<TR>
<TD STYLE="width: 6em;">nw</TD><TD>n</TD><TD>ne</TD>
</TR>
<TR ALIGN=CENTER>
<TD>w</TD><TD>c</TD><TD>e</TD>
</TR>
<TR>
<TD>sw</TD><TD>s</TD><TD>se</TD>
</TR>
</TABLE>
* `key1` through `key8` is an older way to achieve the same effects. The directions are ordered as follows:
<TABLE ALIGN=CENTER>
<TR>
<TD>key1</TD><TD>key7</TD><TD>key2</TD>
</TR>
<TR>
<TD>key5</TD><TD>key0</TD><TD>key6</TD>
</TR>
<TR>
<TD>key3</TD><TD>key8</TD><TD>key4</TD>
</TR>
</TABLE>
You can define a swipe only once with either compass-point or numeric notation. Unexpected Keyboard automatically puts a small legend in that direction from the center of the key.
* `anticircle`: The key value to send when doing an anti-clockwise gesture on the key.
### Layout
A key may have the following properties to control the row's layout:
* `width`: The width of the key, a positive floating-point value. It defaults to 1.0
* `shift`: How much empty space to add to the left of this key, a non-negative floating-point value. It defaults to 0.0
Normally, a key's width is 1.0 unit. Unexpected Keyboard occupies the full width of the screen, and the row defining the highest number of units (in widths plus shifts) is as wide as the screen. A row whose width is a smaller number of units has empty space on the right.
### Extra legend
* `indication`: An optional extra legend to show under the main label. For example, `<key c="2" indication="ABC" />` displays ABC at the bottom of the 2 key, as on a pinpad or some telephones. If the key also defines a downward swipe with `s` or `key8`, the legends overlap.
### Possible key values
Built-in strings that assign a special function to a key are described in [this page](Possible-key-values.md). For example, `se="copy"` means a southeasterly swipe produces the Copy key. If a key value does not match any of the built-in strings, it outputs that text _verbatim_. For example, `c="a"` simply outputs the letter a.
In a layout, a key value can also start with the `loc` prefix. These are place-holders; the tap or swipe does nothing unless enabled through the "Add keys to keyboard" option in the Settings menu, or implicitly enabled by the language the device is set to use. For example, `ne="loc accent_aigu"` says that a northeast swipe produces the acute accent combinatorial key—if enabled.
## Modmap
The `<modmap>`...`</modmap>` pair encloses custom mappings for modifier keys. The modmap is placed inside the `<keyboard>`...`</keyboard>` pair, but outside any row. A layout can have at most one modmap. It can contain any number of mappings. Each mapping has an `a` property and a `b` property and maps the `a` key to the `b` key. Valid values are listed in [Possible key values](Possible-key-values.md).
The following mappings are supported:
```xml
<shift a="before" b="after" />
```
This means that when the Shift modifier is on, the key `before` is changed into `after`.
```xml
<fn a="before" b="after" />
```
This means that when the Fn modifier is on, the key `before` is changed into `after`.
```xml
<ctrl a="before" b="after" />
```
This means that when the Ctrl modifier is on, the key `before` is changed into `after`. The `<ctrl />` mapping is special in that the Ctrl modifier is applied to `after` after the mapping.
The clockwise circle and the round-trip gestures are affected by both `<shift />` and `<fn />` mappings. The Shift mappings are used first and if that did not modify the key, the Fn mappings are used instead.
### Examples
① Turkish keyboards use the Latin alphabet, but when "i" is shifted, it should produce "İ". This is achieved with the following mapping:
```xml
<shift a="i" b="İ" />
```
② Cyrillic layouts have no V key. A layout can define Ctrl-V with the following mapping:
```xml
<ctrl a="в" b="v" />
```
This maps Ctrl+в to Ctrl+V—not to v.
## Portrait vs. landscape
Unexpected Keyboard remembers *separately* which layout has last been used in portrait and landscape orientation. So you may have one custom layout for portrait orientation, but another custom layout for landscape orientation, and Unexpected Keyboard will switch between them without your intervention.
## Contributing your layout
The Unexpected Keyboard project enthusiastically accepts user contributions, including custom layouts. (See the guidance for layouts at [CONTRIBUTING.md](https://github.com/Julow/Unexpected-Keyboard/blob/master/CONTRIBUTING.md#Adding-a-layout)).
* Submit a layout that has innovations of possible interest to other users at [Unexpected-Keyboard-layouts](https://github.com/Julow/Unexpected-Keyboard-layouts).
* Propose that your layout be included in the set of built-in layouts by making a Pull Request for an addition to [srcs/layouts](https://github.com/Julow/Unexpected-Keyboard/tree/master/srcs/layouts). Please show that such a layout is standard in your locale or has a substantial number of users.

View File

@@ -1,188 +0,0 @@
# Key values
A key value defines what a key on the keyboard does when pressed or swiped.
Key values appear in the following places:
- In custom layouts, they are the value of: the `c` attribute, the compass-point attributes `nw` ... `se`, and the old-style `key0` ... `key8` attributes.
- Internally, they are used in the definition of the "Add keys to the keyboard" setting.
Key values can be any of the following:
- The name of a special key. A complete list of valid special keys follows.
- An arbitrary sequence of characters not containing `:`.
This results in a key that writes the specified characters.
- The syntax `legend:key_def`.
`legend` is the visible legend on the keyboard. It cannot contain `:`.
`key_def` can be:
+ The name of a special key, as listed below.
+ `'string'` An arbitrary string that can contain `:`. `'` can be added to the string as `` \' ``.
+ `keyevent:keycode` An Android keycode. They are listed as `KEYCODE_...` in [KeyEvent](https://developer.android.com/reference/android/view/KeyEvent#summary).
Examples:
+ `⏯:keyevent:85` A play/pause key (which has no effect in most apps).
+ `my@:'my.email@domain.com'` A key that sends an arbitrary string
- A macro, `legend:key_def1,key_def2,...`.
This results in a key with legend `legend` that behaves as if the sequence of `key_def` had been pressed in order.
Examples:
+ `CA:ctrl,a,ctrl,c` A key with legend CA that sends the sequence `ctrl+a`, `ctrl+c`.
+ `Cd:ctrl,backspace` A key with legend Cd that sends the shortcut `ctrl+backspace`.
### Escape codes
When defining a key value, several characters have special effects. If you want a character not to have its usual effect but to be taken literally, you should "escape" it in the usual way for XML:
To get this character... | ...you can type
:---- | :------
A literal newline character, which is different from `enter` and `action` in certain apps. | `\n`
A literal tab character, which is different from `tab` in certain apps. | `\t`
`&` | `&amp;`
`<` | `&lt;`
`>` | `&gt;`
`"` | `&quot;`
The characters `\` (unless followed by n or t), `?`, `#`, and `@` do not need to be escaped when writing custom layouts. When writing a layout to be included in the app (in [srcs/layouts](https://github.com/Julow/Unexpected-Keyboard/tree/master/srcs/layouts)), they are represented by typing `\\`, `\?`, `\#`, and `\@`.
The characters `,` and `:` can be escaped in a key value, using single quotes. For example, this macro defines a key with legend `http` that sends a string containing `:`: `<key c="http:home,'https://'" />` For simplicity, `,` and `:` cannot be escaped in the key legend.
## Modifiers
System modifiers are sent to the app, which can take app-specific action.
Value | Meaning
:---------- | :------
`shift` | System modifier.
`ctrl` | System modifier.
`alt` | System modifier.
`meta` | System modifier. Equivalent to the Windows key.
The other modifiers take effect only within the keyboard.
Value | Meaning
:---------- | :------
`fn` | Activates Fn mode, which assigns letters and symbols to special characters. Example: `fn` `!` = `¡`
`compose` | Compose key. Enables composing characters using Linux-like shortcuts. Example: `Compose` `A` `'` types `Á` (A with acute accent).
`capslock` | Activates and locks Shift.
## App function keys
These keys are sent to apps, which are free to ignore them. The keyboard does not perform editing in response to these keys.
`esc`, `enter`,
`up`, `right`,
`down`, `left`,
`page_up`, `page_down`,
`home`, `end`,
`backspace`, `delete`,
`insert`, `scroll_lock`,
`f1`-`f12`,
`tab`, `copy`,
`paste`, `cut`,
`selectAll`, `pasteAsPlainText`,
`undo`, `redo`
## Keyboard editing actions
In contrast, these keys perform editing on the text without sending anything to the app.
Value | Meaning
:-------------------- | :------
`cursor_left` | Moves the cursor to the left with the slider gesture.
`cursor_right` | Moves the cursor to the right with the slider gesture.
`cursor_up` | Moves the cursor up with the slider gesture. Warning: this might make the cursor leave the text box.
`cursor_down` | Moves the cursor down with the slider gesture. Warning: this might make the cursor leave the text box.
`delete_word` | Delete the word to the left of the cursor.
`forward_delete_word` | Delete the word to the right of the cursor.
The values with `cursor_` are new in v1.31.0. Previous custom layouts specified the slider with `slider="true"`, which should be removed.
## Whitespace
Value | Meaning
:------ | :------
`space` | Space bar.
`nbsp` | Non-breaking space.
`nnbsp` | Narrow non-breaking space.
`zwj` | Zero-width joiner.
`zwnj` | Zero-width non-joiner.
## Other modifiers and diacritics
Value | Meaning
:------------------- | :------
`accent_aigu` | Acute accent. `á`
`accent_caron` | Háček. `č`
`accent_cedille` | Cedilla. `ç`
`accent_circonflexe` | Circumflex. `â`
`accent_grave` | Grave accent. `à`
`accent_macron` | Macron. `ā`
`accent_ring` | Ring accent. `å`
`accent_tilde` | Tilde. `ã`
`accent_trema` | Dieresis/umlaut. `ä`
`accent_ogonek` | Ogonek. `ą`
`accent_dot_above` | Dot accent. `ż` If applied to the lowercase `i`, removes the dot instead for Turkish. `ı`
`accent_double_aigu` | Double acute accent. `ő`
`accent_slash` | Slash through. `ø`
`accent_arrow_right` | Right arrow above, used to denote a vector. `a⃗`
`accent_breve` | Breve. `ă`
`accent_bar` | Bar/strikethrough. `ɨ`
`accent_dot_below` | Dot below. `ạ`
`accent_horn` | Horn accent. `ơ`
`accent_hook_above` | Hook accent. `ả`
`accent_double_grave` | Double grave accent. `ȁ`
`superscript` | Superscript. `ᵃ`
`subscript` | Subscript. `ₐ`
`ordinal` | Turns `a` and `o` into `ª` and `º`.
`arrows` | Turns `1`-`4` and `6`-`9` into arrows.
`box` | Turns `1`-`9`, `0`, and `.` into single-line, thin box-drawing characters.
## Bidirectional
Value | Meaning
:------ | :------
`lrm` | Left-to-right mark.
`rlm` | Right-to-left mark.
`b(`, `b)`, `b[`, `b]`, `b{`, `b}`, `blt`, `bgt` | Sends the bracket characters, but with mirrored key legends for right-to-left languages. (`blt` and `bgt` print `<` and `>` respectively.)
## Hebrew
Keys ending in `_placeholder` are normally hidden unless the Fn key is pressed.
`qamats`, `patah`,
`sheva`, `dagesh`,
`hiriq`, `segol`,
`tsere`, `holam`,
`qubuts`, `hataf_patah`,
`hataf_qamats`, `hataf_segol`,
`shindot`, `shindot_placeholder`,
`sindot`, `sindot_placeholder`,
`geresh`, `gershayim`,
`maqaf`, `rafe`,
`ole`, `ole_placeholder`,
`meteg`, `meteg_placeholder`
## Keyboard behavior keys
Value | Meaning
:--------------------- | :------
`config` | Gear icon; opens Unexpected Keyboard settings.
`switch_text` | Switch to the text layer (main layer).
`switch_numeric` | Switch to the numeric layer.
`switch_emoji` | Switch to the emoji layer.
`switch_back_emoji` | Switch to the text layer from the emoji layer.
`switch_forward` | Change the keyboard layout, as long as Unexpected Keyboard has multiple keyboard layouts enabled in the settings.
`switch_backward` | Change the keyboard layout to the previous one in the list.
`switch_greekmath` | Switch to the Greek & Math Symbols layer.
`switch_clipboard` | Switch to the clipboard pane.
`change_method` | Open the input method picker dialog.
`change_method_prev` | Switch to the previously used input method.
`action` | Performs a special context-sensitive operation related to the Enter key. For example, in the Twitter (X) app, `enter` adds a new line, while `action` posts.
`voice_typing` | Begin voice typing.
`voice_typing_chooser` | Shows a menu where you can choose which voice typing provider to use, then begins voice typing when you make a selection.
`shareText` | Emit a share Intent for the selected text. **Oddity:** This is in CamelCase.
## Unused
These keys are known to do nothing.
`replaceText`, `textAssist`,
`autofill`, `removed`
## Placeholders
These keys are normally hidden unless the Fn modifier is activated.
`f11_placeholder` | `f12_placeholder`

View File

@@ -1,6 +0,0 @@
Hlavní funkcí je možnost psát více znaků posunutím kláves směrem k rohům.
Tato aplikace byla původně navržena pro programátory používající Termux.
Nyní je ideální pro každodenní použití.
Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je Open Source.

View File

@@ -1,6 +0,0 @@
New layouts: QWERTY (Slovak), Gujarati phonetic
Add Linux Compose key to type a variety of characters using known combinations.
Fixed localized numpad and number row.
Many improvements and bug fixes.
Huge thanks to the contributors: @Yogesh-B, @ChasmSolacer, @matthiakl, @Sestowner, @RyanGibb, @BogdanLata, @RetrogisusDEV, @V6lhost, @ErrrorMaxx, @sdrapha, @vedamanavi

View File

@@ -1,11 +0,0 @@
MessagEase and Thumb-Key inspired gestures with the anti-clockwise circle being
completely configurable.
Updated emojis.
Improved Hangul (Korean) support.
Added Danish support.
Improved spacebar slider.
Updated translations.
Various improvements and fixes to the app and layouts.
Many thanks to the contributors: @alotbsol555 @bkmgit @Cheesebaron @CloneWith @eandersons @JapanYoshi @Julow @la-ninpre @m15a @marciozomb13 @polyctena @solokot @Spike-from-NH @tmqCypher @Validbit

View File

@@ -1,8 +0,0 @@
Clipboard pane
New Monet theme
Improvements to custom layouts
Options to disable key repeat and the circle gesture
Options to disable the Tab and Esc keys
Many thanks to the contributors: @alotbsol555 @ChasmSolacer @eandersons @polyctena @Sestowner @solokot @Spike-from-NH @TadaCZE @V6lhost @Validbit

View File

@@ -1,6 +0,0 @@
Fix crash on Android 6.
Fix scaling issues for layouts with few columns.
Added Serbian layouts.
Layout and compose key tweaks. Improvements to custom layouts. Added Menu key.
Many thanks to the contributors: @adrian4096 @asivery @bokidori @dingodoppelt @RZHSSNZDH

View File

@@ -1,14 +0,0 @@
New supported languages: Albanian, Belgian, Estonian, Georgian, Hawaiian,
Irish, Kannada, Kazakh, Old Church Slavonic, Serbian, Tajiki, Tamil, Welsh
Added WORKMAN (US) layout.
Improved layouts for modern Hindi and Sanskrit, Greek, Kurdish, Persian, Czech.
New compose sequences and added combining diacritic keys.
New and improved themes.
Many bug fixes and improvements.
Many thanks to the contributors: @anaskaejdar @bokidori @cknight828 @cuhsy
@Danger-Mkh @DocJr90 @IYO-OYI @kalankaboom @Kxeo @marciozomb13 @ms-jagadeeshan
@npnpatidar @ptitgnu @quantenzitrone @Sestowner @solokot @Spike-from-NH
@tenextractor

View File

@@ -1 +0,0 @@
Bug fixes

View File

@@ -1 +0,0 @@
Bug fixes

View File

@@ -1 +0,0 @@
Bug fixes

View File

@@ -1,8 +0,0 @@
Delete a word with a circle gesture on the delete key.
Compose key can be unselected.
Improved space bar slider and added selection mode.
Lock shift with a circle gesture.
Improvements to layouts.
Various bug fixes and improvements to themes.
Huge thanks to the contributors: @0skar2 @chuckwagoncomputing @dzaima @eandersons Lokesh Kumar @lrvideckis @ms-jagadeeshan @quantenzitrone @Sestowner @solokot @Spike-from-NH @srikanban @tenextractor

View File

@@ -1,9 +0,0 @@
Bug fixes
Delete a word with a circle gesture on the delete key.
Compose key can be unselected.
Improved space bar slider and added selection mode.
Lock shift with a circle gesture.
Various bug fixes and improvements to themes and layouts.
Many thanks to the contributors: @HaleyHalcyon @Jaoheah @Spike-from-NH

View File

@@ -1,7 +0,0 @@
このキーボードは、キーの角をスワイプすることで様々なキーを入力できます。
このアプリは元々はTermuxでのプログラミング用に設計されました。
しかし、今では普段の入力にも適しています。
PCキーボードでの半角入力を再現しています。日本語入力、変換は出来ません。
このアプリは広告を含まず、インターネットに接続せず、そしてオープンソースです。

View File

@@ -1 +0,0 @@
軽量でプライバシーに配慮したAndroid用仮想キーボード

View File

@@ -1,6 +0,0 @@
주요 기능은 모서리 방향으로 키를 스와이프하여 더 많은 문자를 입력할 수 있다는 것입니다.
이 앱은 처음에는 Termux를 사용하는 프로그래머들을 위한 것으로 개발되었습니다.
지금은 일상적인 용도로도 완벽합니다.
이 응용 프로그램에는 광고가 없으며 네트워크 요청을 하지 않고 오픈 소스입니다.

View File

@@ -1,6 +0,0 @@
A principal característica é que você pode digitar mais caracteres deslizando as teclas para os cantos.
O app foi criado originalmente para desenvolvedores que usam Termux.
Agora aperfeiçoado para o uso diário.
Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e é Open Source.

View File

@@ -1,6 +0,0 @@
Главная особенность клавиатуры — это возможность легко напечатать любой ASCII-символ жестами в углы клавиш.
Приложение изначально было разработано для использования с Termux.
На данный момент оно также удобно в повседневном использовании.
Приложение не содержит рекламы, не осуществляет никаких запросов в сеть и имеет открытый исходный код.

View File

@@ -1,6 +0,0 @@
Головна особливість полягає в тому, що ви можете вводити більше символів, проводячи клавіші до кутів.
Ця програма спочатку була розроблена для програмістів, які використовують Termux.
Тепер ідеально підходить для щоденного використання.
Ця програма не містить реклами, не надсилає жодних мережевих запитів і має відкритий код.

View File

@@ -1 +0,0 @@
Легка та конфіденційна віртуальна клавіатура для Android.

View File

@@ -1,6 +0,0 @@
此应用的主要功能是,通过将按键沿四角滑动,您可以输入更多字符。
此应用最初是为使用 Termux 的程序员而设计的。
现在对于日常使用来说也很完美。
此应用没有广告,不会发送任何网络请求,而且是开源的。

View File

@@ -1 +0,0 @@
适用于 Android 的轻量级、注重隐私的虚拟键盘。

View File

@@ -1 +0,0 @@
Unexpected Keyboard

View File

@@ -1,38 +0,0 @@
import urllib.request
import os.path
EMOJIS_PATH = 'res/raw/emojis.txt'
EMOJI_TEST_PATH = 'emoji-test.txt'
EMOJI_TEST_URL = 'https://unicode.org/Public/emoji/latest/emoji-test.txt'
def rawEmojiFromCodes(codes):
return ''.join([chr(int(c, 16)) for c in codes])
def getEmojiTestContents():
if os.path.exists(EMOJI_TEST_PATH):
print(f'Using existing {EMOJI_TEST_PATH}')
else:
print(f'Downloading {EMOJI_TEST_URL}')
urllib.request.urlretrieve(EMOJI_TEST_URL, EMOJI_TEST_PATH)
return open(EMOJI_TEST_PATH, mode='r', encoding='UTF-8').read()
emoji_list = []
group_indices = []
for line in getEmojiTestContents().splitlines():
if line.startswith('# group:'):
if len(group_indices) == 0 or len(emoji_list) > group_indices[-1]:
group_indices.append(len(emoji_list))
elif not line.startswith('#') and 'fully-qualified' in line:
codes = line.split(';')[0].split()
emoji_list.append(rawEmojiFromCodes(codes))
with open(EMOJIS_PATH, 'w', encoding='UTF-8') as emojis:
for e in emoji_list:
emojis.write(f'{e}\n')
emojis.write('\n')
emojis.write(' '.join([str(g) for g in group_indices]))
emojis.write('\n')
print(f'Parsed {len(emoji_list)} emojis in {len(group_indices)}')

View File

@@ -52,7 +52,7 @@ def generate_arrays(out, layouts):
values_items, entries_items = zip(*(system_item + layouts + custom_item)) # unzip
ids_items = map(lambda s: "@xml/%s" % s if s not in ["system", "custom"] else "-1", values_items)
root = XML.Element("resources")
root.append(XML.Comment(text=" DO NOT EDIT. This file is generated, run 'gradle genLayoutsList'. "))
root.append(XML.Comment(text="DO NOT EDIT. This file is generated, see gen_layouts.py."))
root.append(mk_array("string-array", "pref_layout_values", values_items))
root.append(mk_array("string-array", "pref_layout_entries", entries_items))
root.append(mk_array("integer-array", "layout_ids", ids_items))

View File

@@ -1,524 +0,0 @@
#! /bin/env python3
"""
Script to generate a layout based on an existing.
Tuned to create Sinhala phonetic layout based on qwerty (US), but may be adoped
for other scripts. Look at dicts before the LayoutBuilder code.
Usage:
python3 gen_sinhala_phonetic_layout [-h|--help] [-v|--verbose] [-o|--output]
By default with no args will write to corresponding file in `srcs/layouts/`.
Script uses central symbol (in direction "c") to identify a key, which may not
be appropriate for base (reference) layouts other, than qwerty (US).
Warning will be printed to stderr if new symbol overrides some symbol of the
reference layout in directions other, than "c".
Exception will be rised on other
conflicts e. g. when trying to move a symbol into occupied position.
- Made with latn_qwerty_us.xml from commit `6b1551d`
- Made with Python 3.13
- Requires Python >= 3.11
"""
import argparse
import logging
from enum import StrEnum
from pathlib import Path
from xml.etree import ElementTree
class Placement(StrEnum):
C = 'c'
NW = 'nw'
N = 'n'
NE = 'ne'
E = 'e'
SE = 'se'
S = 's'
SW = 'sw'
W = 'w'
# Based on XKB Sinhala (phonetic)
KEYS_MAP: dict[str, tuple[str, str, str, str]] = {
# Row 1 ###########################################
'q': ('', '', '\u0DD8', '\u0DF2'),
'w': ('', '', '\u0DD0', '\u0DD1'),
'e': ('', '', '\u0DD9', '\u0DDA'),
'r': ('', '', '', ''), # In XKB virama is on layer 2
't': ('', '', '', ''),
'y': ('', '', '', ''), # In XKB virama is on layer 2
'u': ('', '', '\u0DD4', '\u0DD6'),
'i': ('', '', '\u0DD2', '\u0DD3'),
'o': ('', '', '\u0DDC', '\u0DDD'),
'p': ('', '', '', ''),
# Row 2 ###########################################
'a': ('', '', '\u0DCA', '\u0DCF'),
's': ('', '', '', ''),
'd': ('', '', '', ''),
'f': ('', '\u0D93', '', '\u0DDB'), # In XKB aiyanna placed otherwise
'g': ('', '', '', ''),
'h': ('', '\u0D83', '\u0DDE', ''),
'j': ('', '', '', ''),
'k': ('', '', '', ''),
'l': ('', '', '\u0DDF', '\u0DF3'),
# Row 3 ###########################################
'z': ('', '', '', ''), # In XKB contains bar, broken bar
'x': ('', '', '', ''),
'c': ('', '', '', ''),
'v': ('', '', '', ''),
'b': ('', '', '', ''),
'n': ('', '', '\u0D82', ''),
'm': ('', '', '', ''),
}
# How to place four levels of Key.
# Syntax: LEVEL: PLACEMENT | 'FROM_LEVEL+MODIFIER'
# The last means symbol on level FROM_LEVEL with modifier key MODIFIER gives
# key on level LEVEL
#
LEVELS_MAP = {
0: Placement.C,
1: Placement.NE,
2: '0+shift',
3: '1+shift',
}
# Additional modify keys combinations.
# Syntax:
# MODKEY: { A: B }
#
MODMAP_EXTRA: dict[str, dict[str, str]] = {
'shift': {
# Astrological numbers
'1': '',
'2': '',
'3': '',
'4': '',
'5': '',
'6': '',
'7': '',
'8': '',
'9': '',
'0': '',
# Kunddaliya
'.': '',
# Extra broken bar intead z key in XKB
'\u007C': '\u00A6',
# Special whitespaces
'zwj': 'zwnj',
},
'fn': {
# Sinhala archaic digits
'': '𑇡', # 1
'': '𑇢', # 2
'': '𑇣', # 3
'': '𑇤', # 4
'': '𑇥', # 5
'': '𑇦', # 6
'': '𑇧', # 7
'': '𑇨', # 8
'': '𑇩', # 9
'': '𑇪', # 10
'': '𑇫', # 20
'': '𑇬', # 30
'': '𑇭', # 40
'': '𑇮', # 50
'': '𑇯', # 60
'': '𑇰', # 70
'': '𑇱', # 80
'': '𑇲', # 90
'': '𑇳', # 100
'': '𑇴', # 1000
# Sinhala candrabindu for Sanskrit
'': '\u0D81',
},
}
# Table to move additional characters in reference layout.
# Format is (CENTRAL_CHAR, PLACEMENT): (CENTRAL_CHAR, PLACEMENT). E. g. to move
# char from key with central character "q", direction "se" to key with central
# character "w", direction "sw", add line:
# ('q', Placement.SE): ('w', Placement.SW),
#
# To delete a char, use None as destination placement. E.g.:
# ('q', Placment.SE): ('q', None)
#
# Moving of main char in central placement is not supported.
#
TRANSITIONS_MAP: dict[tuple[str, Placement], tuple[str, Placement | None]] = {
('q', Placement.SE): ('q', Placement.SW), # loc esc
('q', Placement.NE): ('q', Placement.SE), # 1
('w', Placement.NE): ('w', Placement.SE), # 2
('e', Placement.SE): ('r', Placement.NW), # loc €
('e', Placement.NE): ('e', Placement.SE), # 3
('r', Placement.NE): ('r', Placement.SE), # 4
('t', Placement.NE): ('t', Placement.SE), # 5
('y', Placement.NE): ('y', Placement.SE), # 6
('u', Placement.NE): ('u', Placement.SE), # 7
('i', Placement.NE): ('i', Placement.SE), # 8
('o', Placement.SE): ('p', Placement.SW), # )
('o', Placement.NE): ('o', Placement.SE), # 9
('p', Placement.NE): ('p', Placement.SE), # 0
('a', Placement.NE): ('a', Placement.NW), # `
('a', Placement.NW): ('a', Placement.SW), # loc tab
('s', Placement.NE): ('s', Placement.NW), # loc §
('g', Placement.SW): ('g', Placement.NW), # _
('g', Placement.NE): ('g', Placement.SW), # -
('h', Placement.SW): ('h', Placement.NW), # +
('h', Placement.NE): ('h', Placement.SW), # =
('l', Placement.NE): ('l', Placement.NW), # |
('x', Placement.NE): ('x', Placement.NW), # loc †
('c', Placement.NE): ('c', Placement.NW), # <
('b', Placement.NE): ('b', Placement.NW), # ?
('n', Placement.NE): ('n', Placement.NW), # :
('m', Placement.NE): ('m', Placement.NW), # "
}
# Add additional characters to arbitrary places.
# Syntax is CHAR: POSITION, where POSITION is a pari as in TRANSITIONS_MAP.
#
CHARS_EXTRA = {
# In XKB ZWJ is on `/` key, and ZWNJ is on spacebar
'zwj': ('m', Placement.SE),
}
# List of char unicode numbers and inclusive ranges of numbers to encode as XML
# numeric character references.
# Good for combining signs to not mess with quotes.
# Characters in line of the keyboard tag will not be escaped.
#
ESCAPE_LIST: list[int | tuple[int, int]] = [
# Sinhalese diacritics
(0xD81, 0xD83),
(0xDCA, 0xDDF),
]
# Default filename. Output path can be overrided with `-o` flag also.
LAYOUT_FILENAME = 'sinhala_phonetic.xml'
# Will be placed after XML declaration. Need to have proper <!-- --> tags.
COMMENT = '''
<!-- This file defines Sinhala layout.
Based on XKB Sinhala (phonetic) layout.
-->
'''
BASE_DIR = Path(__file__).parent
REFERENCE_LAYOUT_FILE = BASE_DIR / 'srcs/layouts/latn_qwerty_us.xml'
LOGGER = logging.getLogger(__name__)
KeysMapType = list[list[ElementTree.Element]]
class LayoutGenError(RuntimeError):
...
def xml_elem_to_str(element: ElementTree.Element) -> str:
return ElementTree.tostring(
element,
xml_declaration=False,
encoding='unicode').strip()
def keys_map_to_str(keys_map: KeysMapType) -> str:
""" Make laout rows map printable for debug purposes """
result = '[\n'
for row in keys_map:
result += ' ' * 4
for key in row:
result += str(key.attrib) + ', '
result += '\n'
result += ']'
return result
def is_in_escape_list(char: str | int) -> bool:
if isinstance(char, str):
char = ord(char)
for item in ESCAPE_LIST:
if isinstance(item, tuple) and char >= item[0] and char <= item[1]:
return True
elif isinstance(item, int):
if char == item:
return True
else:
TypeError(f'Unexpected item {item} of ESCAPE_LIST')
return False
def xml_encode_char(ch: str | int) -> str:
if isinstance(ch, str):
ch = ord(ch)
hex_val = hex(ch).split('x')[-1]
return f'&#x{hex_val.upper().zfill(4)};'
class LayoutBuilder:
XML_DECLARATION = "<?xml version='1.0' encoding='utf-8'?>"
def __init__(
self,
name: str = '',
script: str = '',
numpad_script: str = '',
comment: str = '',
) -> None:
"""
:param comment: MUST be a valid XML comment wrapped in <!-- tags -->
"""
attrs = {}
if name:
attrs['name'] = name
if script:
attrs['script'] = script
if numpad_script:
attrs['numpad_script'] = numpad_script
self._comment = None
if comment:
self._comment = comment.strip() or None
self._xml_keyboard = ElementTree.Element('keyboard', attrib=attrs)
self._modmap = ElementTree.Element('modmap')
@staticmethod
def _parse_reference_layout() -> list[ElementTree.Element]:
return ElementTree.parse(REFERENCE_LAYOUT_FILE).findall('row')
@staticmethod
def _move_untransited_to_new_map(
ref_map: KeysMapType,
new_map: KeysMapType
) -> None:
coordinates = [
(row_num, key_num)
for row_num in range(len(ref_map))
for key_num in range(len(ref_map[row_num]))
]
for row_num, key_num in coordinates:
old_key = ref_map[row_num][key_num]
new_key = new_map[row_num][key_num]
for k, val in old_key.attrib.items():
if (transited := new_key.attrib.get(k)) is not None:
msg = (
f'Transition of {transited} to'
f' {new_key.get(Placement.C)}:{k} conflictls with'
f' existing value "{val}"')
raise LayoutGenError(msg)
new_key.set(k, val)
@staticmethod
def _add_extra_chars_to_ref_map(
coord_map: dict[str, tuple[int, int]],
new_map: KeysMapType
) -> None:
for char, (to_key_name, to_plc) in CHARS_EXTRA.items():
if not (to_coord := coord_map.get(to_key_name)):
msg = f'Trying to add "{char}" to missing key "{to_key_name}"'
raise LayoutGenError(msg)
row_num, key_num = to_coord
key = new_map[row_num][key_num]
if (existing := key.get(to_plc)) is not None:
msg = f'Trying to add char to <{to_key_name}:{to_plc}>, but already contains "{existing}"'
raise LayoutGenError(msg)
key.set(to_plc, char)
LOGGER.info(
'Added "%s" to <%s:%s>',
char, to_key_name, to_plc)
@classmethod
def _apply_transitions(cls, ref_map: list) -> list:
coord_map: dict[str, tuple[int, int]] = {}
coordinates = [
(row_num, key_num)
for row_num in range(len(ref_map))
for key_num in range(len(ref_map[row_num]))
]
for row_num, key_num in coordinates:
row = ref_map[row_num]
key = row[key_num]
key_name = key.get(Placement.C)
if key_name in coord_map:
msg = f'Duplicated value "{key_name}" in central position'
raise LayoutGenError(msg)
coord_map[key_name] = (row_num, key_num)
# Make new map with empty keys
result_map = [[ElementTree.Element('key') for key in row] for row in ref_map]
# Place by transitions map on new places
for (from_key_name, from_plc), (to_key_name, to_plc) in TRANSITIONS_MAP.items():
if Placement.C in (from_plc, to_plc):
raise NotImplementedError('Transition from or to placment "c"')
if not (from_coord := coord_map.get(from_key_name)):
raise LayoutGenError(f'Transition from missing key {from_key_name}')
if not (to_coord := coord_map.get(to_key_name)):
raise LayoutGenError(f'Transition to missing key {to_key_name}')
from_key = ref_map[from_coord[0]][from_coord[1]]
to_key = result_map[to_coord[0]][to_coord[1]]
try:
val = from_key.attrib.pop(from_plc)
except KeyError:
msg = f'No value in key {from_key_name}, placement {from_plc} to move'
raise LayoutGenError(msg)
if to_plc is not None:
if to_key.get(to_plc):
msg = f'Second transition to key {to_key_name}, placement {to_plc}'
raise LayoutGenError(msg)
to_key.set(to_plc, val)
LOGGER.info(
'Moved "%s" from <%s:%s> to <%s:%s>',
val, from_key_name, from_plc, to_key_name, to_plc)
else:
LOGGER.info(
'Deleted "%s" from <%s:%s>',
val, from_key_name, from_plc)
# Fill new map with other values
cls._move_untransited_to_new_map(ref_map, new_map=result_map)
# Add additional characters
cls._add_extra_chars_to_ref_map(coord_map, new_map=result_map)
return result_map
@staticmethod
def _resolve_placement(
key: ElementTree.Element,
placement: Placement,
new_char: str
) -> None:
if placement != Placement.C:
central_char = key.get(Placement.C)
existing = key.get(placement)
if existing:
LOGGER.warning(
'Placement %s of key %s already occupied with %s',
placement, central_char, existing)
key.set(placement, new_char)
def _process_key(self, key: ElementTree.Element) -> ElementTree.Element:
central_char = key.get(Placement.C)
if not central_char:
return key
new_key_entry = KEYS_MAP.get(central_char)
if new_key_entry is None:
return key
for level, placement_spec in LEVELS_MAP.items():
if not (new_char := new_key_entry[level]):
continue
if '+' in placement_spec:
pair = placement_spec.split('+')
from_level, modkey = int(pair[0]), pair[1]
key_a = new_key_entry[from_level]
key_b = new_char
if key_a is None:
raise LayoutGenError(f'Tried to modife {key_a} to {key_b}')
ElementTree.SubElement(self._modmap, modkey, a=key_a, b=key_b)
else:
placement = Placement(placement_spec)
self._resolve_placement(key, placement=placement, new_char=new_char)
return key
@staticmethod
def _make_extra_modmap(modmap: ElementTree.Element) -> ElementTree.Element:
for modkey, ab_map in MODMAP_EXTRA.items():
for a, b in ab_map.items():
LOGGER.info('Adding modmap %s "%s" -> "%s"', modkey, a, b)
ElementTree.SubElement(modmap, modkey, a=a, b=b)
return modmap
@staticmethod
def _post_escape(data: str) -> str:
buf = ''
lines = data.splitlines(keepends=True)
for line in lines:
# Skip keyboard tag line to keep attributes
if '<keyboard ' in line:
buf += line
continue
for ch in line:
if is_in_escape_list(ch):
ch = xml_encode_char(ch)
buf += ch
return buf
def build(self) -> None:
raw_ref_rows = self._parse_reference_layout()
ref_rows = self._apply_transitions(raw_ref_rows)
for row in ref_rows:
new_row = ElementTree.SubElement(self._xml_keyboard, 'row')
for key in row:
LOGGER.debug(
'Processing reference entry %s',
xml_elem_to_str(key))
new_row.append(self._process_key(key))
self._modmap = self._make_extra_modmap(self._modmap)
self._xml_keyboard.append(self._modmap)
def get_xml(self) -> str:
ElementTree.indent(self._xml_keyboard)
body_raw = xml_elem_to_str(self._xml_keyboard)
body = self._post_escape(body_raw)
result = self.XML_DECLARATION + '\n'
if self._comment:
result += self._comment + '\n'
result += body + '\n'
return result
def get_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
prog='gen_sinhala_phonetic_layout',
description='Generate XKB-based Sinhala layout',)
parser.add_argument(
'-o',
'--output',
default=BASE_DIR / f'srcs/layouts/{LAYOUT_FILENAME}',
help='File to write result, `-` for stdout')
parser.add_argument(
'-v',
'--verbose',
help='More verbose logging',
action='store_true')
return parser.parse_args()
if __name__ == '__main__':
args = get_args()
logging.basicConfig(
level=logging.DEBUG if args.verbose else logging.WARNING,
format='%(levelname)s: %(message)s')
builder = LayoutBuilder(name='සිංහල', script='sinhala', comment=COMMENT)
builder.build()
content = builder.get_xml()
if args.output == '-':
print(content)
else:
with open(args.output, 'w') as file:
file.write(content)

View File

@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Dfile.encoding=UTF-8
android.useAndroidX=true
android.nonTransitiveRClass=true
android.useAndroidX=false
android.nonTransitiveRClass=true

View File

@@ -1,6 +1,6 @@
#Mon Aug 21 18:13:41 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@@ -0,0 +1,18 @@
Tato aplikace je virtuální klávesnící pro Android. Umožňuje rychlejší a plynulejší psaní písmen i symbolů (vč. diakritiky), a to ve vícero jazycích a vlastních rozloženích. To vše zdarma, bez reklam a bez plýtvání vašeho uložiště. Můžete psát libovolné znaky pomocí gest (ASCII i Unicode), používat mrtvé (univerzální) klávesy pro diakritická znaménka a mnohem více.
Klávesnice zobrazuje až 4 další znaky v rozích každé klávesy. Tyto znaky jsou vyvolány přejetím prstu do vybraného rohu.
No zkrátka...:
- Obsahuje každý znak a speciální klávesu, která je běžnou součástí počítačové klávesnice. To přijde vhod obzvláště při používání aplikací jako např. Termux
- Můžete používat modifikační klávesy, obohaceny o speciální klávesy (např. Tab, Esc, šipky, F klávesy, ale také Ctrl nebo Alt !)
- Můžete psát vícero jazyky rychleji a bez chyb. Diakritická znaménka mohou být vyvolána i za pomocí mrtvých kláves. Nejdříve zvolte diakritické znaménko a pak znak, který chcete obohatit o toto znaménko.
- Je vysoce nenáročná a rychlá. Zabere 500x méně místa než klávesnice od Googlu (Gboard) a 15x méně než výchozí klávesnice systému. Bez reklam, bez sledování.
- Má vícero rozložení: QWERTY, QWERTZ, AZERTY. Motivy: Bílá, Tmavá, OLED Černá. A mnoho dalších které si s drobnou znalostí programování můžete upravovat dle libosti.
Nezapomeňte... Jako každá virtuální klávesnice, i tato musí být aktivována v nastavení systému (zařízení). Otevřte (Systémové) Nastavení a přejděte na:
(Další nastavení NEBO Nastavení systému) > Jazyk & způsob zadávání > Spravovat klávesnice.

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1 @@
صفحه کلید غیرمنتظره

View File

@@ -0,0 +1,18 @@
이 앱은 안드로이드용 가상 키보드입니다. 주요 기능은 스와이프 제스처를 사용하여 모든 ASCII 문자를 쉽게 입력할 수 있다는 점과 악센트 및 수정자 키를 위한 데드 키와 특수 키(tab, esc, 방향키 등)이 있다는 것입니다.
키보드는 각 키의 모서리에 최대 4개의 추가 문자를 표시합니다. 이러한 추가 문자는 키에서 손가락을 스와이프하여 적중됩니다.
일부 하이라이트 기능:
- PC 키보드에서 사용할 수 있는 모든 문자 및 특수 키를 사요 가능합니다. 이것은 Termux와 같은 앱을 사용하는 데 효과적입니다.
- 여기에는 Tab, Esc, 방향키 및 function 키뿐만이 아닌 Ctrl 및 Alt 키도 포함되어 있습니다 !
- 악센트 키는 데드 키를 사용하여 액세스할 수 있습니다. 먼저 악센트 키를 활성화한 다음 악센트 문자를 입력합니다.
- 매우 가볍고 빠릅니다. Google 키보드보다 500배, 기본 키보드보다 15배 적은 공간을 사용합니다. 광고와 사용 기록 추적 없음.
- 다중 레이아웃: QWERTY, QWERTZ, AZERTY. 다양한 테마: White, Dark, OLED Black. 또한 다른 많은 옵션들.
다른 가상 키보드와 마찬가지로 시스템 설정에서 활성화해야 합니다. 시스템 설정을 열고 다음으로 이동합니다.
시스템 > 언어 및 입력 > 키보드 > 키보드 관리.

Some files were not shown because too many files have changed in this diff Show More