I am trying to write a Linux kernel module that will observe keyboard events and modify/block some of them. I'm using the keyboard notifier chain (with register_keyboard_notifier). Returning NOTIFY_STOP to block a keyboard event works in the virtual terminal. However, X11 (X.org on Ubuntu 16.04) is unaffected. Why?
How can I do something similar in a way that affects X11?
Related
I am making a program that locks my computer by creating a full-screen window and disabling all ways to unfocus the window. For that I need to programmatically disable/enable the Windows key:
Is there a way to catch and stop the windows key event from being passed on to the OS (Ubuntu 21.10) using libX11? From what I understand I am supposed to use XGrabKey but it only blocks Alt-Tab:
XGrabKey(display, ANY_KEY, ANY_MODIFIER, window, False, GRAB_MODE_SYNC,
GRAB_MODE_SYNC)
Also I don't want to disable the whole keyboard.
I'm looking for the Mac OS API that virtual machine or remote desktop type programs would use to "capture" the mouse and keyboard. That is to say, I want to write a GUI program where when the user clicks in my window, the normal mouse cursor disappears, and all keyboard and mouse input is diverted to my program, including global shortcuts like cmd-tab. What's the name of this API?
Found it: CGEventTapCreate can tap into the low level event stream to receive, filter, or insert HID events.
I have a Windows program which has a GUI that runs on a PC.
In order to automate some of the GUI actions, I want to be able to move the mouse and type using the keyboard, but without interfering with the user's activity.
I know that I could simulate input events using SendMessage and PostMessage, but that requires the window to be in focus, and I want to eliminate this requirement.
My question is - is it possible to implement sort of a 'wrapper' that internally runs the original program, while patching its mouse and keyboard, providing it with a 'virtual' version of a mouse of keyboard?
I think of that as taking only the mouse and keyboard capabilities of a VM. Is something of that kind exists?
Thanks!
I want to run a program (exe file) when the Power button of my laptop is pressed. (Not when system is shutting down)
I tried getting its keycode using c# and js, but none of them capture this keypress as they only capture keyboard buttons. Look at the drop-down menu I have opened:
My problem would be solved if they add "Run a specific program..." in this drop-down:
But of course they won't add this option!
So, how do I get it done? Maybe using Task Scheduler?
There's no keycode for the power button. The driver is sitting between your OS and your hardware. When you push the "G" button on your keyboard, the driver translates that to an OS system call representing the "G" key which your program can listen for and intercept. But there's no OS system call for a representing the "power" button. Instead, your driver is translating that to OS system calls to initiate a shutdown, turn off the monitor, etc.
Your laptop driver allows you to configure which system call you want to initiate when the power button is pressed, but that driver is going to be unique to the brand and model of your laptop, and if they don't offer support for capturing that keypress through their driver, then you probably don't have any easy way to intercept it.
Problem: I am using Windows as a guest operating system in a Virtual Machine and a funky keyboard setup. I need a way to be able to troubleshoot cases when keyboard hotkey combinations are not functioning properly.
Question: Does anyone know of a program that quickly and easily displays on the screen what keypress windows thinks it got whenever I press a key or key combination on the installed keyboard?
Keyboard Jedi looks like it will do what you're after.