Skip to content

samvv/evcape

Repository files navigation

evcape

build

This is a small utility that makes a short press of the Control-key act as a press of the Escape-key. It can significantly ease the development workflow when using a text editor such as Vim. Because it is written in C, this program is also very performant with minimal memory overhead.

🚀 Now automatically detects hotplugging of keyboards!

Installation

Packaging status

Debian/Ubuntu

An APT repository will soon be availabe so that the latest version can be easily installed.

Arch Linux

If you trust it, evcape is available on the AUR:

paru -Suy evcape

Enable on boot with sudo systemctl enable --now evcape.

NixOS

Assuming your NixOS itself runs on flakes, you need to add two lines to your configuration.

/etc/nixos/flake.nix

{
  inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
  inputs.evcape.url = "github:samvv/evcape"; # Add this line
  outputs = { self, nixpkgs, evcape }: { # Modify this line
    nixosConfigurations.xana = nixpkgs.lib.nixosSystem {
      modules = [
        ./configuration.nix
        evcape.nixosModules.default # Add this line
      ];
    };
  };
}

Building From Source

Make sure you have the right packages installed. On Debian/Ubuntu, this will look something like this:

sudo apt install libudev-dev libevdev-dev

Ensure Meson is installed on your system.

python3 -m pip install -U --user meson

To install the package, simply run the following command:

Warning

This will install configuration files that are expected to run on standard Debian distros. When in doubt, build the service using the instructions below and review each file before installing it.

sudo make install

This will install the following files:

  • /etc/systemd/system/evcape.service
  • /usr/bin/evcape

You might want to run the following commands to activate evcape immediately and on startup:

sudo systemctl enable --now evcape

If you just want the binary, run the following commands:

meson setup build
ninja -C build evcape

The binary will be available as build/evcape.

Configuration

Setting Up CapsLock

For GNOME, use the following command to copy Ctrl to CapsLock.

Warning

This command overrides existing configuration!

gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"

Alternatively, the following command might work when working on Xwayland or X11:

setxkbmap -option "ctrl:nocaps"

Running Manually

Simply run evcape with sudo privileges and you're good to go!

evcape needs sudo privileges because it intercepts and then injects raw key events from/to the keyboard subsystem. Because Wayland does not offer a standard protocol to do the same, the driver is where we need to be.

The following environment variables can be set to influence the behavior of evcape:

Name
EVCAPE_LOG_LEVEL An integer from 0 (no logging) to 6 (log everything)

Related Work

License

This code is generously licensed under the MIT license.

About

A small tool for making the CapsLock/Control key act as an Escape-key on Linux/Wayland

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors