Compare commits

...

5 Commits

Author SHA1 Message Date
norayr chilingarian 92795b2a0a fix uppercase in armenian (and perhaps some other) layouts
"This patch fixes uppercase in armenian (and perhaps some other) layouts. svkbd
was previously registering a key in one modification (xorg accepts up to 4
modifications). with this patch svkbd registers 2 modifications - upper and
lower case. function tmp_remap changed in a way that if the key is not found in
a current layout, it is temporary added to it. for cyrillic layout uppercase
(when shift is pressed) letters were showing anyway, because those are somehow
found (modified) by xorg. but for armenian layout that did not work. now works."

Patch by նորայր <norayr@arnet.am>
2023-12-13 19:10:08 +01:00
Hiltjo Posthuma ff704d5d1e update LICENSE 2023-02-05 11:26:58 +01:00
Norayr Chilingarian 7fc78a0b44 dvorak layout 2023-02-05 11:25:58 +01:00
Hiltjo Posthuma 3dfb00ccf8 fix comment style 2023-02-05 11:25:46 +01:00
Norayr Chilingarian c247720ae4 armenian layout 2023-01-29 17:33:13 +01:00
5 changed files with 241 additions and 9 deletions

View File

@ -3,6 +3,7 @@ MIT/X Consortium License
© 2011 Christoph Lohmann <20h@r-36.net>
© 2008-2011 Enno Boland <g # s01 ' de>
© 2020-2021 Maarten van Gompel <proycon@anaproy.nl>
© 2020-2023 Hiltjo Posthuma <hiltjo@codemadness.org>
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),

View File

