From 4977346e60641b480ecc61b67adcf6b091fe174e Mon Sep 17 00:00:00 2001 From: js0ny Date: Fri, 14 Nov 2025 05:59:53 +0000 Subject: [PATCH] feat(xremap): keyd alternative, better wl support --- home/dot_config/niri/config.kdl | 2 + nixcfgs/flake.lock | 666 +++++++++++++++++- nixcfgs/flake.nix | 9 +- nixcfgs/hosts/zephyrus/default.nix | 1 + nixcfgs/hosts/zephyrus/keyd.nix | 9 +- nixcfgs/modules/nixos/desktop/de/gnome.nix | 1 + nixcfgs/modules/nixos/desktop/de/hyprland.nix | 2 +- nixcfgs/modules/nixos/desktop/de/kde.nix | 5 + nixcfgs/modules/nixos/desktop/de/sway.nix | 7 +- nixcfgs/modules/nixos/desktop/xremap.nix | 54 ++ nixcfgs/modules/nixos/hardware/uinput.nix | 8 + 11 files changed, 734 insertions(+), 30 deletions(-) create mode 100644 nixcfgs/modules/nixos/desktop/xremap.nix create mode 100644 nixcfgs/modules/nixos/hardware/uinput.nix diff --git a/home/dot_config/niri/config.kdl b/home/dot_config/niri/config.kdl index 4421df8..fe58747 100644 --- a/home/dot_config/niri/config.kdl +++ b/home/dot_config/niri/config.kdl @@ -2,6 +2,8 @@ // "/-" comments out the following node. // Check the wiki for a full description of the configuration: // https://github.com/YaLTeR/niri/wiki/Configuration:-Introduction +// This is deprecated, see: +// ~/.dotfiles/nixcfgs/users/js0ny/programs/desktop/wayland-wm/niri/default.nix /// Startup Applications diff --git a/nixcfgs/flake.lock b/nixcfgs/flake.lock index 133d46b..85f7b46 100644 --- a/nixcfgs/flake.lock +++ b/nixcfgs/flake.lock @@ -1,5 +1,42 @@ { "nodes": { + "aquamarine": { + "inputs": { + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "xremap-flake", + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751740947, + "narHash": "sha256-35040CHH7P3JGmhGVfEb2oJHL/A5mI2IXumhkxrBnao=", + "owner": "hyprwm", + "repo": "aquamarine", + "rev": "dfc1db15a08c4cd234288f66e1199c653495301f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "aquamarine", + "type": "github" + } + }, "caelestia-cli": { "inputs": { "caelestia-shell": [ @@ -46,6 +83,55 @@ "type": "github" } }, + "crane": { + "locked": { + "lastModified": 1751562746, + "narHash": "sha256-smpugNIkmDeicNz301Ll1bD7nFOty97T79m4GUMUczA=", + "owner": "ipetkov", + "repo": "crane", + "rev": "aed2020fd3dc26e1e857d4107a5a67a33ab6c1fd", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "devshell": { + "inputs": { + "nixpkgs": "nixpkgs_4" + }, + "locked": { + "lastModified": 1741473158, + "narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", + "owner": "numtide", + "repo": "devshell", + "rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -67,21 +153,44 @@ "type": "github" } }, - "flake-utils": { + "flake-parts_2": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "lastModified": 1751413152, + "narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "xremap-flake", + "hyprland", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", "type": "github" } }, @@ -105,6 +214,305 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1756842514, + "narHash": "sha256-XbtRMewPGJwTNhBC4pnBu3w/xT1XejvB0HfohC2Kga8=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "30fc1b532645a21e157b6e33e3f8b4c154f86382", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "hyprcursor": { + "inputs": { + "hyprlang": [ + "xremap-flake", + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1749155331, + "narHash": "sha256-XR9fsI0zwLiFWfqi/pdS/VD+YNorKb3XIykgTg4l1nA=", + "owner": "hyprwm", + "repo": "hyprcursor", + "rev": "45fcc10b4c282746d93ec406a740c43b48b4ef80", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprgraphics": { + "inputs": { + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751808145, + "narHash": "sha256-OXgL0XaKMmfX2rRQkt9SkJw+QNfv0jExlySt1D6O72g=", + "owner": "hyprwm", + "repo": "hyprgraphics", + "rev": "b841473a0bd4a1a74a0b64f1ec2ab199035c349f", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprgraphics", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "aquamarine": "aquamarine", + "hyprcursor": "hyprcursor", + "hyprgraphics": "hyprgraphics", + "hyprland-protocols": "hyprland-protocols", + "hyprland-qtutils": "hyprland-qtutils", + "hyprlang": "hyprlang", + "hyprutils": "hyprutils", + "hyprwayland-scanner": "hyprwayland-scanner", + "nixpkgs": "nixpkgs_6", + "pre-commit-hooks": "pre-commit-hooks", + "systems": "systems", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1751995875, + "narHash": "sha256-ud9sl1RjmzAzalH2ocmGPs182xvr7GktjVIYvzJamwo=", + "owner": "hyprwm", + "repo": "Hyprland", + "rev": "9517d0eaa4ef93de67dc80fecca7a826f7ad556d", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "Hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1749046714, + "narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprland-qt-support": { + "inputs": { + "hyprlang": [ + "xremap-flake", + "hyprland", + "hyprland-qtutils", + "hyprlang" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "hyprland-qtutils", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "hyprland-qtutils", + "systems" + ] + }, + "locked": { + "lastModified": 1749154592, + "narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=", + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qt-support", + "type": "github" + } + }, + "hyprland-qtutils": { + "inputs": { + "hyprland-qt-support": "hyprland-qt-support", + "hyprlang": [ + "xremap-flake", + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprland-qtutils", + "hyprlang", + "hyprutils" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1750371812, + "narHash": "sha256-D868K1dVEACw17elVxRgXC6hOxY+54wIEjURztDWLk8=", + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "rev": "b13c7481e37856f322177010bdf75fccacd1adc8", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-qtutils", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprutils" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1750371198, + "narHash": "sha256-/iuJ1paQOBoSLqHflRNNGyroqfF/yvPNurxzcCT0cAE=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "cee01452bca58d6cadb3224e21e370de8bc20f0b", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, + "hyprutils": { + "inputs": { + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751888065, + "narHash": "sha256-F2SV9WGqgtRsXIdUrl3sRe0wXlQD+kRRZcSfbepjPJY=", + "owner": "hyprwm", + "repo": "hyprutils", + "rev": "a8229739cf36d159001cfc203871917b83fdf917", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprutils", + "type": "github" + } + }, + "hyprwayland-scanner": { + "inputs": { + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751881472, + "narHash": "sha256-meB0SnXbwIe2trD041MLKEv6R7NZ759QwBcVIhlSBfE=", + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "rev": "8fb426b3e5452fd9169453fd6c10f8c14ca37120", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprwayland-scanner", + "type": "github" + } + }, "niri-flake": { "inputs": { "niri-stable": "niri-stable", @@ -213,6 +621,21 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1751159883, + "narHash": "sha256-urW/Ylk9FIfvXfliA1ywh75yszAbiTEVgpPeinFyVZo=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "14a40a1d7fb9afa4739275ac642ed7301a9ba1ab", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1762756533, @@ -277,6 +700,86 @@ "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1722073938, + "narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1756542300, + "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1751792365, + "narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_7": { + "locked": { + "lastModified": 1756819007, + "narHash": "sha256-12V64nKG/O/guxSYnr5/nq1EfqwJCdD2+cIGmhz3nrE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "aaff8c16d7fc04991cac6245bee1baa31f72b1e1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_8": { + "locked": { + "lastModified": 1747958103, + "narHash": "sha256-qmmFCrfBwSHoWw7cVK4Aj+fns+c54EBP8cGqp/yK410=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "fe51d34885f7b5e3e7b59572796e1bcb427eccb1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nur": { "inputs": { "flake-parts": "flake-parts", @@ -319,6 +822,30 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1750779888, + "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", + "owner": "cachix", + "repo": "git-hooks.nix", + "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "git-hooks.nix", + "type": "github" + } + }, "quickshell": { "inputs": { "nixpkgs": [ @@ -343,7 +870,6 @@ "root": { "inputs": { "caelestia-shell": "caelestia-shell", - "flake-utils": "flake-utils", "home-manager": "home-manager", "niri-flake": "niri-flake", "nix-darwin": "nix-darwin", @@ -352,7 +878,8 @@ "nixpkgs-stable": "nixpkgs-stable_2", "nur": "nur", "plasma-manager": "plasma-manager", - "sops-nix": "sops-nix" + "sops-nix": "sops-nix", + "xremap-flake": "xremap-flake" } }, "sops-nix": { @@ -377,16 +904,123 @@ }, "systems": { "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default", + "repo": "default-linux", + "type": "github" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_8" + }, + "locked": { + "lastModified": 1750931469, + "narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "xremap-flake", + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "xremap-flake", + "hyprland", + "hyprlang" + ], + "hyprutils": [ + "xremap-flake", + "hyprland", + "hyprutils" + ], + "hyprwayland-scanner": [ + "xremap-flake", + "hyprland", + "hyprwayland-scanner" + ], + "nixpkgs": [ + "xremap-flake", + "hyprland", + "nixpkgs" + ], + "systems": [ + "xremap-flake", + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1751300244, + "narHash": "sha256-PFuv1TZVYvQhha0ac53E3YgdtmLShrN0t4T6xqHl0jE=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "6115f3fdcb2c1a57b4a80a69f3c797e47607b90a", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" + } + }, + "xremap": { + "flake": false, + "locked": { + "lastModified": 1762012494, + "narHash": "sha256-UHkwTz5KEDAqXKpN/YVzY0xP7b6nN8WkPilzpF8YU3A=", + "owner": "k0kubun", + "repo": "xremap", + "rev": "99d8c2b93ec04dc189531ca499f155178823e733", + "type": "github" + }, + "original": { + "owner": "k0kubun", + "ref": "v0.14.3", + "repo": "xremap", + "type": "github" + } + }, + "xremap-flake": { + "inputs": { + "crane": "crane", + "devshell": "devshell", + "flake-parts": "flake-parts_2", + "home-manager": "home-manager_2", + "hyprland": "hyprland", + "nixpkgs": "nixpkgs_7", + "treefmt-nix": "treefmt-nix", + "xremap": "xremap" + }, + "locked": { + "lastModified": 1762222968, + "narHash": "sha256-sdeaXvOItorlV0WQgF9CDiVquQllVspWx1fmxU2dgLY=", + "owner": "xremap", + "repo": "nix-flake", + "rev": "066fd14ac7dd824fa6bba5a6fc83adfa41640528", + "type": "github" + }, + "original": { + "owner": "xremap", + "repo": "nix-flake", "type": "github" } }, diff --git a/nixcfgs/flake.nix b/nixcfgs/flake.nix index f4b03e0..ed18bbe 100644 --- a/nixcfgs/flake.nix +++ b/nixcfgs/flake.nix @@ -6,7 +6,7 @@ nixpkgs-stable.url = "github:nixOS/nixpkgs/nixos-25.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nix-flatpak.url = "github:gmodena/nix-flatpak"; - flake-utils.url = "github:numtide/flake-utils"; + # flake-utils.url = "github:numtide/flake-utils"; nix-darwin = { url = "github:nix-darwin/nix-darwin/master"; inputs.nixpkgs.follows = "nixpkgs"; @@ -21,15 +21,20 @@ inputs.home-manager.follows = "home-manager"; }; nur.url = "github:nix-community/NUR"; + # caelestia-shell - shell for wms caelestia-shell = { url = "github:caelestia-dots/shell"; inputs.nixpkgs.follows = "nixpkgs"; }; + # sops - Secrets sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + # Niri - Wayland Window Manager niri-flake.url = "github:sodiboo/niri-flake"; + # xremap - kay remapper like keyd + xremap-flake.url = "github:xremap/nix-flake"; }; outputs = { @@ -44,6 +49,7 @@ caelestia-shell, sops-nix, niri-flake, + xremap-flake, ... } @ inputs: let overlays = [ @@ -70,6 +76,7 @@ system = "x86_64-linux"; inherit specialArgs; modules = [ + xremap-flake.nixosModules.default sops-nix.nixosModules.sops ./hosts/${hostname} {nixpkgs.overlays = overlays;} diff --git a/nixcfgs/hosts/zephyrus/default.nix b/nixcfgs/hosts/zephyrus/default.nix index f8cd53f..7d5aad2 100644 --- a/nixcfgs/hosts/zephyrus/default.nix +++ b/nixcfgs/hosts/zephyrus/default.nix @@ -22,6 +22,7 @@ # Services ../../modules/nixos/desktop/wayvnc.nix ../../modules/nixos/core/sshd.nix + ../../modules/nixos/desktop/xremap.nix # desktop environment and display manager ../../modules/nixos/desktop/dm/sddm.nix diff --git a/nixcfgs/hosts/zephyrus/keyd.nix b/nixcfgs/hosts/zephyrus/keyd.nix index e592637..4cd93bc 100644 --- a/nixcfgs/hosts/zephyrus/keyd.nix +++ b/nixcfgs/hosts/zephyrus/keyd.nix @@ -1,10 +1,7 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - keyd - ]; - +{...}: { + # Disable for now, currently trying xremap and katana services.keyd = { - enable = true; + enable = false; keyboards = { externalKeyboard = { ids = ["0b05:19b6:d167885d"]; # ASUS Keyboard diff --git a/nixcfgs/modules/nixos/desktop/de/gnome.nix b/nixcfgs/modules/nixos/desktop/de/gnome.nix index f80ecfc..4e85a21 100644 --- a/nixcfgs/modules/nixos/desktop/de/gnome.nix +++ b/nixcfgs/modules/nixos/desktop/de/gnome.nix @@ -13,4 +13,5 @@ papers gtop ]; + services.xremap.withGnome = true; } diff --git a/nixcfgs/modules/nixos/desktop/de/hyprland.nix b/nixcfgs/modules/nixos/desktop/de/hyprland.nix index c659259..544666b 100644 --- a/nixcfgs/modules/nixos/desktop/de/hyprland.nix +++ b/nixcfgs/modules/nixos/desktop/de/hyprland.nix @@ -9,7 +9,7 @@ # caelestia-shell xdg-desktop-portal-hyprland hyprpolkitagent - grimblast xdg-desktop-portal-wlr ]; + services.xremap.withHypr = true; } diff --git a/nixcfgs/modules/nixos/desktop/de/kde.nix b/nixcfgs/modules/nixos/desktop/de/kde.nix index 233c652..614bcc9 100644 --- a/nixcfgs/modules/nixos/desktop/de/kde.nix +++ b/nixcfgs/modules/nixos/desktop/de/kde.nix @@ -5,4 +5,9 @@ korganizer kdepim-addons ]; + # NOTE: Upstream does not support running withKDE as root + services.xremap = { + serviceMode = "user"; + userName = "js0ny"; + }; } diff --git a/nixcfgs/modules/nixos/desktop/de/sway.nix b/nixcfgs/modules/nixos/desktop/de/sway.nix index 9767b09..be168f5 100644 --- a/nixcfgs/modules/nixos/desktop/de/sway.nix +++ b/nixcfgs/modules/nixos/desktop/de/sway.nix @@ -1,13 +1,8 @@ {pkgs, ...}: { - imports = [ - ./wayland-wm.nix - ]; programs.sway.enable = true; programs.sway.xwayland.enable = true; + services.xremap.withWlroots = true; environment.systemPackages = with pkgs; [ - swaybg - sway-contrib.grimshot - waybar xdg-desktop-portal-wlr ]; } diff --git a/nixcfgs/modules/nixos/desktop/xremap.nix b/nixcfgs/modules/nixos/desktop/xremap.nix new file mode 100644 index 0000000..6e4ca4b --- /dev/null +++ b/nixcfgs/modules/nixos/desktop/xremap.nix @@ -0,0 +1,54 @@ +{...}: { + imports = [ + ../hardware/uinput.nix + ]; + + # Keycode: https://github.com/emberian/evdev/blob/1d020f11b283b0648427a2844b6b980f1a268221/src/scancodes.rs#L15 + # Alias for mods: + # SHIFT- + # CTRL-, C-, CONTROL- + # ALT-, M- + # WIN-, SUPER-, WINDOWS- + + services.xremap = { + enable = true; + # modmap: single key + serviceMode = "user"; + userName = "js0ny"; + config = { + modmap = [ + { + name = "Global"; + device = { + not = [ + ### QMK Keyboards + # Nuphy Air 75 V2 + "/dev/input/by-id/usb-Nordic_Semiconductor_NuPhy_Air75_V2_Dongle-if01-event-kbd" + "/dev/input/by-id/usb-Nordic_Semiconductor_NuPhy_Air75_V2_Dongle-event-kbd" + "/dev/input/by-id/usb-Nordic_Semiconductor_NuPhy_Air75_V2_Dongle-if01-event-mouse" + ]; + }; + remap = { + "KEY_CAPSLOCK" = { + held = "KEY_LEFTCTRL"; + alone = "KEY_ESC"; + free_hold = true; + }; + }; + } + ]; + keymap = [ + { + name = "Telegram Navigator"; + application = { + only = ["org.telegram.desktop" "telegram-desktop"]; + }; + remap = { + "M-j" = "M-down"; # alt.j = macro(C-tab) + "M-k" = "M-up"; # alt.k = C-S-tab + }; + } + ]; + }; + }; +} diff --git a/nixcfgs/modules/nixos/hardware/uinput.nix b/nixcfgs/modules/nixos/hardware/uinput.nix new file mode 100644 index 0000000..c553afd --- /dev/null +++ b/nixcfgs/modules/nixos/hardware/uinput.nix @@ -0,0 +1,8 @@ +{...}: { + hardware.uinput.enable = true; + boot.kernelModules = ["uinput"]; + services.udev.extraRules = '' + KERNEL=="uinput", GROUP="input", TAG+="uaccess" + ''; + users.users.js0ny.extraGroups = ["input" "uinput"]; +}