Compare commits

..

2 Commits

24 changed files with 991 additions and 194 deletions

7
.envrc
View File

@ -1,4 +1,6 @@
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
@ -16,10 +18,11 @@
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
use flake || use nix
watch_file flake.nix
PATH_add ./scripts
if on_git_branch; then
echo && git status --short --branch &&
echo && git fetch --verbose

23
.gitignore vendored
View File

@ -1,9 +1,26 @@
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
# Keymaps is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
# build
/target
/result
# direnv
.direnv
# keymaps is a library
Cargo.lock

View File

@ -1,16 +1,34 @@
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
# Keymaps is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
---
# Regexes which if matched by a file path will always be excluded from
# getting a license header
excludes:
- \.gitignore
- .*lock
- \.git/.*
- \.licensure\.yml
- README.*
- LICENSE.spdx
- LICENSE
- COPYING
- COPYING.LESSER
- .*\.(md|rst|txt|pdf)
- .*\.(rst|txt|pdf)
# Definition of the licenses used on this project and to what files
# they should apply.
#
@ -34,11 +52,9 @@ licenses:
#
# A list of authors who hold copyright over these files
authors:
# Provide either your full name or company name for copyright purposes
- name: The Trinitrix Project
# Optionally provide email for copyright purposes
email: "soispha@vhack.eu, antifallobst@systemausfall.org"
#
- name: "The Trinitrix Project"
email: "bpeetz@b-peetz.de, antifallobst@systemausfall.org"
# The template that will be rendered to generate the header before
# comment characters are applied. Available variables are:
# - [year]: substituted with the current year.
@ -47,7 +63,9 @@ licenses:
# Name <email@example.com>. If multiple authors are provided the
# list is concatenated together with commas.
template: |
Copyright (C) [year] [name of author]
Copyright (C) 2024 - [year]:
[name of author]
SPDX-License-Identifier: LGPL-3.0-or-later
This file is part of the Keymaps crate for Trinitrix.
@ -64,7 +82,8 @@ licenses:
You should have received a copy of the GNU General Public License
and the Lesser GNU General Public License along with this program.
If not, see <https://www.gnu.org/licenses/>.
#
# If auto_template is true then template is ignored and the SPDX
# API will be queried with the ident value to automatically
# determine the license header template. auto_template works best
@ -79,7 +98,7 @@ licenses:
#
# Important Note: this means the ident must be a valid SPDX identifier
# auto_template: true
#
# If true try to detect the text wrapping of the template, and unwrap it
unwrap_text: false
@ -103,7 +122,7 @@ comments:
commenter:
type: line
comment_char: "//"
trailing_lines: 2
trailing_lines: 1
- extensions:
- rs
@ -111,6 +130,7 @@ comments:
- css
- cpp
- c
- h
# This demonstrates a block commenter configuration. A block
# commenter type will add start_block_char as the first character
# in the license header and add end_block_char as the last character
@ -125,14 +145,16 @@ comments:
start_block_char: "/*\n"
end_block_char: "*/\n"
per_line_char: "*"
trailing_lines: 2
trailing_lines: 1
# In this case extension is singular and a single string extension is provided.
- extension: html
- extension:
- html
- md
commenter:
type: block
start_block_char: "<!--\n"
end_block_char: "-->"
end_block_char: "-->\n"
trailing_lines: 1
- extensions:
- el
@ -140,16 +162,15 @@ comments:
commenter:
type: line
comment_char: ";;;"
trailing_lines: 2
trailing_lines: 1
- extensions:
- ebnf
- tex
- bib
commenter:
type: block
start_block_char: "#(*\n"
end_block_char: "#*)\n"
per_line_char: "#"
trailing_lines: 2
type: line
comment_char: "%"
trailing_lines: 1
# The extension string "any" is special and so will match any file
# extensions. Commenter configurations are always checked in the
@ -163,4 +184,4 @@ comments:
commenter:
type: line
comment_char: '#'
trailing_lines: 2
trailing_lines: 1

471
Cargo.lock generated Normal file
View File