@ -1,9 +1,13 @@
static const Bool wmborder = True;
static int fontsize = 22;
static double overlay_delay = 1.0; //in seconds
static double repeat_delay = 0.75; //in seconds, will not work on keys with overlays
static int scan_rate = 50; //scan rate in microseconds, affects key repetition rate
static int heightfactor = 14; //one row of keys takes up 1/x of the screen height
/* overlay delay in seconds */
static double overlay_delay = 1.0;
/* repeat delay in seconds, will not work on keys with overlays */
static double repeat_delay = 0.75;
/* scan rate in microseconds, affects key repetition rate */
static int scan_rate = 50;
/* one row of keys takes up 1/x of the screen height */
static int heightfactor = 14;
static int xspacing = 5;
static int yspacing = 5;
static const char *defaultfonts[] = {

85
layout.am.h Normal file
View File

@ -0,0 +1,85 @@
#define KEYS 63
static Key keys_am[] = {
{ "՝","՜", XK_Armenian_exclam, 1 },
{ "ֆ","Ֆ", XK_Armenian_fe, 1 },
{ "ձ","Ձ", XK_Armenian_dza, 1 },
{ "֊","", XK_Armenian_hyphen, 1 },
{ ",","՟", XK_comma, 1 },
{ "։","", XK_Armenian_full_stop, 1 },
{ "՞","%", XK_Armenian_question, 1 },
{ "","և", XK_Armenian_ligature_ew, 1 },
{ "՛","՚", XK_Armenian_accent, 1 },
{ ")","(", XK_parenright, 1 },
{ "օ","Օ", XK_Armenian_o, 1 },
{ "է","Է", XK_Armenian_e, 1 },
{ "ղ","Ղ", XK_Armenian_ghat, 1 },
{ "<-", 0, XK_BackSpace, 2 },
{ "Del", 0, XK_Delete, 1},
{ 0 }, /* New row */
{ "->|", 0, XK_Tab, 1 },
{ "ճ", "Ճ", XK_Armenian_tche, 1 },
{ "փ", "Փ", XK_Armenian_pyur, 1 },
{ "բ", "Բ", XK_Armenian_ben, 1 },
{ "ս", "Ս", XK_Armenian_se, 1 },
{ "մ", "Մ", XK_Armenian_men, 1 },
{ "ո", "Ո", XK_Armenian_vo, 1 },
{ "ւ", "Ւ", XK_Armenian_vyun, 1 },
{ "կ","Կ", XK_Armenian_ken, 1 },
{ "ը", "Ը", XK_Armenian_at, 1 },
{ "թ", "Թ", XK_Armenian_to, 1 },
{ "ծ", "Ծ", XK_Armenian_tsa, 1 },
{ "ց", "Ց", XK_Armenian_tso, 1 },
{ "Return", 0, XK_Return, 3 },
{ 0 }, /* New row */
{ 0, 0, XK_Caps_Lock, 2 },
{ "ջ", "Ջ", XK_Armenian_je, 1 },
{ "վ", "Վ", XK_Armenian_vev, 1 },
{ "գ", "Գ", XK_Armenian_gim, 1 },
{ "ե", "Ե", XK_Armenian_yech, 1 },
{ "ա", "Ա", XK_Armenian_ayb, 1 },
{ "ն", "Ն", XK_Armenian_nu, 1 },
{ "ի", "Ի", XK_Armenian_ini, 1 },
{ "տ", "Տ", XK_Armenian_tyun, 1 },
{ "հ", "Հ", XK_Armenian_ho, 1 },
{ "պ", "Պ", XK_Armenian_pe, 1 },
{ "ր", "Ր", XK_Armenian_re, 1 },
{ "\\","/", XK_backslash, 1 },
{ 0 }, /* New row */
{ 0, 0, XK_Shift_L, 3 },
{ "ժ", "Ժ", XK_Armenian_zhe, 1 },
{ "դ", "Դ", XK_Armenian_da, 1 },
{ "չ", "Չ", XK_Armenian_cha, 1 },
{ "յ", "Յ", XK_Armenian_hi, 1 },
{ "զ", "Զ", XK_Armenian_za, 1 },
{ "լ", "Լ", XK_Armenian_lyun, 1 },
{ "ք", "Ք", XK_Armenian_ke, 1 },
{ "խ", "Խ", XK_Armenian_khe, 1 },
{ "շ", "Շ", XK_Armenian_sha, 1 },
{ "ռ", "Ռ", XK_Armenian_ra, 1 },
{ 0, 0, XK_Shift_R, 2 },
{ 0 }, /* New row */
{ "Ctrl", 0, XK_Control_L, 2 },
{ "Alt", 0,XK_Alt_L, 2 },
{ "", 0,XK_space, 5 },
{ "Alt", 0,XK_Alt_R, 2 },
{ "Ctrl", 0,XK_Control_R, 2 },
};
Buttonmod buttonmods[] = {
{ XK_Shift_L, Button2 },
{ XK_Alt_L, Button3 },
};
#define OVERLAYS 1
static Key overlay[OVERLAYS] = {
{ 0, 0, XK_Cancel },
};
#define LAYERS 1
static char* layer_names[LAYERS] = {
"am",
};
static Key* available_layers[LAYERS] = {
keys_am,
};

View File

@ -67,6 +67,73 @@ static Key keys_en[KEYS] = {
{ "↲ Enter", 0, XK_Return, 2 },
};
static Key keys_dvorak[KEYS] = {
{ "Esc", "", XK_Escape, 1 },
{ "1", "!", XK_1, 1 },
{ "2", "@", XK_2, 1 },
{ "3", "#", XK_3, 1 },
{ "4", "$", XK_4, 1 },
{ "5", "%", XK_5, 1 },
{ "6", "^", XK_6, 1 },
{ "7", "&", XK_7, 1 },
{ "8", "*", XK_8, 1 },
{ "9", "(", XK_9, 1 },
{ "0", ")", XK_0, 1 },
{ 0 }, /* New row */
{ "", 0, XK_Tab, 0.75 },
{ ";", ":", XK_colon, 1 },
{ ",", "<", XK_comma, 1 },
{ ".", ">", XK_period, 1 },
{ 0, 0, XK_p, 1 },
{ 0, 0, XK_y, 1 },
{ 0, 0, XK_f, 1 },
{ 0, 0, XK_g, 1 },
{ 0, 0, XK_c, 1 },
{ 0, 0, XK_r, 1 },
{ 0, 0, XK_l, 1 },
{ "/", "?", XK_slash, .75 },
{ 0 }, /* New row */
{ "^", 0, XK_Control_L, 1 },
{ 0, 0, XK_a, 1 },
{ 0, 0, XK_o, 1 },
{ 0, 0, XK_e, 1 },
{ 0, 0, XK_u, 1 },
{ 0, 0, XK_i, 1 },
{ 0, 0, XK_d, 1 },
{ 0, 0, XK_h, 1 },
{ 0, 0, XK_t, 1 },
{ 0, 0, XK_n, 1 },
{ 0, 0, XK_s, 1 },
{ "-", "_", XK_minus, 1 },
{ 0 }, /* New row */
{ "", 0, XK_Shift_L, 1.5 },
{ "'", "\"", XK_apostrophe, 1 },
{ 0, 0, XK_q, 1 },
{ 0, 0, XK_j, 1 },
{ 0, 0, XK_k, 1 },
{ 0, 0, XK_x, 1 },
{ 0, 0, XK_b, 1 },
{ 0, 0, XK_m, 1 },
{ 0, 0, XK_w, 1 },
{ 0, 0, XK_v, 1 },
{ 0, 0, XK_z, 1 },
{ "", 0, XK_BackSpace, 1 },
{ 0 }, /* New row */
{ "", 0, XK_Cancel, 1},
{ "Alt", 0, XK_Alt_L, 1 },
{ "", 0, XK_space, 4 },
{ "", 0, XK_Down, 1 },
{ "", 0, XK_Up, 1 },
{ "↲ Enter", 0, XK_Return, 2 },
};
static Key keys_minimal[KEYS] = {
{ 0, "", XK_q, 1 },
{ 0, 0, XK_w, 1 },
@ -474,6 +541,68 @@ static Key keys_navigation[KEYS] = {
{ 0 }, /* Last item (double 0) */
};
static Key keys_am[KEYS] = {
{ "՝","՜", XK_Armenian_exclam, 1 },
{ "ֆ","Ֆ", XK_Armenian_fe, 1 },
{ "ձ","Ձ", XK_Armenian_dza, 1 },
{ "֊","", XK_Armenian_hyphen, 1 },
{ ",","՟", XK_comma, 1 },
{ "։","", XK_Armenian_full_stop, 1 },
{ "՞","%", XK_Armenian_question, 1 },
{ "","և", XK_Armenian_ligature_ew, 1 },
{ "՛","՚", XK_Armenian_accent, 1 },
{ ")","(", XK_parenright, 1 },
{ "օ","Օ", XK_Armenian_o, 1 },
{ "է","Է", XK_Armenian_e, 1 },
{ "ղ","Ղ", XK_Armenian_ghat, 1 },
{ 0 }, /* New row */
{ "ճ", "Ճ", XK_Armenian_tche, 1 },
{ "փ", "Փ", XK_Armenian_pyur, 1 },
{ "բ", "Բ", XK_Armenian_ben, 1 },
{ "ս", "Ս", XK_Armenian_se, 1 },
{ "մ", "Մ", XK_Armenian_men, 1 },
{ "ո", "Ո", XK_Armenian_vo, 1 },
{ "ւ", "Ւ", XK_Armenian_vyun, 1 },
{ "կ","Կ", XK_Armenian_ken, 1 },
{ "ը", "Ը", XK_Armenian_at, 1 },
{ "թ", "Թ", XK_Armenian_to, 1 },
{ "ծ", "Ծ", XK_Armenian_tsa, 1 },
{ "ց", "Ց", XK_Armenian_tso, 1 },
{ 0 }, /* New row */
{ "ջ", "Ջ", XK_Armenian_je, 1 },
{ "վ", "Վ", XK_Armenian_vev, 1 },
{ "գ", "Գ", XK_Armenian_gim, 1 },
{ "ե", "Ե", XK_Armenian_yech, 1 },
{ "ա", "Ա", XK_Armenian_ayb, 1 },
{ "ն", "Ն", XK_Armenian_nu, 1 },
{ "ի", "Ի", XK_Armenian_ini, 1 },
{ "տ", "Տ", XK_Armenian_tyun, 1 },
{ "հ", "Հ", XK_Armenian_ho, 1 },
{ "պ", "Պ", XK_Armenian_pe, 1 },
{ "ր", "Ր", XK_Armenian_re, 1 },
{ 0 }, /* New row */
{ "123", 0, XK_Mode_switch, 1 },
{ "ժ", "Ժ", XK_Armenian_zhe, 1 },
{ "դ", "Դ", XK_Armenian_da, 1 },
{ "չ", "Չ", XK_Armenian_cha, 1 },
{ "յ", "Յ", XK_Armenian_hi, 1 },
{ "զ", "Զ", XK_Armenian_za, 1 },
{ "լ", "Լ", XK_Armenian_lyun, 1 },
{ "ք", "Ք", XK_Armenian_ke, 1 },
{ "խ", "Խ", XK_Armenian_khe, 1 },
{ "շ", "Շ", XK_Armenian_sha, 1 },
{ "ռ", "Ռ", XK_Armenian_ra, 1 },
{ "⌫Bksp", 0, XK_BackSpace, 2 },
{ 0 }, /* New row */
{ "", 0, XK_Cancel, 1},
{ "Shift", 0, XK_Shift_L, 2 },
{ "", 0, XK_space, 2 },
{ "↲ Enter", 0, XK_Return, 2 },
};
static Key keys_ru[KEYS] = {
{ "Esc", 0, XK_Escape, 1 },
@ -572,14 +701,16 @@ static Key keys_dialer[KEYS] = {
{ 0 }, /* Last item (double 0) */
};
#define LAYERS 6
#define LAYERS 8
static char* layer_names[LAYERS] = {
"en",
"symbols",
"navigation",
"dialer",
"minimal",
"ru",
"dvorak",
"am",
"ru"
};
static Key* available_layers[LAYERS] = {
@ -588,7 +719,9 @@ static Key* available_layers[LAYERS] = {
keys_navigation,
keys_dialer,
keys_minimal,
keys_ru
keys_dvorak,
keys_am,
keys_ru,
};
Buttonmod buttonmods[] = {

13
svkbd.c
View File

@ -453,7 +453,7 @@ press(Key *k, KeySym buttonmod)
if (enableoverlays && currentoverlay == -1)
overlayidx = hasoverlay(k->keysym);
if ((pressonrelease) || (enableoverlays && overlayidx != -1)) {
/*record the begin of the press, don't simulate the actual keypress yet */
/* record the begin of the press, don't simulate the actual keypress yet */
record_press_begin(k->keysym);
} else {
printdbg("Simulating press: %ld (mod %ld)\n", k->keysym, buttonmod);
@ -481,9 +481,18 @@ press(Key *k, KeySym buttonmod)
int
tmp_remap(KeySym keysym)
{
XChangeKeyboardMapping(dpy, tmp_keycode, 1, &keysym, 1);
/* map lower and upper case of keysym to the temporary keycode */
KeySym syms[2];
XConvertCase(keysym, &syms[0], &syms[1]);
/* if keysym is capital letter then swap upper and lower case */
if (keysym == syms[1])
syms[1] = syms[0], syms[0] = keysym;
XChangeKeyboardMapping(dpy, tmp_keycode, syms[0] == syms[1] ? 1 : 2, syms, 1);
XSync(dpy, False);
printdbg("Temporary map keysym %ld (%ld, %ld) to keycode %d\n", keysym, syms[0], syms[1], tmp_keycode);
return tmp_keycode;
}