26 lines
		
	
	
	
		
			835 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
		
		
			
		
	
	
			26 lines
		
	
	
	
		
			835 B
		
	
	
	
		
			Nix
		
	
	
	
	
	
|  | { pkgs, ... }: | ||
|  | 
 | ||
|  | { | ||
|  |   # 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 = pkgs.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]] | ||
|  |       '';
 | ||
|  |     }; | ||
|  | } |