From 1583f2ba49ba26587b5e8044215d88614ff33e2a Mon Sep 17 00:00:00 2001 From: Syndamia Date: Sun, 24 Dec 2023 22:15:12 +0200 Subject: [packages] Added custom bulgarian keyboard layout --- packages/bg-custom | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++ packages/default.nix | 9 +++-- 2 files changed, 104 insertions(+), 2 deletions(-) create mode 100644 packages/bg-custom diff --git a/packages/bg-custom b/packages/bg-custom new file mode 100644 index 0000000..9138734 --- /dev/null +++ b/packages/bg-custom @@ -0,0 +1,97 @@ +////////////////////////////////////////////////////////////////////////// +// Copyright (C) 1999, 2000, 2007, 2009 by Anton Zinoviev +// +// This software may be used, modified, copied, distributed, and sold, +// both in source and binary form provided that the above copyright +// notice and these terms are retained. The name of the author may not +// be used to endorse or promote products derived from this software +// without prior permission. THIS SOFTWARE IS PROVIDED "AS IS" AND +// ANY EXPRESS OR IMPLIED WARRANTIES ARE DISCLAIMED. IN NO EVENT +// SHALL THE AUTHOR BE LIABLE FOR ANY DAMAGES ARISING IN ANY WAY OUT +// OF THE USE OF THIS SOFTWARE. +// +////////////////////////////////////////////////////////////////////////// + +// Version 1.1 // Fork by Kamen Mladenov + +// This is a non-standard variant of the traditional Bulgarian phonetic +// keyboard, which allows for usage of some English characters that aren't +// normally supported. + +// Original English characters are returned in the following places: +// - + +// - <3rd level key> + <[> and <3rd level key> + + <[> +// - <3rd level key> + <]> and <3rd level key> + + <]> +// - <3rd level key> + <`> and <3rd level key> + + <`> + +// Version History: +// [03.12.2022] 1.1 - Updated description and added Backtick and Tilda to +// third (and fourth) level layouts. +// [03.12.2022] 1.0 - Initial + +// Special thanks to Daniel Paul O'Donnell for his blog post: +// https://people.uleth.ca/~daniel.odonnell/Blog/custom-keyboard-in-linuxx11 + +////////////////////////////////////////////////////////////////////////// + +default partial alphanumeric_keys +xkb_symbols "phonetic-nonstandard" { + name[Group1]= "Bulgarian (traditional phonetic, nonstandard)"; + + key {[ Cyrillic_che, Cyrillic_CHE, grave, asciitilde ]}; + key {[ 1, exclam ]}; + key {[ 2, at ]}; + key {[ 3, numbersign ]}; + key {[ 4, dollar, EuroSign, EuroSign ]}; + key {[ 5, percent ]}; + key {[ 6, asciicircum ]}; + key {[ 7, ampersand ]}; + key {[ 8, asterisk ]}; + key {[ 9, parenleft, bracketleft, U2329 ]}; + key {[ 0, parenright, bracketright, U232A ]}; + key {[ minus, underscore, U2011, U2011 ]}; + key {[ equal, plus, emdash, dagger ]}; + + key {[ Cyrillic_ya, Cyrillic_YA, U0463, U0462 ]}; + key {[ Cyrillic_ve, Cyrillic_VE ]}; + key {[ Cyrillic_ie, Cyrillic_IE, Cyrillic_e, Cyrillic_E ]}; + key {[ Cyrillic_er, Cyrillic_ER, registered, registered ]}; + key {[ Cyrillic_te, Cyrillic_TE, trademark, trademark ]}; + key {[ Cyrillic_hardsign, Cyrillic_HARDSIGN, U046B, U046A ]}; + key {[ Cyrillic_u, Cyrillic_U ]}; + key {[ Cyrillic_i, Cyrillic_I, U045D, U040D ]}; + key {[ Cyrillic_o, Cyrillic_O ]}; + key {[ Cyrillic_pe, Cyrillic_PE ]}; + key {[ Cyrillic_sha, Cyrillic_SHA, bracketleft, braceleft ]}; + key {[ Cyrillic_shcha, Cyrillic_SHCHA, bracketright, braceright ]}; + + key {[ Cyrillic_a, Cyrillic_A ]}; + key {[ Cyrillic_es, Cyrillic_ES, copyright, copyright ]}; + key {[ Cyrillic_de, Cyrillic_DE ]}; + key {[ Cyrillic_ef, Cyrillic_EF ]}; + key {[ Cyrillic_ghe, Cyrillic_GHE ]}; + key {[ Cyrillic_ha, Cyrillic_HA ]}; + key {[ Cyrillic_shorti, Cyrillic_SHORTI, U046D, U046C ]}; + key {[ Cyrillic_ka, Cyrillic_KA ]}; + key {[ Cyrillic_el, Cyrillic_EL ]}; + key {[ semicolon, colon, ellipsis, ellipsis ]}; + key {[ apostrophe, quotedbl, rightsinglequotemark, leftsinglequotemark ]}; + key {[ Cyrillic_yu, Cyrillic_YU ]}; + + key {[ U045D, U040D ]}; + key {[ Cyrillic_ze, Cyrillic_ZE ]}; + key {[ Cyrillic_softsign, U045D, Cyrillic_yeru, Cyrillic_YERU ]}; + key {[ Cyrillic_tse, Cyrillic_TSE, copyright, copyright ]}; + key {[ Cyrillic_zhe, Cyrillic_ZHE ]}; + key {[ Cyrillic_be, Cyrillic_BE ]}; + key {[ Cyrillic_en, Cyrillic_EN ]}; + key {[ Cyrillic_em, Cyrillic_EM ]}; + key {[ comma, doublelowquotemark, guillemotleft, guillemotleft ]}; + key {[ period, leftdoublequotemark, guillemotright, guillemotright ]}; + key {[ slash, question, U0300, U0301 ]}; + + key {[ space, space, nobreakspace, nobreakspace ]}; + + key { type[Group1] = "KEYPAD", [ KP_Delete, KP_Separator ]}; +}; + diff --git a/packages/default.nix b/packages/default.nix index 1e9551d..7949cc4 100644 --- a/packages/default.nix +++ b/packages/default.nix @@ -255,9 +255,14 @@ services.xserver = { # xkbmap - layout = "us,bg"; # TODO us,bg-custom - xkbVariant = ",phonetic"; + layout = "us,bg-custom"; + xkbVariant = ",phonetic-nonstandard"; xkbOptions = "grp:alt_shift_toggle,lv3:switch,caps:escape"; + xkb.extraLayouts.bg-custom = { + description = "Non-standard variant of the traditional Bulgarian phonetic keyboard, which replaces some characters with their English counterparts"; + languages = [ "bg" ]; + symbolsFile = ./bg-custom; + }; # touchpad support libinput = { -- cgit v1.3.1-23-gd82d