Detecting touchpad movement vs regular mouse programmatically on Linux - linux

I love the mod4 + mouse-drag combo for moving/resizing windows in Awesome WM, it's very intuitive with regular mouse. Now that I'm using Awesome WM on my laptop, however, I find this combo more annoying when using the touchpad vs regular mouse.
The problem stems from the fact that I now need 3 fingers to perform a gesture that I could do with 2 before (1 to move on the touchpad, 1 to keep on the left-click at all times, and one on mod4). Alternatively, I can apply more force to the touchpad and have it pressed as I drag my finger, which is not any better since it puts a lot of stress on the finger doing the dragging).
What I would like to do instead is have awesome treat left-mouse button as pressed if both of the following conditions are met:
mod4 is pressed
movement event is coming from touchpad and not regular mouse
To do so, however, I need to be able to detect that the movement is coming from the touchpad. Is there a way to do so in Awesome WM/Linux? I've looked through the keysyms (http://wiki.linuxquestions.org/wiki/List_of_keysyms) but don't see anything for the mouse. I've also looked at the mouse.lua file in Awesome WM but it doesn't seem to have anything to differentiate between the two either (https://github.com/awesomeWM/awesome/blob/master/lib/awful/mouse/init.lua). If there is a way to tell that the last coordinate change came from a touchpad on Linux that would resolve the issue as I could simply create a lua file to run such check whenever Mod4 is pressed.

To do so, however, I need to be able to detect that the movement is coming from the touchpad. Is there a way to do so in Awesome WM/Linux?
Nope, there is no such way in AwesomeWM. Sorry.
In X11, this is possible via the input extension. However, awesome does not use that extension.

Related

Simulating keypress with mouse movement using DirectInput (dinput.dll)

I have been trying to play Omikron: The Nomad Soul, but I found it incredibly difficult to do so without using the mouse. I have been trying to use dinput.dll to simulate keyboard presses using mouse movement, but nothing I tried so far worked. I am a complete amateur at this, so I thought I should ask how to do this properly.
What I am trying to do is to edit dinput.dll source code from github, create a dinput.dll file with configurable ini file, where you can assign key presses to mouse movement. This would be beneficial in many old games.
For example;
Mouse moving up = press up arrow key
Mouse moving down = press down arrow key
Mouse moving left = press left arrow key
Mouse moving right = press right arrow key
Reason why I want to use dinput instead of something like autohotkey is because stuff like autohotkey doesn't always get along well with old games. For example Omikron: The Nomad Soul.
Thank you for any help in advance.

Changing color of the taskbar icon

I wanted to make a software with Godot in GDScript that advice you when pressing the bloq mayus button changing the color of the taskbar icon. But, I couldn't find any special code or something that makes it.
I saw the video of Adderly Cespedes making the same software (but in gamemaker) and he said that he found a special extension for it but never said the name.
This isn't currently possible in Godot.
The engine doesn't allow you to map Caps Lock (bloq mayus) to an input.
Edit: From Calinou’s comment, OS.request_attention() can be used to flash the taskbar.

Emulate a mouse

I want to emulate a mouse, that just moves around and left clicks while doing so.
I tried using RobotJS(https://www.npmjs.com/package/robotjs) but it didn't work out for me, so I'm looking for an alternative.

Scroll in GVim using touch screen device

I'm using GVim on a Surface Pro 3 that has a touch screen. I've gotten so used to scrolling windows (like the browser) using the touch screen, so I thought it would be nice to be able to do the same in GVim. However, when I drag my finger it selects text rather than scrolling. Is there a way to change that?
Whohooo, my first tumbleweed badge. :-) Anyway, this actually works out of-the-box with the Vim build from https://bitbucket.org/Haroogan/vim-for-windows

How to write an X11 app that follows the cursor

I'd like to write a Linux screen magnifier that's customized to my liking. Ideally, the magnified window would be a square about 150 pixels wide that follows the mouse cursor wherever it goes.
Is it possible to do this in X11? Would it be easier to have an application window that follows the mouse around, or would it be better (or possible) to forget about the window altogether and just make the mouse pointer a 150x150 square that magnifies whatever's underneath?
Look at the source to xeyes?
This actually already exists, it's called Xmag (do a Google search for additional info). You might want to check out the source code for it if you want to know how it works.
EDIT: looks like I misread your question a little bit... if you want a magnified square to follow the mouse pointer around, I suppose it should be possible, but I don't know the technical details of how you'd do it. Regardless, the place to start is probably by looking at Xmag as a starting point.
I am unsure if this can run as its own app or would have to be integrated into your window manager. Either way, you would need libx11 (might have a different name from distro to distro). Also, I would suggest taking a look at swarp. I know this is not even close to what you are talking about, but the source code is only 35 lines and it shows what can be done with libx11.
I would personally make that a frameless window that always stays atop with a 1px hole in the middle. The events that the user makes (Mouse clicks, keypresses, whatever) is passed to the window below.
And when the user moves it's cursor it is ought to be visible to your window and you just move it over a bit. For the magnifying part, well - that is left as an exercise to the reader (Because I do not know how to do that as of yet ;-).
Texworks comes with such a feature to inspect the pdf resulting from typesetting a latex source. You can also choose between a square or a circular magnifier. See https://www.tug.org/texworks/ for access to the code which can serve a launchpad.

Resources