Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sticky version of floating_modifier, allow dragging without holding down #3734

Open
xdavidliu opened this issue Jul 11, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@xdavidliu
Copy link

commented Jul 11, 2019

I'm submitting a…

[ ] Bug
[x] Feature Request
[ ] Documentation Request
[ ] Other (Please describe in detail)

Current Behavior

Currently, having floating_modifier $mod allows moving floating windows by holding $mod and dragging with left mouse button held down, or resizing similarly with right mouse button. If tapping is enabled in touchpad, moving can also be done by tapping quickly twice with one finger. (There's no corresponding tapping that is equivalent to right mouse dragging).

This is slightly inconvenient because it requires both hands at times, since the mouse button cannot be released or else the dragging stops.

Desired Behavior

Allow a "sticky" version of move and resize, possibly bound to a regular key. For example, binding $mod+z to an action that "starts" the move process with the cursor, then the user can move anywhere they like, and the finally "finish" by clicking either mouse button or pressing any key.

I've hacked up this functionality using xdotool:

bindsym --release $mod+z exec --no-startup-id xdotool \
    keydown super mousedown 1 keyup super sleep 3 mouseup 1
bindsym --release $mod+x exec --no-startup-id xdotool \
    keydown super mousedown 3 keyup super sleep 3 mouseup 3

but it is imperfect because I must chose some finite time (in the above case 3 seconds) for moving and resizing to be enabled, since the mouseup signal must be sent (physically clicking doesn't get rid of a mousedown signal sent from xdotool).

Environment

Output of i3 --moreversion 2>&-:i3 --moreversion 2>&-

i3 version: 4.16.1
- Linux Distribution & Version: 5.2.0-arch2-1-ARCH
- Are you using a compositor (e.g., xcompmgr or compton): no

@i3bot i3bot added the enhancement label Jul 11, 2019

@Airblader

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

here's no corresponding tapping that is equivalent to right mouse dragging

Is there a good argument for why this couldn't be implemented? That would make its usefulness transcend i3 by orders of magnitude.

Regarding your current efforts, what about something like this (untested)?

mode "resizing" {
    # Or any other / additional bindings
    bindsym --border --whole-window button1 mode "default", exec --no-startup-id xdotool keydown super mouseup 1
}

bindsym $mod+z mode "resizing", exec --no-startup-id xdotool keydown super mousedown 1

In general we're not really looking to make "stateful" key bindings as this introduces a lot of complexity.

@xdavidliu

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

Is there a good argument for why this couldn't be implemented? That would make its usefulness transcend i3 by orders of magnitude.

I asked on superuser and it seems that tap to right-drag is not enabled in libinput, though apparently it is possible in the old unmaintained synaptics driver.

Regarding your current efforts, what about something like this (untested)?

Interesting; I played around with this for a bit, though it seems that the click from the inner mode doesn't successfully return to mode "default". I'm not sure what causes this.

@Airblader

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

it seems that tap to right-drag is not enabled in libinput

My point being, it could be worth changing that rather than changing anything in i3. ;-)

@Airblader

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

I played around with this for a bit, though it seems that the click from the inner mode doesn't successfully return to mode "default". I'm not sure what causes this.

The click still has to be on a managed client window, not on the root window (background).

@xdavidliu

This comment has been minimized.

Copy link
Author

commented Jul 12, 2019

The click still has to be on a managed client window, not on the root window (background).

It's not possible to click in the background because the window follows the cursor when you either resize or move.

Also, it seems that clicking when either the resize or move cursor has been activated is "special", and bypasses the button1 bindsym inside mode "resize". I don't really understand what's happening here.

@Airblader

This comment has been minimized.

Copy link
Member

commented Jul 12, 2019

Ah, that's because the resize itself is grabbing the cursor which prevents the binding from working. It should work if you bind something like Enter (or whatever) instead of a mouse button if that's the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.