A utility for X11 that moves the mouse cursor using the keyboard. Written in Haskell.
This utility lets you quickly move the mouse cursor to one of 9 common spots on the screen. It is intended to reduce mouse usage, but not to replace the mouse completely. It does not provide precise aiming; it only provides approximate positioning.
Bind a hotkey in your WM configuration, or by using xbindkeys, to run
place-cursor-at — for example, Super+M. When you press the hotkey, 9 windows
appear on the current screen, each showing a letter. Press the corresponding
letter on your keyboard, and the mouse cursor will move to the center of that
window; the application then exits. This lets you quickly move the mouse cursor
to one of 9 different spots with a two-step key combo.
Other key bindings:
-
Press
Escapeto close the application when one of the letter windows is focused. -
Move focus to the letter window where you want the mouse cursor to be, then press
Enter. This is the same as pressing that window’s letter on your keyboard.
I originally created this tool for myself, to use with xmonad and i3.
Either one:
-
libX11development fileslibXineramadevelopment files
See Nix Package Manager.
It is available in nixpkgs, so you can just run it right away:
nix-shell -p place-cursor-at --run place-cursor-atOr:
nix run nixpkgs#place-cursor-atYou can add this application to your NixOS configuration.nix:
{ pkgs, ... }:
{
environment.systemPackages = [ pkgs.place-cursor-at ];
}Or pick any Git commit (e.g. latest version from the master branch)
and build it from sources:
{ pkgs, lib, ... }:
let
place-cursor-at-src = pkgs.fetchFromGitHub {
owner = "unclechu";
repo = "place-cursor-at";
# Git commit hash.
rev = "ffffffffffffffffffffffffffffffffffffffff";
# Will be calculated and shown the build failure log.
# Just put that value from the log here.
hash = lib.fakeHash;
};
place-cursor-at = pkgs.callPackage place-cursor-at-src {};
in
{
environment.systemPackages = [ place-cursor-at ];
}stack build
stack exec place-cursor-atYou can install place-cursor-at binary to ~/.local/bin directory
(make sure you have this directory in your PATH environment variable):
stack installAssuming that you have the GHC with all the required dependencies available in
your PATH (e.g. by entering nix-shell) you can just run it like this:
runhaskell src/place-cursor-at.hsBut it starts faster and works more responsive when you pre-compile it. Though running it as a script is still pretty usable.
You can also try to run it as a nix-shell script (it has nix-shell shebang
with a nixpkgs pin, so it’s reproducible) as a proof-of-concept.
But it takes a bit of time to start. Not for every day use:
src/place-cursor-at.hsTODO: Put generated usage info here from the place-cursor-at help call.
If you need to work with Stack on NixOS you would have to use --system-ghc in
order to make it work. You can manually add --system-ghc to each call of
stack or define this alias for your convenience:
alias stack='stack --system-ghc'The logo is created by psikoz and some technical adjustments are made by Viacheslav Lotsmanov.
-
place-cursor-at — GNU/GPLv3
-
The logo — Creative Commons — Attribution 4.0 International (CC BY 4.0)
These files in artwork/logo directory in particular:
