diff --git a/draw/default.nix b/draw/default.nix
index f507302..23eb43f 100644
--- a/draw/default.nix
+++ b/draw/default.nix
@@ -1,42 +1,47 @@
{
lib,
buildPythonApplication,
- fetchPypi,
+ callPackage,
+ fetchFromGitHub,
poetry-core,
pydantic,
pcpp,
- pyparsing,
pyyaml,
platformdirs,
pydantic-settings,
-}:
-buildPythonApplication rec {
- pname = "keymap-drawer";
- version = "0.18.1";
- pyproject = true;
+ tree-sitter,
+}: let
+ tree-sitter-devicetree = callPackage ./tree-sitter-devicetree.nix {};
+in
+ buildPythonApplication rec {
+ pname = "keymap-drawer";
+ version = "0.20.0";
+ pyproject = true;
- src = fetchPypi {
- pname = "keymap_drawer";
- inherit version;
- hash = "sha256-MHjxsopXoYWZFuXUbeaI7BCSx3HkRaeVidY+mc8lj+s=";
- };
+ src = fetchFromGitHub {
+ owner = "caksoylar";
+ repo = pname;
+ rev = "ea00f44ac5a2ebe97b8b31f9166791bedf9136e5";
+ hash = "sha256-F9lDUuqHKl2FOUsUszJrRK7/a/a1UJLw+RUg9Bv2zN0=";
+ };
- build-system = [poetry-core];
+ build-system = [poetry-core];
- propagatedBuildInputs = [
- pydantic
- pcpp
- pyparsing
- pyyaml
- platformdirs
- pydantic-settings
- ];
+ propagatedBuildInputs = [
+ pydantic
+ pcpp
+ pyyaml
+ platformdirs
+ pydantic-settings
+ tree-sitter
+ tree-sitter-devicetree
+ ];
- doCheck = false;
+ doCheck = false;
- meta = {
- homepage = "https://github.com/caksoylar/keymap-drawer";
- description = "Parse QMK & ZMK keymaps and draw them as vector graphics";
- license = lib.licenses.mit;
- };
-}
+ meta = {
+ homepage = "https://github.com/caksoylar/keymap-drawer";
+ description = "Parse QMK & ZMK keymaps and draw them as vector graphics";
+ license = lib.licenses.mit;
+ };
+ }
diff --git a/draw/keymap.svg b/draw/keymap.svg
index c75c890..43777b3 100644
--- a/draw/keymap.svg
+++ b/draw/keymap.svg
@@ -67,8 +67,8 @@ text.footer {
paint-order: stroke;
}
-/* styling for combo tap, and key hold/shifted label text */
-text.combo, text.hold, text.shifted {
+/* styling for combo tap, and key non-tap label text */
+text.combo, text.hold, text.shifted, text.left, text.right {
font-size: 11px;
}
@@ -82,12 +82,20 @@ text.shifted {
dominant-baseline: hanging;
}
+text.left {
+ text-anchor: start;
+}
+
+text.right {
+ text-anchor: end;
+}
+
text.layer-activator {
text-decoration: underline;
}
/* styling for hold/shifted label text in combo box */
-text.combo.hold, text.combo.shifted {
+text.combo.hold, text.combo.shifted, text.combo.left, text.combo.right {
font-size: 8px;
}
@@ -233,7 +241,7 @@ path.combo {
-&caps_word
+TAB
LEFT
@@ -245,16 +253,18 @@ path.combo {
-TAB
-
-others
-
-
-
LSHIFT
others
-
+&caps_word
+
+
+
+RSHIFT
+
+others
+&caps_word
+
BSPC
diff --git a/draw/tree-sitter-devicetree.nix b/draw/tree-sitter-devicetree.nix
new file mode 100644
index 0000000..fdc96d4
--- /dev/null
+++ b/draw/tree-sitter-devicetree.nix
@@ -0,0 +1,39 @@
+{
+ lib,
+ buildPythonPackage,
+ fetchFromGitHub,
+ setuptools,
+ tree-sitter,
+}:
+buildPythonPackage {
+ pname = "tree-sitter-devicetree";
+ version = "0.12.1";
+ pyproject = true;
+
+ src = fetchFromGitHub {
+ owner = "joelspadin";
+ repo = "tree-sitter-devicetree";
+ rev = "16c9cb959675bc9bc4f4e5bebe473d511a12a06d";
+ hash = "sha256-UVxLF4IKRXexz+PbSlypS/1QsWXkS/iYVbgmFCgjvZM=";
+ };
+
+ build-system = [
+ setuptools
+ ];
+
+ optional-dependencies = {
+ core = [
+ tree-sitter
+ ];
+ };
+
+ # There are no tests
+ doCheck = false;
+ pythonImportsCheck = ["tree_sitter_devicetree"];
+
+ meta = {
+ description = "Devicetree grammar for tree-sitter";
+ homepage = "https://github.com/joelspadin/tree-sitter-devicetree";
+ license = lib.licenses.mit;
+ };
+}