diff --git a/config/sway/config b/config/sway/config index f60366e9..ca55844d 100644 --- a/config/sway/config +++ b/config/sway/config @@ -236,7 +236,6 @@ default_border pixel 3 input * { xkb_layout "gb" - # xkb_options "caps:swapescape" } input type:touchpad { @@ -250,7 +249,6 @@ smart_gaps on gaps inner 10 exec configure-gtk -exec configue-keyboard bindsym --locked XF86AudioLowerVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- -l 1.2 bindsym --locked XF86AudioRaiseVolume exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ -l 1.2 diff --git a/home-manager/modules/zsh.nix b/home-manager/modules/zsh.nix index ff476670..38335bf5 100644 --- a/home-manager/modules/zsh.nix +++ b/home-manager/modules/zsh.nix @@ -5,12 +5,6 @@ dotDir = ".config/zsh"; initExtra = '' - # Make Caps Lock behave like Ctrl. - setxkbmap -option ctrl:nocaps - - # Make short-pressed Ctrl behave like Escape. - xcape -e 'Control_L=Escape' - # Plugins source "''${ZPLUG_REPOS}/robbyrussell/oh-my-zsh/plugins/git/git.plugin.zsh" source "''${ZPLUG_REPOS}/robbyrussell/oh-my-zsh/plugins/vi-mode/vi-mode.plugin.zsh" diff --git a/system/nixos/nixedo/configuration.nix b/system/nixos/nixedo/configuration.nix index a3faa0ef..2ae9e7f2 100644 --- a/system/nixos/nixedo/configuration.nix +++ b/system/nixos/nixedo/configuration.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: let nixpkgs = import ../../shared/nixpkgs.nix { }; @@ -175,5 +175,27 @@ in { [ (nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" ]; }) ]; zramSwap.enable = true; + + # Make Caps lock work as an Escape key on press and Ctrl on hold. + services.interception-tools = + let + dfkConfig = pkgs.writeText "dual-function-keys.yaml" '' + MAPPINGS: + - KEY: KEY_CAPSLOCK + TAP: KEY_ESC + HOLD: KEY_LEFTCTRL + ''; + in + { + enable = true; + plugins = lib.mkForce [ pkgs.interception-tools-plugins.dual-function-keys ]; + udevmonConfig = '' + - JOB: "${pkgs.interception-tools}/bin/intercept -g $DEVNODE | ${pkgs.interception-tools-plugins.dual-function-keys}/bin/dual-function-keys -c ${dfkConfig} | ${pkgs.interception-tools}/bin/uinput -d $DEVNODE" + DEVICE: + NAME: "AT Translated Set 2 keyboard" + EVENTS: + EV_KEY: [[KEY_CAPSLOCK, KEY_ESC, KEY_LEFTCTRL]] + ''; + }; }