Mac keyboard Option key emulation - macos-catalina

I am working with the Wacom graphic tablet and Wacom pen. The Wacom pen button executes a custom Photoshop CC 2020 script. I like to add new functionality to the script to emulate a Mac keyboard modifier key state.
The idea, a Wacom pen button press activates the Option key. A Wacom pen button release deactivates the Option key.
In Photoshop the Option key state is not scriptable. So far, I try making an apple script that did not work very well and required executing the AppleScript file from the Photoshop Javascript file.
What other programming options exist to emulate the Option key toggle from within a javascript file?

Related

Accessing wacom tablets from a background process (exclusive mode)?

One nice ascpect about MIDI is that one can route it explicitly to some app - unlike regular input devices like your run of the mill mouse or keyboard.
Is there a similar way to use a Wacom pen tablet exclusively with one app that doesn't even have a visible window resource (Windows 10)? I'd like to repurpose it as a jog dial for video editing and need to intercept the device data in order to simulate specific key presses or mouse movements.
Here is what I'm currently working with:
https://github.com/Wacom-Developer/wacom-device-kit-windows/tree/master/Wintab%20ScribbleDemo
https://developer-docs.wacom.com/intuos-cintiq-business-tablets/docs/wintab-reference#logcontext
The scribble demo works fine out of the box. Setting g_penMovesSystemCursor = false makes the system cursor ignore the tablet, but only as long as the demo's window is in focus. I want the system cursor to always ignore the tablet input and the demo to always receive the wacom events.
Well, I guess this answers it:
How can my application have exclusive access to all tablet pen events?
You must force your application to be the front-most (foreground) app.
https://developer-docs.wacom.com/intuos-cintiq-business-tablets/docs/wintab-faqs#how-can-my-application-have-exclusive-access-to-all-tablet-pen-events
Bummer. Such a simple and useful thing for an input device, and it's not supported.

Qt5: How to create interrupt driven gpio button based qt app

My problem is......... I am trying to develop an application.In this application there are certain pages and which is displaying on the LCD on my board.and my board has a gpio button by default the value of this button is high when i press this button value of this button become low after releasing again high.i want to make my app interrupt based when i pressed hold button for 3 second display should be rotate and if i just press and release button page should change.In my app i have interface my gpio button.
QString btnInput = "/sys/class/gpio/gpioN/value";
In my apps I can read the value from value file when my app start after that if i press button nothing will happen.what should i do.
how can i generate interrupt after pressing button.
please help me i am new in qt I start qt just before 2 week.
I can't tell for a Qt5 application actually (I don't have experience in the Qt field), but you may use a inotify file watcher with /sys/class/gpio/gpioN/value in user space.
That way your program will receive notifications (interrupts) whenever the value changes.
I'm almost sure there's also some (portable) Qt intrinsic mechanism, that resembles the same.
Update (after a little research):
Specifically for Qt I found this answer where the QFileSystemWatcher is mentioned for doing that portably.

How to know if computer is in gaming mode

Background
I'm implementing a simple WIN32 application consist of a window.
The user may show/hide the window using a special hotkey. I register the hotkey using RegisterHotKey and respond to WM_HOTKEY
Problem
if user plays a game and accidentally (or not accidentally) press the hotkey combination, then my window pops up and as a result the game is minimized.
Question
Is there a (native) way to know that the user is in gaming mode, or any other special mode, that I could disable the hotkey response
Note
I would also like if windows would make this a feature while I play games. For example don't respond to WinKey+D while I'm in gaming mode.
You can use the SHQueryUserNotificationState function to determine whether the user is playing a full screen D3D game. It will report QUNS_RUNNING_D3D_FULL_SCREEN.

detect touchscreen desktop

My ultimate wish is to allow users using a touchscreen desktop (an All-in-one computer without mouse or keyboard) to navigate on a website that uses tooltips. Using a mouse, hovering over a tooltip opens it, the tooltip contains links that can be clicked. Using a touchscreen, there is no hover, only 'touches'/clicks. In both cases the page will be displayed on the same OS using the same browser, once the user has a mouse, the other time the user has a touchscreen.
So I need to distinguish between the two: a desktop computer with a mouse and a touchscreen desktop computer without a mouse. Modernizr touch tests (http://modernizr.github.com/Modernizr/touch.html) fail completely on a touchscreen desktop (http://shop.lenovo.com/us/landing_pages/thinkcentre/2010/m90z). Sniffing the UA or browser does not work either.
(After a fair amount of searching, all the detection tries to distinguish different versions of mobile phones or tablets, browsers, UAs... Not desktop touchscreens that are running on the same OS using the same browser.)
Any ideas?
Add event listeners touchstart and mousemove to your page, then wait the user starts to interact with your page. If the first event is mousemove, then user operates with mouse, so it is probably a desktop, otherwise this is a touch-screen.
$(document).on('touchstart.desktopDetect mousemove.desktopDetect', function(ev) {
window.IS_TOUCHSCREEN_DEVICE = (ev.type == 'touchstart');
$(document).off('.desktopDetect');
});
Check working example here:
https://jsfiddle.net/evpozdniakov/uvb51cnm/embedded/result/

Linux and clipboard

In Linux after text selecting it copies to buffer, so than we could paste it by clicking middle button of the mouse. I think that there is a special buffer for this thing. I want to use it. How could i get data of selected text?
OS: Linux
Programming language: c++
Own libraries: Qt
Thanks.
Just a more accurate answer than Paul Dixon's that answers your needs:
QClipboard* clipboard = QApplication::clipboard();
QString selectedText = clipboard->text(QClipboard::Selection);
You need to distinguish between selection and clipboard. The QClipboard documentation has this in the Notes for X11 Users section:
The X11 Window System has the concept
of a separate selection and clipboard.
When text is selected, it is
immediately available as the global
mouse selection. The global mouse
selection may later be copied to the
clipboard. By convention, the middle
mouse button is used to paste the
global mouse selection.
With QClipboard::Mode you can select which type (clipboard or selection) you want to access. The important part is that you need to be aware about the difference between selection and clipboard.
If you're using Qt, have you read the fine manual page on QClipboard?
QClipboard *clipboard = QApplication::clipboard();
QString clipboardText = clipboard->text();
the system that actually handles the selection and pasting system is X11 Windows. When you e.g paint some text in your favorite editor, the application sends and X11 request which tells to the X11 server that you have an active selection. If you then click the middle mouse button somewhere, the X11 server queries the application which told the server about the selection for the actual contents. Then the contents are forwarded to the receiving application.
Libraries like Qt provide wrappers for this mechanism, but the underlying mechanism is X11.