Capturing input device disables two-fingers-for-right-click capability - linux

I have a convertible laptop for which there isn't great Linux support: the desktop environment is unable to detect when the device is in tablet mode, so the keyboard and touchpad are always active, which makes tablet mode almost useless. I've solved this problem by writing a simple Python script that grabs the keyboard and mouse input devices and proxies events to the system until a specific key sequence is received. At this point, it stops proxying events until the same key sequence is seen again.
The code is effectively a slightly more complex version of this example (which reproduces the problem):
import evdev
import selectors
dev = evdev.InputDevice('/dev/input/event5')
ui = evdev.UInput.from_device(dev)
dev.grab()
selector = selectors.DefaultSelector()
selector.register(dev, selectors.EVENT_READ)
while True:
for key, mask in selector.select(0.1):
dev = key.fileobj
for event in dev.read():
cat = evdev.categorize(event)
print(cat)
ui.write_event(event)
/dev/input/event5 is the touchpad. The system has the following devices:
Available devices:
/dev/input/event0: Lid Switch
/dev/input/event1: Power Button
/dev/input/event2: Sleep Button
/dev/input/event3: Power Button
/dev/input/event4: AT Translated Set 2 keyboard
/dev/input/event5: SynPS/2 Synaptics TouchPad
/dev/input/event6: Wacom HID 5072 Pen
/dev/input/event7: Wacom HID 5072 Finger
/dev/input/event8: HDA Intel PCH Mic
/dev/input/event9: HDA Intel PCH Headphone
/dev/input/event10: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event11: PC Speaker
/dev/input/event12: ThinkPad Extra Buttons
/dev/input/event13: Integrated Camera: Integrated C
/dev/input/event14: Video Bus
When this code runs, movements and regular click actions work just fine, but a two-fingered click, which normally acts like a right-button click, no longer works. Since this code is just taking events and re-sending them, why is this behavior different? How would I get the two-fingered click to work as expected?

I think what you need is very similar to this, altered of course to your needs
Python_Touchscreen_RightClick.py
if this doesn't work for you you can also try and use Gesture Event from python-libinput

Related

Zorin OS screen freezes when switch keyboard typing

Zorin OS Screen freezes when Switch from Laptop keyboard to usb keyboard.
When a key is pressed on laptop keyboard and then pressed on usb keyboard
the Screen freezes for about two seconds.
It happens to any device attached to usb, like a barcode scanner, which is the real problem here.
There is something to try to solve that issue?
I want the screen not to freeze when pressing a key on the keyboard and reading a barcode after that.

How to Turn on unpaired BLE device (BT-low energy)?

I have a bluetooth energy air purifier. The button to turn it on and put it in pairing mode is broken, but the mask can still charge. My PC and phone can see the device, but can't pair/connect to it (needs an app) but the app is in default state since I moved to new phone (old phone is factory reset - forgot that the mask button was broken).
How do I turn the device on and put in pairing mode w/o the power button working? Anything I can do for it?
I couldn't find a replacement button on ebay and the product isn't sold in North America. It's the LG Puricare Mask Gen 2. Is it a lost cause T.T. I found a teardown video of it.
https://youtu.be/VGjd6fnD-oE

Virtual keyboard not showing in iOS simulator VS Mac

The virtual keyboard in the simulator is not showing when I focus on a text field.
It showed the first time I clicked inside the text field but subsequent clicks in the text field do not bring up the virtual keyboard.
This is happening for the IPhone 6 to iPhone X simulators.
I'm using Visual Studio Mac.
It would appear the simulator detected my Macs keyboard, so it no longer shows the virtual keyboard.
How can I fix this so that the virtual keyboard shows whenever I interact with a control that accepts text input.
Solution
In the top menu bar of the simulator I had to turn "Connect Hardware Keyboard" off.
I got there by going to Hardware -> Keyboard -> Connect Hardware Keyboard

How can I disable Chrome opening the Windows on-screen keyboard when debugging as iPad?

When I open the Chrome debug view and set the device to "iPad Mini" to simulate its screen size (and touch events), interacting with a text input causes the Windows on-screen keyboard to open.
This computer is not a tablet, and has never had a touch screen. In the Windows Ease of Access -> Keyboard settings Turns on the On-Screen Keyboard is off.
I can only assume that Chrome "simulating" an iPad Mini is causing Windows to think there's a touchscreen. I've been using this feature for a few months now, and the keyboard opening only started happening recently. I may have simply flipped a switch in the settings (of Chrome or Windows) on accident. If that's the case, I'd like to know how to flip it back!
This is frustrating because I have to close the keyboard each time as it covers up a large portion of the web-app.
The same page without the "iPad Mini" simulation does not open the keyboard:
(This keyboard also opens when choosing any device that has a touch screen, not just iPad Mini.)
Chrome doesn't emulate the keyboards of the device profiles you pick. An image of a keyboard will show for certain ones, like the iPhone 5X, but it is non-functional and is just present to allow you to see how the various elements on the page respond to the keyboard. You can see my answer here for more details on viewing that. However, this is not the same keyboard you are seeing.
It looks as though there is something in Windows, which is triggering the on-screen keyboard. I'm not sure why it would still appear if you have it disabled, but you could try a couple of things, based on what I've found online:
Make sure 'Touch Keyboard and Handwriting Panel Service' is set to disabled in Services (services.msc)
SetLOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\ ShowTabletKeyboard from value 1 to 0 (regedit.exe)
Check there is no other 3rd party software running, which may affect your keyboard behaviour.

How can I detect when iOS 4 keyboard is on-screen versus Bluetooth?

I have some code that moves a UITextView out from under the on-screen keyboard. The problem is, sometimes people will surely use a Bluetooth keyboard instead.
How can I detect that that is what's being used for input?
Also, BTW: I can detect when the on-screen keyboard goes away, but how to approach the same intention when it's a wireless keyboard?
Thanks.
You can detect when a bluetooth keyboard is connected by registering for UIKeyboardWillShowNotification the same way that you did for detecting when the keyboard hides. If a BT keyboard is connected, you will not receive a keyboard will show notification when the text field or text view that is requesting the keyboard becomes the first responder.

Resources