Sanjibukai
Is it possible to catch keyboard inputs with Elixir/Erlang?
Hello everybody,
I never thought about that but is there a way to have an Elixir app that’s running in the background (might be a CLI put in the background of a terminal or just sitting on a terminal that’s minimized) to catch for keyboard input? Basically for catching shortcuts..
Edit: I just noticed we don’t have here a category for Erlang. Maybe it can be useful to have one alongside the Framework category (though it’s not a framework)
Most Liked
zevv
This is a highly platform-specific job, the method you need for “scraping” keyboard events depends on your operating system, desktop environment, etc. On linux you could read and parse raw events from /dev/input/*, which could be done with just elixir. For other solutions you’ll have to bind to native OS libraries; for example, on an X11 desktop you’d need something like the libxtst extension, on windows youll need to use SetWindowsHookEx(), or CGEventTapCreate() on mac os.
Popular in Discussions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









