Now you can capture keyboard and mouse events in Linux easily with KmCaster application. KmCaster is a free and open source software for Linux, macOS and Windows. It displays your keyboard key presses and all mouse click events in the desktop screen. You can use this feature for your screen casting and screen recording in educational or any other type of video making. It is based on Java and released under MIT License. Some other similar application is ScreenKey.