@ -0,0 +1,471 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "block-buffer"
version = "0.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
dependencies = [
"generic-array",
]
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cpufeatures"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0"
dependencies = [
"libc",
]
[[package]]
name = "crossterm"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67"
dependencies = [
"bitflags",
"crossterm_winapi",
"libc",
"mio",
"parking_lot",
"signal-hook",
"signal-hook-mio",
"winapi",
]
[[package]]
name = "crossterm_winapi"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"
dependencies = [
"winapi",
]
[[package]]
name = "crypto-common"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"
dependencies = [
"generic-array",
"typenum",
]
[[package]]
name = "diff"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "digest"
version = "0.10.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
"crypto-common",
]
[[package]]
name = "generic-array"
version = "0.14.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "keymaps"
version = "0.1.0"
dependencies = [
"crossterm",
"log",
"pest",
"pest_derive",
"pretty_assertions",
"thiserror",
]
[[package]]
name = "libc"
version = "0.2.151"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4"
[[package]]
name = "lock_api"
version = "0.4.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
dependencies = [
"autocfg",
"scopeguard",
]
[[package]]
name = "log"
version = "0.4.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
[[package]]
name = "memchr"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]]
name = "mio"
version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09"
dependencies = [
"libc",
"log",
"wasi",
"windows-sys",
]
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "parking_lot"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
dependencies = [
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"smallvec",
"windows-targets",
]
[[package]]
name = "pest"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5"
dependencies = [
"memchr",
"thiserror",
"ucd-trie",
]
[[package]]
name = "pest_derive"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81d78524685f5ef2a3b3bd1cafbc9fcabb036253d9b1463e726a91cd16e2dfc2"
dependencies = [
"pest",
"pest_generator",
]
[[package]]
name = "pest_generator"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68bd1206e71118b5356dae5ddc61c8b11e28b09ef6a31acbd15ea48a28e0c227"
dependencies = [
"pest",
"pest_meta",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pest_meta"
version = "2.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c747191d4ad9e4a4ab9c8798f1e82a39affe7ef9648390b7e5548d18e099de6"
dependencies = [
"once_cell",
"pest",
"sha2",
]
[[package]]
name = "pretty_assertions"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66"
dependencies = [
"diff",
"yansi",
]
[[package]]
name = "proc-macro2"
version = "1.0.70"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
dependencies = [
"proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"
dependencies = [
"bitflags",
]
[[package]]
name = "scopeguard"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "sha2"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"
dependencies = [
"cfg-if",
"cpufeatures",
"digest",
]
[[package]]
name = "signal-hook"
version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-mio"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af"
dependencies = [
"libc",
"mio",
"signal-hook",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
"libc",
]
[[package]]
name = "smallvec"
version = "1.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"
[[package]]
name = "syn"
version = "2.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "thiserror"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "typenum"
version = "1.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825"
[[package]]
name = "ucd-trie"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9"
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_i686_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "yansi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"

View File

@ -1,4 +1,6 @@
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
@ -16,9 +18,9 @@
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
[package]
name = "keymaps"
description = "A rust crate which provides a standardized encoding for key codes"
version = "0.1.0"
edition = "2021"

View File

@ -1,7 +1,7 @@
SPDXVersion: SPDX-2.3
DataLicense: CC0-1.0
Creator: trinitrix contributers
PackageName: Trinitrix-keymaps
PackageOriginator: trinitrix contributers
Creator: flake template init
PackageName: keymaps
PackageOriginator: Benedikt Peetz
PackageHomePage: https://git.nerdcult.net/trinitrix/keymaps
PackageLicenseDeclared: LGPL-3.0-or-later

32
README.md Normal file
View File

@ -0,0 +1,32 @@
<!--
Copyright (C) 2024 - 2024:
The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
SPDX-License-Identifier: LGPL-3.0-or-later
This file is part of the Keymaps crate for Trinitrix.
Keymaps is free software: you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
and the Lesser GNU General Public License along with this program.
If not, see <https://www.gnu.org/licenses/>.
-->
# Keymaps
> A rust crate which provides a standardized encoding for key codes
## Licence
This program is free software: you can redistribute it and/or modify
it under the terms of the Lesser GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

View File

@ -1,4 +1,6 @@
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
@ -16,18 +18,15 @@
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
tag_prefix = "v"
branch_whitelist = [ "main" ]
branch_whitelist = ["main", "prime"]
ignore_merge_commits = false
[commit_types]
pre_bump_hooks = [
"licensur -p -i" # update the license header in each file
"nix build", # verify the project builds
"cargo fmt --all" # format
"nix flake check", # verify the project builds
"./scripts/renew_copyright_header.sh", # update the license header in each file
"cargo set-version {{version}}", # bump version in Cargo.toml
"nix fmt", # format
]
post_bump_hooks = [
"git push",
@ -39,12 +38,8 @@ post_bump_hooks = [
[changelog]
path = "NEWS.md"
remote = "git.nerdcult.net"
template = "remote"
remote = "codeberg.org"
repository = "keymaps"
owner = "trinitrix"
authors = [
{ signature = "Soispha", username = "soispha" },
]
[packages]
authors = [{ signature = "Benedikt Peetz", username = "soispha" }]

View File

@ -7,11 +7,11 @@
]
},
"locked": {
"lastModified": 1703089493,
"narHash": "sha256-WUjYqUP/Lhhop9+aiHVFREgElunx1AHEWxqMT8ePfzo=",
"lastModified": 1714536327,
"narHash": "sha256-zu4+LcygJwdyFHunTMeDFltBZ9+hoWvR/1A7IEy7ChA=",
"owner": "ipetkov",
"repo": "crane",
"rev": "2a5136f14a9ac93d9d370d64a36026c5de3ae8a4",
"rev": "3124551aebd8db15d4560716d4f903bd44c64e4a",
"type": "github"
},
"original": {
@ -38,14 +38,16 @@
},
"flake-utils": {
"inputs": {
"systems": "systems"
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@ -56,16 +58,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1703349974,
"narHash": "sha256-BcR1wW63W4baNtWbpg25d/mt0DVkEBIFssAY9JPNpZg=",
"owner": "soispha",
"lastModified": 1714656196,
"narHash": "sha256-kjQkA98lMcsom6Gbhw8SYzmwrSo+2nruiTcTZp5jK7o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7e33c3c5db1c69a50efc2143ffa53539e8b4c0ed",
"rev": "94035b482d181af0a0f8f77823a790b256b7c3cc",
"type": "github"
},
"original": {
"owner": "soispha",
"ref": "licensure",
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -76,7 +78,9 @@
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
"rust-overlay": "rust-overlay",
"systems": "systems",
"treefmt-nix": "treefmt-nix"
}
},
"rust-overlay": {
@ -89,11 +93,11 @@
]
},
"locked": {
"lastModified": 1703297543,
"narHash": "sha256-d4QlzcoSNzb/iZheWtjOyRxoBSaLETSpViENGEkxv9g=",
"lastModified": 1714702555,
"narHash": "sha256-/NoUbE5S5xpK1FU3nlHhQ/tL126+JcisXdzy3Ng4pDU=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "fc77c8b416b1537522d30c710baaaaebf769f816",
"rev": "7f0e3ef7b7fbed78e12e5100851175d28af4b7c6",
"type": "github"
},
"original": {
@ -104,16 +108,36 @@
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"lastModified": 1680978846,
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"repo": "x86_64-linux",
"rev": "2ecfcac5e15790ba6ce360ceccddb15ad16d08a8",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"repo": "x86_64-linux",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1714058656,
"narHash": "sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m+whxRYUMiaA=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "c6aaf729f34a36c445618580a9f95a48f5e4e03f",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}

118
flake.nix
View File

@ -1,4 +1,6 @@
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
@ -15,35 +17,17 @@
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
# Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
#
# This file is part of the Trixy crate for Trinitrix.
#
# Trixy is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
{
description = "A rust crate which provides a standatised encoding for keycodes";
inputs = {
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs.url = "github:soispha/nixpkgs/licensure";
description = "A rust crate which provides a standardized encoding for key codes";
# inputs for following
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
crane = {
@ -52,10 +36,6 @@
nixpkgs.follows = "nixpkgs";
};
};
flake-utils = {
url = "github:numtide/flake-utils";
inputs = {};
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
@ -63,11 +43,29 @@
flake-utils.follows = "flake-utils";
};
};
# inputs for following
systems = {
url = "github:nix-systems/x86_64-linux"; # only evaluate for this system
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
flake-utils = {
url = "github:numtide/flake-utils";
inputs = {
systems.follows = "systems";
};
};
};
outputs = {
self,
nixpkgs,
crane,
flake-utils,
treefmt-nix,
crane,
rust-overlay,
...
}:
@ -78,54 +76,46 @@
};
nightly = false;
rust =
rust_minimal =
if nightly
then
(pkgs.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default))
.override {
extensions = ["rustc-codegen-cranelift-preview"];
}
else pkgs.rust-bin.stable.latest.default;
rust_min =
if nightly
then
(pkgs.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.minimal))
.override {
extensions = ["rustc-codegen-cranelift-preview"];
}
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.minimal)
else pkgs.rust-bin.stable.latest.minimal;
rust_default =
if nightly
then pkgs.rust-bin.selectLatestNightlyWith (toolchain: toolchain.default)
else pkgs.rust-bin.stable.latest.default;
craneLib = (crane.mkLib pkgs).overrideToolchain rust_min;
nativeBuildInputs = [];
buildInputs = [];
craneLib = (crane.mkLib pkgs).overrideToolchain rust_minimal;
craneBuild = craneLib.buildPackage {
src = craneLib.cleanCargoSource ./.;
doCheck = true;
inherit nativeBuildInputs buildInputs;
};
treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};
in {
checks.default = craneBuild;
packages = {
default = craneBuild;
packages.default = craneBuild;
checks = {
inherit craneBuild;
formatting = treefmtEval.config.build.check self;
};
formatter = treefmtEval.config.build.wrapper;
devShells.default = pkgs.mkShell {
packages = with pkgs; [
alejandra
cocogitto
licensure
rust
yq
rust_default
cargo-edit
cargo-expand
licensure
];
inherit nativeBuildInputs buildInputs;
};
});
}
# vim: ts=2

111
scripts/renew_copyright_header.sh Executable file
View File

@ -0,0 +1,111 @@
#! /usr/bin/env sh
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
# Keymaps is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
# NOTE: This is the line length of the .licensure.yml header template **plus** the extra
# line after the template comment.
TEMPLATE_LINE_LENGTH=20
LATEX_TEMPLATE_LINE_LENGTH=9
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
remove() {
extension="$1"
file="$2"
# We need to differentiate, when removing the old copyright header, as some
# formatters do weird things to the file
case "$extension" in
# normal '#' comments (these are $TEMPLATE_LINE_LENGTH lines long)
"Makefile" | "toml" | "envrc" | "yml" | "gitignore" | "awk" | "pest")
sed --in-place "1,${TEMPLATE_LINE_LENGTH}d" "$file"
;;
# LaTeX files (or TeX files in general) have a different license, use the
# $LATEX_TEMPLATE_LINE_LENGTH variable.
"tex")
sed --in-place "1,${LATEX_TEMPLATE_LINE_LENGTH}d" "$file"
;;
# normal '/* ... */' like comments (these are $TEMPLATE_LINE_LENGTH + 2 lines long)
"c" | "h" | "md" | "rs")
length="$((TEMPLATE_LINE_LENGTH + 2))"
sed --in-place "1,${length}d;" "$file"
;;
# alejandra (the nix formatter) removes the blank line after the comment,
# thus only $TEMPLATE_LINE_LENGTH - 1 lines
"nix")
length="$((TEMPLATE_LINE_LENGTH - 1))"
sed --in-place "1,${length}d;" "$file"
;;
# Shell needs a shebang on the first line, only after the first line can we
# remove the $TEMPLATE_LINE_LENGTH lines
"sh")
sed --in-place "2,${TEMPLATE_LINE_LENGTH}d;" "$file"
licensure --in-place "$file"
TEMPLATE_LINE_LENGTH_NEW="$(($(yq --raw-output '.licenses | map(.template) | join("")' "$PROJECT_ROOT/.licensure.yml" | wc -l) + $(yq '.comments | last | .commenter.trailing_lines' "$PROJECT_ROOT/.licensure.yml")))"
# delete the current shebang
to="$((TEMPLATE_LINE_LENGTH_NEW + 1))"
sed --in-place "${TEMPLATE_LINE_LENGTH_NEW},${to}d;" "$file"
# add a new one
sed --in-place "1i#! /usr/bin/env sh" "$file"
;;
*)
echo "File '$file' with extension '$extension' is not know yet, please add it!"
;;
esac
}
list() {
echo "$extension -> $file"
}
if [ -f "$1" ]; then
file="$(realpath "$1")"
filename="$(basename -- "$file")"
extension="${filename##*.}"
filename="${filename%.*}"
if [ -n "$DRY_RUN" ]; then
list "$extension" "$file"
else
remove "$extension" "$file"
fi
else
fd --type file --hidden . | while read -r file; do
if grep --quiet 'SPDX-License-Identifier' "$file"; then
filename="$(basename -- "$file")"
extension="${filename##*.}"
filename="${filename%.*}"
if [ -n "$DRY_RUN" ]; then
list "$extension" "$file"
else
remove "$extension" "$file"
fi
fi
done
if [ -z "$DRY_RUN" ]; then
licensure --in-place --project
nix fmt
fi
fi

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use std::{fmt::Display, num::ParseIntError};
use thiserror::Error;
@ -60,6 +61,7 @@ pub enum KeyValueParseError {
CantParseFNumber(#[from] ParseIntError),
}
#[cfg(feature = "crossterm")]
#[derive(Error, Debug)]
pub enum KeyFromCrossterm {
#[error("Can not parse non Key event to a Key code: ('{0:?}')")]

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use crossterm::event::{Event, KeyCode, KeyEvent, KeyEventKind, KeyEventState, KeyModifiers};
use crate::{error, key_repr::KeyValue};

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
#[cfg(feature = "crossterm")]
mod crossterm;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,12 +20,14 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use std::{fmt::Debug, hash::Hash, marker, str::FromStr};
use pest::{iterators::Pair, Parser};
use crate::{error, key_repr::{KeyValue, key::Rule}};
use crate::{
error,
key_repr::{key::Rule, KeyValue},
};
use super::Key;

View File

@ -1,4 +1,6 @@
// Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
// Copyright (C) 2024 - 2024:
// The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
// SPDX-License-Identifier: LGPL-3.0-or-later
//
// This file is part of the Keymaps crate for Trinitrix.
//
@ -16,7 +18,6 @@
// and the Lesser GNU General Public License along with this program.
// If not, see <https://www.gnu.org/licenses/>.
angular_bracket_open = _{ "<" }
abo = _{ angular_bracket_open }
angular_bracket_close = _{ ">" }

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use crossterm::event::KeyCode;
use super::KeyValue;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
#[cfg(feature = "crossterm")]
mod crossterm;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use pest::Parser;
use pest_derive::Parser;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
pub mod key;
pub mod key_value;
pub mod keys;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
pub mod error;
pub mod key_repr;
pub mod trie;
pub mod error;

View File

@ -1,5 +1,7 @@
/*
* Copyright (C) 2023 The Trinitrix Project <soispha@vhack.eu, antifallobst@systemausfall.org>
* Copyright (C) 2024 - 2024:
* The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
* SPDX-License-Identifier: LGPL-3.0-or-later
*
* This file is part of the Keymaps crate for Trinitrix.
*
@ -18,7 +20,6 @@
* If not, see <https://www.gnu.org/licenses/>.
*/
use std::collections::HashMap;
use log::info;

92
treefmt.nix Normal file
View File

@ -0,0 +1,92 @@
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
# Keymaps is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
{
treefmt-nix,
pkgs,
}:
treefmt-nix.lib.evalModule pkgs (
{pkgs, ...}: {
# Used to find the project root
projectRootFile = "flake.nix";
programs = {
alejandra.enable = true;
rustfmt.enable = true;
clang-format.enable = true;
mdformat.enable = true;
shfmt = {
enable = true;
indent_size = 4;
};
shellcheck.enable = true;
prettier = {
settings = {
arrowParens = "always";
bracketSameLine = false;
bracketSpacing = true;
editorconfig = true;
embeddedLanguageFormatting = "auto";
endOfLine = "lf";
# experimentalTernaries = false;
htmlWhitespaceSensitivity = "css";
insertPragma = false;
jsxSingleQuote = true;
printWidth = 80;
proseWrap = "always";
quoteProps = "consistent";
requirePragma = false;
semi = true;
singleAttributePerLine = true;
singleQuote = true;
trailingComma = "all";
useTabs = false;
vueIndentScriptAndStyle = false;
tabWidth = 4;
overrides = {
files = ["*.js"];
options.tabwidth = 2;
};
};
};
stylua.enable = true;
ruff = {
enable = true;
format = true;
};
taplo.enable = true;
};
settings = {
global.excludes = [
"CHANGELOG.md"
"NEWS.md"
];
formatter = {
clang-format = {
options = ["--style" "GNU"];
};
shfmt = {
includes = ["*.bash"];
};
};
};
}
)

24
update.sh Executable file
View File

@ -0,0 +1,24 @@
#! /usr/bin/env sh
# Copyright (C) 2024 - 2024:
# The Trinitrix Project <bpeetz@b-peetz.de, antifallobst@systemausfall.org>
# SPDX-License-Identifier: LGPL-3.0-or-later
#
# This file is part of the Keymaps crate for Trinitrix.
#
# Keymaps is free software: you can redistribute it and/or modify
# it under the terms of the Lesser GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# and the Lesser GNU General Public License along with this program.
# If not, see <https://www.gnu.org/licenses/>.
nix flake update
cargo update
[ "$1" = "upgrade" ] && cargo upgrade