[Feature] Detect long press on input button
That could add several function to the same button.
As an example, I have a mouse with 2 additional buttons (back and forward) that are map to "switch previous / next workspace". I'd love to map long press on these to "move current window to previous / next workspace".
Input-Remapper already has a function to have a button perform two different actions depending on the length of time it is pressed. That code can be found here https://github.com/sezanzeb/input-remapper/blob/main/readme/macros.md under "if-tap".
If I understand your request and the way the "if-tap" macro functions:
- Program the mouse key to the normal function of that key in the first section of the macro.
- Program the key combination that moves a window to another desktop into the second section of the macro. On Linux Mint, for example, that key combo is "shift+control+alt + right arrow".
- To automatically return to the desktop you just left, you could put a delay after that and then the key combination "control+alt + left arrow".
This should have the effect of, when long-pressing the button longer than the delay time, taking the active window to the next workspace and then returning you to the previous workspace.
If you are wanting to only SEND the window to another workspace without leaving the one you are on, then these couple of pages might help. One of them looks like it would work best to set up a key combination to move the window to a keyboard key, then bind the mouse button to that keyboard key.
https://askubuntu.com/questions/1216679/how-can-i-send-a-window-to-a-different-workspace-without-changing-the-active-wor
https://askubuntu.com/questions/59783/how-to-move-windows-to-another-workspace-without-switching-workspace?noredirect=1&lq=1
I hope those help! Let us know.
EDIT: Also, this code binds my 'O' key to output an O if held down for less than 250ms, otherwise it outputs a "6". Maybe you can use this as a starting point if you get the key combination figured out. code = if_single(key(KEY_O), key(KEY_6), 250)
Thank you for the detailled explanations! It seeems that the problem was me not doing enough research then.
Shall I close the issue?
If you find you need suggestions or help, keep this open; otherwise, close it. I did find on my Linux Mint install that there is a 'keyboard' system setting in which you can review, change, or create keyboard shortcuts, including a spot for "move window to workspace number (number)". I bet if you create a keyboard shortcut combo to do that function, then use either the if_tap or if_single macros with that key combo in there, it should do just what you want.