{"id":13440568,"url":"https://github.com/oblitum/caps2esc","last_synced_at":"2025-03-20T10:31:28.018Z","repository":{"id":143012747,"uuid":"70665431","full_name":"oblitum/caps2esc","owner":"oblitum","description":"Transforming the most useless key ever in the most useful one","archived":true,"fork":false,"pushed_at":"2017-12-14T16:12:27.000Z","size":21,"stargazers_count":166,"open_issues_count":1,"forks_count":37,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-01T03:31:42.928Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oblitum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-10-12T05:20:09.000Z","updated_at":"2024-07-27T22:17:28.000Z","dependencies_parsed_at":"2023-05-21T08:15:14.003Z","dependency_job_id":null,"html_url":"https://github.com/oblitum/caps2esc","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblitum%2Fcaps2esc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblitum%2Fcaps2esc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblitum%2Fcaps2esc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oblitum%2Fcaps2esc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oblitum","download_url":"https://codeload.github.com/oblitum/caps2esc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244594996,"owners_count":20478386,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T03:01:23.978Z","updated_at":"2025-03-20T10:31:27.713Z","avatar_url":"https://github.com/oblitum.png","language":"C","funding_links":[],"categories":["Map CapsLock to Control","C"],"sub_categories":["3. Query the database"],"readme":"# caps2esc\n\n_Transforming the most useless key **ever** in the most useful one._\n\u003csub\u003e_For vi/Vim/NeoVim addicts at least_.\u003c/sub\u003e\n\n# WARNING\n\n**The project now lives on https://gitlab.com/interception/linux/plugins/caps2esc\nas an [Interception Tools][interception-tools] plugin. This repository is now\nfrozen.**\n\n---\n\n\u003ca href=\"http://www.catonmat.net/blog/why-vim-uses-hjkl-as-arrow-keys/\"\u003e\n\n![ADM-3A terminal](http://www.catonmat.net/images/why-vim-uses-hjkl/lsi-adm3a-full-keyboard.jpg)\n\n\u003c/a\u003e\n\n## What is it?\n\n- **Put what's useless in its place**  \n  \u003csub\u003e_By moving the CAPSLOCK function to the far ESC location_\u003c/sub\u003e\n- **Make what's useful comfortably present, just below your Pinky**  \n  \u003csub\u003e_By moving both ESC and CTRL functions to the CAPSLOCK location_\u003c/sub\u003e\n\n## Why?!\n\nBecause CAPSLOCK is just \"right there\" and making it CTRL when key-chording and\nESC when pressed alone is quite handy, specially in vi.\n\n## Dependencies\n\n- [libevdev][]\n\n## Building\n\n`gcc caps2esc.c -o caps2esc -I/usr/include/libevdev-1.0 -levdev -ludev`\n\n## Execution\n\nThe following daemonized sample execution increases the application priority\n(since it'll be responsible for a vital input device, just to make sure it stays\nresponsible):\n\n`sudo nice -n -20 ./caps2esc \u003ecaps2esc.log 2\u003ecaps2esc.err \u0026`\n\n## Installation\n\nI'm maintaining an Archlinux package on AUR:\n\n- \u003chttps://aur.archlinux.org/packages/caps2esc\u003e\n\nIt wraps the executable in a systemd service that can be easily started, stopped\nand enabled to execute on boot.\n\n## How it works\n\nExecuting `caps2esc` without parameters (with the necessary privileges to access\ninput devices) will make it monitor any devices connected (or that gets\nconnected) that produces CAPSLOCK or ESC events.\n\nUpon detection it will fork and exec itself now passing the path of the detected\ndevice as its first parameter. This child instance is then responsible for\nproducing an uinput clone of such device and doing the programmatic keymapping\nof such device until it disconnects, at which time it ends its execution.\n\n## Caveats\n\nAs always, there's always a caveat:\n\n- It will \"grab\" the detected devices for itself.\n- If you tweak your key repeat settings, check whether they get reset.  \n  Please check [this report][key-repeat-fix] about the resolution.\n\n## History\n\nI can't recall when I started using CAPSLOCK as both ESC and CTRL but it has\nbeen quite some time already. It started when I was on OS X where it was quite\neasy to achieve using the [Karabiner][], which already provides an option to\nturn CTRL into CTRL/ESC (which can be coupled with OS X system settings that\nturn CAPSLOCK into CTRL).\n\nMoving on, permanently making Linux my home, I searched and tweaked a similar\nsolution based on [xmodmap][] and [xcape][]:\n\n- \u003chttps://github.com/alexandre/caps2esc\u003e\n\nIt's a simple solution but with many annoying drawbacks I couldn't stand in the\nend:\n\n- It resets any time a device change happens (bluetooth, usb, any) or the\n  laptop lid is closed or when logging off and needs to be re-executed.\n- It depends on [X][]. Doesn't work on TTY (bare terminal based machine,\n  CTRL-ALT F2, etc).\n\nMeanwhile on Windows land, I had a definitive solution based on my\n[Interception library][interception] that always works perfectly, no hiccups.\n\nIt made me envy enough, so I ported the\n[Windows Interception caps2esc][caps2esc-windows] sample to Linux based upon\nevdev, udev and uinput.\n\n## License\n\n\u003ca href=\"http://www.gnu.org/copyleft/gpl.html\"\u003e\n\n![GPL v3](https://www.gnu.org/graphics/gplv3-127x51.png)\n\n\u003c/a\u003e\n\nCopyright © 2016 Francisco Lopes da Silva.\n\n[caps2esc-windows]: https://github.com/oblitum/Interception/blob/master/samples/caps2esc/caps2esc.cpp\n[libevdev]: https://www.freedesktop.org/software/libevdev/doc/latest/index.html\n[karabiner]: https://pqrs.org/osx/karabiner/\n[xmodmap]: https://www.x.org/releases/X11R7.7/doc/man/man1/xmodmap.1.xhtml\n[xcape]: https://github.com/alols/xcape\n[x]: https://www.x.org\n[interception]: https://github.com/oblitum/Interception\n[key-repeat-fix]: https://github.com/oblitum/caps2esc/issues/1\n[interception-tools]: https://gitlab.com/interception/linux/tools\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foblitum%2Fcaps2esc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foblitum%2Fcaps2esc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foblitum%2Fcaps2esc/lists"}