Escape key not working

Not a single clue on how to document this issue outside of a video, but with Nixos I am having an issue where my escape key just isn’t registering. I have tested if it’s related to my keyboard by swapping my pro micro based sofle for an stm32 based obe, no changes. I’ve swapped the switches on both keyboards, no change. I switched usb ports, nothing. Even swapped cables, and still no change. Both keyboards behave normally on my Arch based laptop too. To make matters weirder, if I shift the keyboards into a different layer, the key works. Either I messed up my config file to not register KC_ESCAPE or I broke something somewhere.

1 Like

Post your config somewhere, or we’re just playing guessing games.

From nix-shell -p libinput, can you run sudo libinput debug-events --show-keycodes and share what it prints when you press the escape key?

1 Like

debug shows that the escape key is registering
[nix-shell:/etc/nixos]$ sudo libinput debug-events --show-keycodes
-event1 DEVICE_ADDED Power Button seat0 default group1 cap:k
-event0 DEVICE_ADDED Power Button seat0 default group2 cap:k
-event11 DEVICE_ADDED Logitech G305 seat0 default group3 cap:kp left scroll-nat scroll-button
-event12 DEVICE_ADDED JosefAdamcik Sofle seat0 default group4 cap:k
-event13 DEVICE_ADDED JosefAdamcik Sofle System Control seat0 default group4 cap:k
-event14 DEVICE_ADDED JosefAdamcik Sofle Consumer Control seat0 default group4 cap:kp scroll-nat
-event12 KEYBOARD_KEY +0.172s KEY_ESC (1) pressed
event12 KEYBOARD_KEY +1.593s KEY_ESC (1) released
event12 KEYBOARD_KEY +1.675s KEY_ESC (1) pressed
event12 KEYBOARD_KEY +6.737s KEY_ESC (1) released
event12 KEYBOARD_KEY +6.738s KEY_LEFTCTRL (29) pressed
event12 KEYBOARD_KEY +6.823s KEY_C (46) pressed

here is my config, its barely changed from the default

[nix-shell:/etc/nixos]$ cat configuration.nix

Edit this configuration file to define what should be installed on

your system.  Help is available in the configuration.nix(5) man page

and in the NixOS manual (accessible by running ‘nixos-help’).

{ config, pkgs, … }:

{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];

Bootloader.

boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;

Use latest kernel.

boot.kernelPackages = pkgs.linuxPackages_latest;

boot.kernelParams = [“acpi_enforce_resourves=lax”];

networking.hostName = “nixos”; # Define your hostname.

networking.wireless.enable = true;  # Enables wireless support via wpa_supplicant.

Configure network proxy if necessary

networking.proxy.default = “http://user:password@proxy:port/”;

networking.proxy.noProxy = “127.0.0.1,localhost,internal.domain”;

Enable networking

networking.networkmanager.enable = true;

Set your time zone.

time.timeZone = “America/Chicago”;

Select internationalisation properties.

i18n.defaultLocale = “en_US.UTF-8”;

i18n.extraLocaleSettings = {
LC_ADDRESS = “en_US.UTF-8”;
LC_IDENTIFICATION = “en_US.UTF-8”;
LC_MEASUREMENT = “en_US.UTF-8”;
LC_MONETARY = “en_US.UTF-8”;
LC_NAME = “en_US.UTF-8”;
LC_NUMERIC = “en_US.UTF-8”;
LC_PAPER = “en_US.UTF-8”;
LC_TELEPHONE = “en_US.UTF-8”;
LC_TIME = “en_US.UTF-8”;
};

Enable the X11 windowing system.

You can disable this if you’re only using the Wayland session.

services.xserver.enable = true;

Enable the KDE Plasma Desktop Environment.

services.displayManager.sddm.enable = true;
services.displayManager.sddm.theme = “where-is-my-sddm-theme”;
services.desktopManager.plasma6.enable = true;
security.pam.services.login.fprintAuth = false;

Configure keymap in X11

services.xserver.xkb = {
layout = “us”;
variant = “”;
};

Enable CUPS to print documents.

services.printing.enable = true;

fileSystems.“/mnt/extragames” = {
device = “/dev/disk/by-uuid/0e7a3ea3-e59c-46e7-8ea5-3e69a0dd217b”;
fsType = “ext4”;
options = [
“users”
“nofail”
];
};

fileSystems.“/mnt/bigstore” = {
device = “/dev/disk/by-uuid/c00e6fd1-eb07-4582-847f-25b9588b57c0”;
fsType = “ext4”;
options = [
“users”
“nofail”
];
};

Enable sound with pipewire.

services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;

# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;

};

Enable touchpad support (enabled default in most desktopManager).

services.xserver.libinput.enable = true;

Define a user account. Don’t forget to set a password with ‘passwd’.

users.users.quack = {
isNormalUser = true;
description = “quack”;
extraGroups = [ “networkmanager” “wheel” ];
packages = with pkgs; [
kdePackages.kate
thunderbird
ardour
openrgb
openutau
gimp2-with-plugins
ungoogled-chromium
vesktop
gamescope
gamemode
lutris
protonup-qt
blender
davinci-resolve
obs-studio
obsidian
heroic
];
};

fih for user quack as default shell, dont use fih as default for root

programs.fish.enable = true;
users.users.quack.shell = pkgs.fish;

nvidia shit

hardware.graphics.enable = true;
hardware.graphics.enable32Bit = true;
services.xserver.videoDrivers = [ “nvidia” ];
hardware.nvidia.open = true; # see note above

Wayland requires kernel mode setting (KMS) to be enabled

hardware.nvidia.modesetting.enable = true;

gamemode

programs.gamemode.enable = true; # for preformance mode

steam

programs.steam = {
enable = true; # install steam
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Opens ports in the firewall for Source Dedicated Server
};

Install firefox.

programs.firefox.enable = true;

Allow unfree packages

nixpkgs.config.allowUnfree = true;

nvim even though vim is just fine

programs.neovim = {
enable = true;
defaultEditor = true;
};

need to switch to grub or else i cant get this shit to work

services.hardware.openrgb.enable = true;

List packages installed in system profile. To search, run:

environment.systemPackages = with pkgs; [
vim
wget
kitty
fastfetch
macchina
hyfetch
htop
starship
git
i2c-tools
fd
ripgrep
where-is-my-sddm-theme
kdePackages.partitionmanager
ranger
];

Some programs need SUID wrappers, can be configured further or are

started in user sessions.

programs.mtr.enable = true;

programs.gnupg.agent = {

enable = true;

enableSSHSupport = true;

};

List services that you want to enable:

Enable the OpenSSH daemon.

services.openssh.enable = true;

Open ports in the firewall.

networking.firewall.allowedTCPPorts = [ … ];

networking.firewall.allowedUDPPorts = [ … ];

Or disable the firewall altogether.

networking.firewall.enable = false;

This value determines the NixOS release from which the default

settings for stateful data, like file locations and database versions

on your system were taken. It‘s perfectly fine and recommended to leave

this value at the release version of the first install of this system.

Before changing this value read the documentation for this option

(e.g. man configuration.nix or on https://nixos.org/nixos/options.html).

system.stateVersion = “25.11”; # Did you read the comment?

}

Okay, definitely software then. That’s good; we should be able to get to the bottom of this.

Can you edit or repost your config in a format that I can copy? You seem to have clipped off the comment #s, among other distortions.

Here in Discourse, it’s best to delimit chunks of Nix code with triple-backticks, like this:

```
{ config, pkgs, ... }:
# your whole file
```

i have an idea that this might be a kde issue

{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  boot.kernelPackages = pkgs.linuxPackages_latest;
# boot.kernelParams = ["acpi_enforce_resourves=lax"];

  networking.hostName = "nixos";
  networking.networkmanager.enable = true;

  time.timeZone = "America/Chicago";

  i18n.defaultLocale = "en_US.UTF-8";

  i18n.extraLocaleSettings = {
    LC_ADDRESS = "en_US.UTF-8";
    LC_IDENTIFICATION = "en_US.UTF-8";
    LC_MEASUREMENT = "en_US.UTF-8";
    LC_MONETARY = "en_US.UTF-8";
    LC_NAME = "en_US.UTF-8";
    LC_NUMERIC = "en_US.UTF-8";
    LC_PAPER = "en_US.UTF-8";
    LC_TELEPHONE = "en_US.UTF-8";
    LC_TIME = "en_US.UTF-8";
  };

  services.xserver.enable = true;

  services.displayManager.sddm.enable = true;
  services.displayManager.sddm.theme = "where-is-my-sddm-theme";
  services.desktopManager.plasma6.enable = true;
  security.pam.services.login.fprintAuth = false;

  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  services.printing.enable = true;

  fileSystems."/mnt/extragames" = {
   device = "/dev/disk/by-uuid/0e7a3ea3-e59c-46e7-8ea5-3e69a0dd217b";
   fsType = "ext4";
   options = [
   "users"
   "nofail"
  ];
};

  fileSystems."/mnt/bigstore" = {
   device = "/dev/disk/by-uuid/c00e6fd1-eb07-4582-847f-25b9588b57c0";
   fsType = "ext4";
   options = [
   "users"
   "nofail"
  ];
};

  services.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;

  };

  users.users.quack = {
    isNormalUser = true;
    description = "quack";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      kdePackages.kate
      thunderbird
      ardour
      openrgb
      openutau
      gimp2-with-plugins
      ungoogled-chromium
      vesktop
      gamescope
      gamemode
      lutris
      protonup-qt
      blender
      davinci-resolve
      obs-studio
      obsidian
      heroic
    ];
  };

  programs.fish.enable = true;
  users.users.quack.shell = pkgs.fish;

  hardware.graphics.enable = true;
  hardware.graphics.enable32Bit = true;
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia.open = true;
  hardware.nvidia.modesetting.enable = true;
 
  programs.gamemode.enable = true;

  programs.steam = {
    enable = true;
    remotePlay.openFirewall = true;
    dedicatedServer.openFirewall = true;
   };

  programs.firefox.enable = true;

  nixpkgs.config.allowUnfree = true;


  programs.neovim = {
   enable = true;
   defaultEditor = true;
  };

  services.hardware.openrgb.enable = true;

  environment.systemPackages = with pkgs; [
  vim
  wget
  kitty
  fastfetch
  macchina
  hyfetch
  htop
  starship
  git
  i2c-tools
  fd
  ripgrep
  where-is-my-sddm-theme
  kdePackages.partitionmanager
  ranger
  vscode
 ];

  system.stateVersion = "25.11";

}


When you say that the escape key doesn’t register, what is it you’re trying to do that doesn’t work? And is this on Wayland or X11 sessions, or both?

Did you bind it to something in your window manager? That would keep it from filtering down…

1 Like

The issue is present on both kde with wayland and x11. What is it I’m trying to do? Anything from play games to exit insert mode in vim. The issue isn’t specific to any one app, firefox, steam, chrome, and nvim/vim all share the issue

wish that was the case, i haven’t set up any keybindings since installing nixos. im going to set up gnome and see if the issue persist.

Another thing you could try is adding a new user to your config, with all the same programs but an untouched home directory, and see if that user has the same issue. If not, that narrows it down to some mutable config file you have in your home.

Found the issue but not exactly the cause.

After switching to gnome and GDM, the issue went away. The only changes I had made to Plasma since installing nixos was change add a sddm theme. Removing the theme did not fix the issue as far as my testing went.

KDE has a few ways to tweak the layout, I’m not* seeing one that could explain your issue at a glance but might be worth resetting it to the defaults.

Settings > Keyboard > Keyboard > Key Bindings (small icon on the top right)

I believe it ends in ~/.config/kxkbrc, for instance I can see in mine:
Options=caps:escape_shifted_capslock

Probably wont help, but I just wanna say that sometimes my mouse glitches (I also have some key shortcuts on it) and it deactivates letters like y. I thought it was kde causing the issue, but turning on and off the mouse would fix the issue.
Just something you could try if you have already (I mean trying removing all the input devices from the computer apart from the keyboard and maybe replug the keyboard too).

That’s why @rhendric asked for libinput logs; the key arrives correctly in software, plasma is definitely intercepting it before it reaches the application.

Unless there is an Xf86IgnoreEscape key I’m unaware of, the issue here is entirely software. Most likely wiping $HOME of the afflicted user would fix this, it’s almost certainly a forgotten keybinding gone awry.

Your issue on the other hand sounds very cursed, I wouldn’t be surprised if you started seeing random kernel panics in time. Hopefully it’s just your mouse, I’d swap at least that before it fries your USB controller.

1 Like

Ehh, it’s oke lol, it’s a very rare occurence (and also it’s a g502 wireless) and it’s been over a year and nothing wild happened (also I have ctrl+c, ctrl+v, ctrl+x commands etc. on it which may be part of the issue if it a switch glitches)