keystroke

Inject Keystroke to different process using Bash

房东的猫 提交于 2019-12-18 05:13:13
问题 I have a process that runs indefinitely until a key is pressed. I would like to use bash to inject a keystroke into this process to have it terminate. Based on this post, linux - write commands from one terminal to another I have tried to use echo -e "b" > /proc/[pid]/fd/0 (The letter "b" in this case is just arbitrary) The letter "b" will show up in the terminal of the process that is running indefinitely, but it doesn't trigger the termination of the program like it does if I actually type

Application wide keyboard shortcut - Java Swing

自作多情 提交于 2019-12-17 10:27:27
问题 I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution. Anyone has a cleaner solution? 回答1: Install a custom KeyEventDispatcher. The KeyboardFocusManager class is also a good place for this functionality. KeyEventDispatcher 回答2: For each window, use JComponent.registerKeyboardAction with a condition of WHEN_IN_FOCUSED_WINDOW .

Application wide keyboard shortcut - Java Swing

泄露秘密 提交于 2019-12-17 10:27:15
问题 I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution. Anyone has a cleaner solution? 回答1: Install a custom KeyEventDispatcher. The KeyboardFocusManager class is also a good place for this functionality. KeyEventDispatcher 回答2: For each window, use JComponent.registerKeyboardAction with a condition of WHEN_IN_FOCUSED_WINDOW .

VirtualBox Keystroke gets random changes

喜你入骨 提交于 2019-12-14 02:44:00
问题 I have a school project about it security. My job is it to customize a hardware mouse with a usb hub and a teensy to program it. The code on the teensy gets executed when it gets dark (light dependent resistor). The code takes some files on the win7 vm and upload them to an Apache2 server hosted on a kali vm (via cmd commands in win7 vm). Everything works fine in vmware, but I have to use virtualbox for my project. My problem is now that in virtualbox the cmd commands randomly changes with

Apple script simulate key events

拥有回忆 提交于 2019-12-11 06:44:48
问题 I want to know the key codes for all the function keys from F1-F12. From previous search queries I have found keycode 107 to turn brightness down by running this echo "tell application \"System Events\" key code 107 end tell" | osascript And I'm guessing that simulates the F1 key but the weird thing is 113 turns the brightness up. I haven't been able to find key codes for any other Fn keys. Any help? Is there a nice table made for this where I can get the keycodes. In the end I want to be

Simulate keystrokes with Quartz events in macOS Sierra

℡╲_俬逩灬. 提交于 2019-12-11 05:29:59
问题 I am simulating keystrokes in macOS, and sending them to the active application. I am doing it along the lines of https://stackoverflow.com/a/27487493/5600424 but in Swift 3. For example, to send an 'a': let eventSource = CGEventSource(stateID: CGEventSourceStateID.hidSystemState) let key: CGKeyCode = 0 // virtual key for 'a' let eventDown = CGEvent(keyboardEventSource: eventSource, virtualKey: key, keyDown: true) let eventUp = CGEvent(keyboardEventSource: eventSource, virtualKey: key,

Simulate user input

二次信任 提交于 2019-12-11 03:32:01
问题 Is it possible to simulate user input in android ? For example to have some service or some thread that will work in background and initiate something that will simulate user input so if we are on the home screen and simulated input(let say click) happened than the application should start if the coordinates of the simulated click point to some icon on the home screen , or let say open a clock if the simulated input points to the clock area ... or maybe if some edittext have focus and the

Block keystrokes from a specific keyboard

风流意气都作罢 提交于 2019-12-10 23:47:11
问题 I would like to block all keystrokes that are coming from a specific keyboard (identified by its HID/Name, so its low level stuff I guess) before they reach the focused application. But I'm still using this disabled keyboard (I'm getting the keystrokes). I think I need an application's hook but I don't know how to do that. Maybe you can give me some useful link? Regards, EDIT: I think I need a low-level hook, because general hook (I mean hook all the existing window & threads) aren't

Changing the keystrokes of a USB keyboard

徘徊边缘 提交于 2019-12-10 10:58:18
问题 Every time a key is pressed on a regular keyboard, a numeric 'key code' is sent to the computer, eg. 32 or 51 which represent specific keys. Unrelated to my default keyboard which I am using to type this post, I want to be able to plug in a keyboard via USB and have its key codes all shifted up by some constant C. Thus, when pressing the 'a' key on this side keyboard, the computer would not receive the keycode for 'a', but rather some higher number which the computer does not have a planned

find based filename autocomplete in Bash script

拈花ヽ惹草 提交于 2019-12-09 22:58:28
问题 There is a command line feature I've been wanting for a long time, and I've thought about how to best realize it, but I got nothing... So what I'd like to have is when I start typing a filename and hit tab,for example: # git add Foo<tab> I'd like it to run a find . -name "*$1*" and basically autocomplete the complete path to the matched File to my command line. What I have so far: I know I'll have to write a function that will call the app with the parameters I want, for example git add .