Created
July 19, 2025 11:57
-
-
Save kokoye2007/464f47e64a3305dde25ed3e4c1c01cd7 to your computer and use it in GitHub Desktop.
ksw_MM - Karen Kawthoolei - iBus Keyboard Installer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# KNU Kawthoolei | |
# ksw_MM | |
# kar | |
# maintainer: [email protected] | |
set -e | |
# Detect package manager | |
detect_pkg_mgr() { | |
if command -v apt &>/dev/null; then | |
echo "apt" | |
elif command -v dnf &>/dev/null; then | |
echo "dnf" | |
elif command -v pacman &>/dev/null; then | |
echo "pacman" | |
elif command -v zypper &>/dev/null; then | |
echo "zypper" | |
else | |
echo "Unsupported" | |
fi | |
} | |
# Install required packages | |
install_packages() { | |
PKG_MGR=$(detect_pkg_mgr) | |
echo "Detected package manager: $PKG_MGR" | |
case $PKG_MGR in | |
apt) | |
sudo apt update | |
sudo apt install -y ibus ibus-table | |
;; | |
dnf) | |
sudo dnf install -y ibus ibus-table | |
;; | |
pacman) | |
sudo pacman -Sy --noconfirm ibus ibus-table | |
;; | |
zypper) | |
sudo zypper install -y ibus ibus-table | |
;; | |
*) | |
echo "❌ Unsupported package manager. Please install ibus and ibus-table manually." | |
exit 1 | |
;; | |
esac | |
} | |
# Check for ibus and ibus-table | |
if ! command -v ibus &> /dev/null || ! command -v ibus-table-createdb &> /dev/null; then | |
echo "Installing required packages..." | |
install_packages | |
fi | |
# 3. System-wide install | |
TABLE_DIR="/usr/share/ibus-table/tables" | |
DB_NAME="ksw-kawthoolei" | |
# Create DB TXT file | |
cat > $DB_NAME.txt << 'EOF' | |
### File header must not be modified | |
### This file must be encoded into UTF-8. | |
### This file comes from xcin module. | |
SCIM_Generic_Table_Phrase_Library_TEXT | |
VERSION_1_0 | |
### Begin Table definition. | |
BEGIN_DEFINITION | |
UUID = f0404535-2167-4133-b3d3-0e6739a230cd | |
SERIAL_NUMBER = 20250719 | |
ICON = kawthoolei.svg | |
NAME = Kawthoolei | |
LANGUAGES = ksw_MM | |
AUTHOR = KNU | |
STATUS_PROMPT = KSW | |
AUTO_SELECT = TRUE | |
AUTO_WILDCARD = FALSE | |
AUTO_COMMIT = TRUE | |
AUTO_SPLIT = FALSE | |
DYNAMIC_ADJUST = FALSE | |
AUTO_FILL = FALSE | |
ALWAYS_SHOW_LOOKUP = FALSE | |
NEVER_SHOW_LOOKUP = TRUE | |
DISCARD_INVALID_KEY = FALSE | |
DEF_FULL_WIDTH_PUNCT = FALSE | |
DEF_FULL_WIDTH_LETTER = FALSE | |
MAX_KEY_LENGTH = 4 | |
SHOW_KEY_PROMPT = TRUE | |
USER_CAN_DEFINE_PHRASE = FALSE | |
PINYIN_MODE = FALSE | |
VALID_INPUT_CHARS = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890&*[]\{{}}|;':",.<>` | |
BEGIN_CHAR_PROMPTS_DEFINITION | |
a ဒ် | |
b ဘ | |
c ခ | |
d ိ | |
e န | |
f ် | |
g ါ | |
h ့ | |
i င | |
j ြ | |
k ု | |
l ူ | |
m ၥ် | |
n ည | |
o သ | |
p စ | |
q ဆ | |
r မ | |
s ျ | |
t အ | |
u က | |
v လ | |
w တ | |
x ထ | |
y ပ | |
z ဖ | |
A မ် | |
B ှ့ | |
C ဃ | |
D ီ | |
E ၢၢ် | |
F ၠ | |
G ွ | |
H ံ | |
I . | |
J ဲ | |
K ဒ | |
L လီၤ | |
M န့ၣ် | |
N ၥ | |
O ှု | |
P ၦ | |
Q ၡ | |
R ၤ | |
S ှ | |
T ၢၥ် | |
U ွ့ | |
V ျ့ | |
W ဝ | |
X ၢ | |
Y ၢၣ် | |
Z ဇ | |
1 ၁ | |
2 ၂ | |
3 ၃ | |
4 ၄ | |
5 ၅ | |
6 ၆ | |
7 ၇ | |
8 ၈ | |
9 ၉ | |
0 ၀ | |
& ရ | |
* ဂ | |
[ ဟ | |
] ၜ | |
\ ' | |
{{ ဧ | |
}} ✩ | |
| " | |
; း | |
' ၊ | |
: ဒီး | |
" ။ | |
, ယ | |
. ၣ် | |
< , | |
> ၢ် | |
END_CHAR_PROMPTS_DEFINITION | |
END_DEFINITION | |
BEGIN_TABLE | |
a ဒ် 1000 | |
b ဘ 1000 | |
c ခ 1000 | |
d ိ 1000 | |
e န 1000 | |
f ် 1000 | |
g ါ 1000 | |
h ့ 1000 | |
i င 1000 | |
j ြ 1000 | |
k ု 1000 | |
l ူ 1000 | |
m ၥ် 1000 | |
n ည 1000 | |
o သ 1000 | |
p စ 1000 | |
q ဆ 1000 | |
r မ 1000 | |
s ျ 1000 | |
t အ 1000 | |
u က 1000 | |
v လ 1000 | |
w တ 1000 | |
x ထ 1000 | |
y ပ 1000 | |
z ဖ 1000 | |
A မ် 1000 | |
B ှ့ 1000 | |
C ဃ 1000 | |
D ီ 1000 | |
E ၢၢ် 1000 | |
F ၠ 1000 | |
G ွ 1000 | |
H ံ 1000 | |
I . 1000 | |
J ဲ 1000 | |
K ဒ 1000 | |
L လီၤ 1000 | |
M န့ၣ် 1000 | |
N ၥ 1000 | |
O ှု 1000 | |
P ၦ 1000 | |
Q ၡ 1000 | |
R ၤ 1000 | |
S ှ 1000 | |
T ၢၥ် 1000 | |
U ွ့ 1000 | |
V ျ့ 1000 | |
W ဝ 1000 | |
X ၢ 1000 | |
Y ၢၣ် 1000 | |
Z ဇ 1000 | |
1 ၁ 1000 | |
2 ၂ 1000 | |
3 ၃ 1000 | |
4 ၄ 1000 | |
5 ၅ 1000 | |
6 ၆ 1000 | |
7 ၇ 1000 | |
8 ၈ 1000 | |
9 ၉ 1000 | |
0 ၀ 1000 | |
& ရ 1000 | |
* ဂ 1000 | |
[ ဟ 1000 | |
] ၜ 1000 | |
\ ' 1000 | |
{{ ဧ 1000 | |
}} ✩ 1000 | |
| " 1000 | |
; း 1000 | |
' ၊ 1000 | |
: ဒီး 1000 | |
" ။ 1000 | |
, ယ 1000 | |
. ၣ် 1000 | |
< , 1000 | |
> ၢ် 1000 | |
END_TABLE | |
EOF | |
echo "Installing Karen Kawthoolei layout system-wide..." | |
sudo cp $DB_NAME.txt "$TABLE_DIR/$DB_NAME.txt" | |
sudo ibus-table-createdb -s "$TABLE_DIR/$DB_NAME.txt" -n "$TABLE_DIR/$DB_NAME.db" | |
# 4. Restart ibus | |
echo "Restarting ibus-daemon..." | |
ibus-daemon -drx | |
echo "✅ Kawthoolei keyboard installed system-wide." | |
echo "To enable it: Settings > Keyboard > + Add Input Source > 'Karen Kawthoolei' > Others > Kawthoolei" | |
# 5. Launch settings based on environment | |
read -p "Do you want to open keyboard settings now? [Y/n] " open_settings | |
if [[ "$open_settings" =~ ^[Yy]$ ]]; then | |
if command -v gnome-control-center &>/dev/null; then | |
gnome-control-center keyboard || gnome-control-center region & | |
elif command -v systemsettings5 &>/dev/null; then | |
systemsettings5 kcm_regionandlang & | |
else | |
echo "Please open your system's Region & Language settings manually." | |
fi | |
fi | |
exit 0 | |
# Optional: Download and open keyboard layout image | |
read -p "Do you want to download and open the keyboard layout image? [Y/n] " get_image | |
if [[ "$get_image" =~ ^[Yy]$ ]]; then | |
wget -O ~/Kawthoolei_keyboard_layout.png "https://gcgklarsavdldufdguee.supabase.co/storage/v1/object/public/keyboards/Kawthoolei_keyobard_layout.png" | |
xdg-open ~/Kawthoolei_keyboard_layout.png & | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment