Detecting if an external mouse is connected in Swift? - swift

For an app I am making on macOS I want different behaviour for the trackpad vs. a mouse. Is there any way to check if an external mouse is connected (e.g via usb or bluetooth) to the mac in Swift? I.e the assumption will be that if an external mouse is connected then the user will be using that rather than the trackpad. If they have an external mouse connected but would like to use the trackpad as as a pointer then they can change this in a settings menu.

Related

Detect if a physical keyboard is connected in Flutter

Is there a way to detect if there is a PHYSICAL keyboard connected in Flutter? I would like to detect if the user is using a physical keyboard, and alter the UI depending on if this is so.
Has this changed? I would also like to detect if a keyboard is connected/available. I'm currently reacting when a physical keyboard is used with a RawKeyboardListener but it would be a smoother experience for the end user if I could see if a keyboard was connected, before it's actually used.
Looks like this is available in Android native: https://developer.android.com/reference/android/content/res/Configuration.html#keyboard
Not sure if it's available on iOS but we have the RawKeyboardListener approach that is OK on iOS. For Android we are supporting Chromebooks with physical keyboards and to provide the best experience we would like to react as early as possible to physical keyboards.
If you want to know if the physical keyboard has been used (but not when it connects), you could listen to keyboard events by listening to RawKeyboard.instance.addListener, and switch modes if you see a key event: RawKeyboard only sends physical keyboard events.
But to answer your question, no, there's no specific notification for when a physical keyboard is connected.

XFCE: automatically enable/disable touchpad depending on mouse presence

I'm using the latest XFCE4 under Linux. My laptop has a touchpad, but I only want it to be enabled if the USB mouse is not connected. I know how to manually control this, but I'd like to find a way for the touchpad to auto-disable when a USB mouse is plugged in and auto-enable when the USB mouse is disconnected.
I can't find anything in the XFCE4 settings that controls this.
Is there any way I can have this auto-enable/disable capability for the touchpad?
Thank you very much.

How do I test the Air Tap gesture in Hololens Emulator?

I am building an Augmented Reality app for Hololens. I need to test the Air Tap Gesture, without deploying to the Hololens.
Is there any method to test the Air Tap functionality through the Hololens Emulator or the Holographic Emulation provided by Unity3D?
This will depend on your emulation environment:
Hololens Emulator (From Microsoft, allows multiple input devices)
Air tap gesture - Right-click the mouse, press the Enter key on your keyboard, or use the A button on an Xbox controller.
Windows Holographic Emulation (From Unity, requires game controller)
Perform a tap gesture with a
virtual hand - Left and right trigger buttons; the A button
Adding to the other answer. If you don't have a HoloLens this will not help but, if you do this will speed up development significantly.
On your HoloLens, download the Holographic Remoting App. Once it is downloaded open and run it and you will see your IP address for your HoloLens.
Now, go to the Unity editor -> Window tab -> Holographic Emulation. This will open a new window. For Emulation mode select remote device. Under Remote Machine enter the IP address. You can tinker with the other settings as you see fit.
Now with the Application running on your HoloLens click connect. Once you are connected the Unity editor will tell you and the HoloLens should go blank. Now when you press play on the editor the app will run on the HoloLens.
This does not download the app to your HoloLens and stops running when you stop the editor
If you are working in the Unity editor,
Shift + LMB (left-mouse-button) to simulate air-tap with the left
hand;
Space + LMB to simulate air-tap with the right hand.
Other useful points:
gaze can be controlled with the mouse by keeping RMB down. Also
q/w/e/a/s/d. (I know question was only about airtap, but they kind of
come together).
If you need to test typing some data with the standard keyboard, no
need to simulate airtap - just click with the mouse.

Emulating multi touch with mouse HID Bluetooth?

I’m planning the system that could analyze touch information from my car LCD display and using Raspberry PI change it to standard mouse movements using Bluetooth HID protocol. I’m wondering if it is possible to emulate multi touch thru mouse HID over Bluetooth?
Yes, Its possible. You need something like HC-06 with HID firmware on it.
The Tricky part is to read the cars touchscreen output...

Use USB keyboard for text input in Smart TV application

My application has implemented custom onscreen-keyboard.
Is there a way to support the USB keyboard connected to a TV? By default, Samsung TV translates some keystrokes to remote control codes (0-9, red, blue, etc..). Is there a way to get all keystrokes? Preferably without the use of IME.
UPDATE:
I want to implement text input from the USB keyboard within my own onscreen virtual keyboard. By default, letter keys are not translated to application.
TV: UE46ES8000, USB, and BT keyboards connected and allow to control application, but unable to input text in it.
You can connect keybords to your SmartTV but your TV need to support them.
In example this samsung keybord: http://www.samsung.com/uk/consumer/tv-audio-video/television/tv-accessories/VG-KBD1500/XU-spec?subsubtype=wireless-keyboard
is compatible with:
Samsung SMART TV: LED ES6100 series and above, PDP E550 series and above
So if your TV device support USB or wireless keybord you do not need to translate any key codes in your application it will just work.