Skip to content

Commit

Permalink
Merge pull request #3319 from matt335672/colemak_support
Browse files Browse the repository at this point in the history
Colemak support
  • Loading branch information
matt335672 authored Nov 29, 2024
2 parents 600549c + 53079c4 commit 3d853d5
Show file tree
Hide file tree
Showing 32 changed files with 771 additions and 89 deletions.
8 changes: 6 additions & 2 deletions genkeymap/dump-keymaps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ kbgen()
desc="$2"
os="$3"
shift 3
setxkbmap "$@"
if ! setxkbmap "$@"; then
echo "Failed to run setxkbmap $*" >&2
return 1
fi
./xrdp-genkeymap \
-c "Description: $desc" \
-c "Operating system: $os" \
Expand Down Expand Up @@ -68,7 +71,8 @@ fi
kbgen 0406 "da-DK" "$os" -model pc105 -layout dk
kbgen 0407 "de-DE" "$os" -model pc104 -layout de
kbgen 0409 "en-US" "$os" -model pc104 -layout us
kbgen 10409 "en-US" "$os" -model pc104 -layout dvorak
kbgen 10409 "en-US" "$os" -model pc104 -layout us -variant dvorak
kbgen 60409 "en-US" "$os" -model pc104 -layout us -variant colemak
kbgen 040a "es-ES_tradnl" "$os" -model pc105 -layout es
kbgen 040b "fi-FI" "$os" -model pc105 -layout 'fi'
kbgen 040c "fr-FR" "$os" -model pc105 -layout fr
Expand Down
41 changes: 40 additions & 1 deletion genkeymap/genkeymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,34 @@ output_file_section(FILE *outf,
}


/*****************************************************************************/
/**
* Determine is caps-lock is supported. Some layouts (e.g. Colemak) do not
* support this key.
*
* @param dpy X display
* @reurn boolean
*/
static int
is_caps_lock_supported(Display *dpy)
{
char dummy[4];
KeySym ks;
XKeyPressedEvent e =
{
.type = KeyPress,
.serial = 16,
.send_event = True,
.display = dpy,
.state = 0,
.keycode = scancode_to_x11_keycode(SCANCODE_CAPS_KEY),
.same_screen = True
};

(void)XLookupString(&e, dummy, sizeof(dummy), &ks, NULL);
return (ks == XK_Caps_Lock || ks == XK_Eisu_toggle);
}

/*****************************************************************************/
/**
* Main
Expand Down Expand Up @@ -345,6 +373,7 @@ int main(int argc, char **argv)
const char *keycode_set = NULL;
struct kbd_info *kbd_info = NULL;
int status = 1;
int caps_lock_supported;

setlocale(LC_CTYPE, "");
if (strrchr(argv[0], '/') != NULL)
Expand Down Expand Up @@ -418,6 +447,8 @@ int main(int argc, char **argv)
goto finish;
}

caps_lock_supported = is_caps_lock_supported(dpy);

fprintf(outf, "# Created by %s V" PACKAGE_VERSION
"\n# Key code set: %s\n",
programname, keycode_set);
Expand All @@ -430,10 +461,18 @@ int main(int argc, char **argv)
}

fprintf(outf, "\n[General]\nversion=" KEYMAP_FILE_FORMAT_VERSION "\n");
fprintf(outf, "caps_lock_supported=%s\n",
(caps_lock_supported) ? "true" : "false");

for (idx = 0; idx < NUM_STATES; idx++) /* Sections and states */
{
output_file_section(outf, dpy, sections[idx], states[idx]);
int mod_state = states[idx];
if (!caps_lock_supported && ((mod_state & 2) != 0))
{
// Skip this section as it's for caps lock
continue;
}
output_file_section(outf, dpy, sections[idx], mod_state);
}

status = 0; // Successful run
Expand Down
1 change: 1 addition & 0 deletions instfiles/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dist_startscript_DATA = \
km-00000816.toml \
km-0000100c.toml \
km-00010409.toml \
km-00060409.toml \
km-19360409.toml

#
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000406.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout dk
# Description: da-DK
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000407.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwertz)
# setxkbmap -rules evdev -model pc104 -layout de
# Description: de-DE
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000409.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout us
# Description: en-US
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000040a.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout es
# Description: es-ES_tradnl
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000040b.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout fi
# Description: fi-FI
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000040c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(azerty)
# setxkbmap -rules evdev -model pc105 -layout fr
# Description: fr-FR
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000410.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout it
# Description: it-IT
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000411.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout jp -variant OADG109A
# Description: ja-JP
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000412.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout kr
# Description: ko-KR
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000414.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout no
# Description: nb-NO
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000415.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout pl
# Description: pl-PL
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000416.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout br
# Description: pt-BR
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000419.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout ru
# Description: ru-RU
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000041d.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout se
# Description: sv-SE
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000807.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwertz)
# setxkbmap -rules evdev -model pc105 -layout ch
# Description: de-CH
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000809.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout gb
# Description: en-GB
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000080a.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc105 -layout latam
# Description: es-MX
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000080c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(azerty)
# setxkbmap -rules evdev -model pc105 -layout be -variant oss
# Description: fr-BE
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000813.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(azerty)
# setxkbmap -rules evdev -model pc105 -layout be
# Description: nl-BE
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-00000816.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout pt
# Description: pt-PT
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
3 changes: 2 additions & 1 deletion instfiles/km-0000100c.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
# Key code set: evdev+aliases(qwertz)
# setxkbmap -rules evdev -model pc105 -layout ch -variant fr
# Description: fr-CH
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
5 changes: 3 additions & 2 deletions instfiles/km-00010409.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Created by xrdp-genkeymap V0.10.80
# Key code set: evdev+aliases(qwerty)
# setxkbmap -rules evdev -model pc104 -layout dvorak
# setxkbmap -rules evdev -model pc104 -layout us -variant dvorak
# Description: en-US
# Operating system: Ubuntu 22.04.4 LTS
# Operating system: Ubuntu 22.04.5 LTS

[General]
version=2
caps_lock_supported=true

[noshift]
01="65307:U+001B" # Escape
Expand Down
Loading

0 comments on commit 3d853d5

Please sign in to comment.