hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
18.31k stars 761 forks source link

Mouse Binding Similar to dwm #4440

Open Norhua opened 6 months ago

Norhua commented 6 months ago

Description

Hello, I recently switched from dwm to hyprland and I'm having some issues with the mouse bindings.

In dwm, I used the following mouse bindings: { ClkClientWin, MODKEY, Button1, movemouse, {0} }, // super+left click | Drag window | Drag window { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, // super+right click | Drag window | Resize window

In hyprland, I'm using the following mouse bindings: bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizemouse

I have two points of confusion:

  1. In dwm, I used super+left mouse click to drag windows. When I dragged a tiled window, it would become a floating window. However, in hyprland, the movewindow command does not make the window float.

  2. In dwm, I used super+right mouse click to resize windows. When I dragged the window using the right mouse button, it would always resize the window from the bottom right corner. This feature made it easy for me to reset the window size. However, in hyprland, it adjusts the window size relative to the position of the window border, which I believe adds unnecessary complexity.

How can I adjust the mouse binding logic in hyprland to match that of dwm? Any help would be greatly appreciated.

RadekRojik commented 6 months ago

Description

Hello, I recently switched from dwm to hyprland and I'm having some issues with the mouse bindings.

In dwm, I used the following mouse bindings: { ClkClientWin, MODKEY, Button1, movemouse, {0} }, // super+left click | Drag window | Drag window { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, // super+right click | Drag window | Resize window

In hyprland, I'm using the following mouse bindings: bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizemouse

I have two points of confusion:

  1. In dwm, I used super+left mouse click to drag windows. When I dragged a tiled window, it would become a floating window. However, in hyprland, the movewindow command does not make the window float.
  2. In dwm, I used super+right mouse click to resize windows. When I dragged the window using the right mouse button, it would always resize the window from the bottom right corner. This feature made it easy for me to reset the window size. However, in hyprland, it adjusts the window size relative to the position of the window border, which I believe adds unnecessary complexity.

How can I adjust the mouse binding logic in hyprland to match that of dwm? Any help would be greatly appreciated.

Try:

bindm = $mainMod, mouse:272, exec, $(hyprctl -j activewindow | jq '.floating') || hyprctl dispatch togglefloating
bindm = $mainMod, mouse:272, movewindow

Note, you need install https://man.archlinux.org/man/jq.1.en

Norhua commented 6 months ago

Description

Hello, I recently switched from dwm to hyprland and I'm having some issues with the mouse bindings. In dwm, I used the following mouse bindings: { ClkClientWin, MODKEY, Button1, movemouse, {0} }, // super+left click | Drag window | Drag window { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, // super+right click | Drag window | Resize window In hyprland, I'm using the following mouse bindings: bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizemouse I have two points of confusion:

  1. In dwm, I used super+left mouse click to drag windows. When I dragged a tiled window, it would become a floating window. However, in hyprland, the movewindow command does not make the window float.
  2. In dwm, I used super+right mouse click to resize windows. When I dragged the window using the right mouse button, it would always resize the window from the bottom right corner. This feature made it easy for me to reset the window size. However, in hyprland, it adjusts the window size relative to the position of the window border, which I believe adds unnecessary complexity.

How can I adjust the mouse binding logic in hyprland to match that of dwm? Any help would be greatly appreciated.

Try:

bindm = $mainMod, mouse:272, exec, $(hyprctl -j activewindow | jq '.floating') || hyprctl dispatch togglefloating
bindm = $mainMod, mouse:272, movewindow

Note, you need install https://man.archlinux.org/man/jq.1.en

Error "bind: too many args" after using this configuration.

I only found movewindow and resizewindow mouse bindings available on the wiki(https://wiki.hyprland.org/Configuring/Binds/#mouse-binds). Does the mouse bindings not support exec.

I tried using bind instead of bindm, and it didn't report any errors but it didn't work as well

RadekRojik commented 6 months ago

Oh sorry, my bad. I use this only with keybinds. You can play with windows rules:

windowrule = float, .*   
windowrule = size 100% 100%, .*
windowrule = move 0 0, .*

All new windows switch to float, "max" size and on the entire screen.

Norhua commented 6 months ago

Oh sorry, my bad. I use this only with keybinds. You can play with windows rules:

windowrule = float, .*   
windowrule = size 100% 100%, .*
windowrule = move 0 0, .*

All new windows switch to float, "max" size and on the entire screen.

But I don't want that, I just want a tiled window to float when I drag it.

RadekRojik commented 6 months ago

All windows tiled and drag or resize it: https://www.youtube.com/watch?v=YXJf77OZNjc normal behavior. Or I misunderstood.

Norhua commented 6 months ago

All windows tiled and drag or resize it:所有窗口平铺并拖动或调整其大小: https://www.youtube.com/watch?v=YXJf77OZNjc normal behavior. Or I misunderstood. 正常的行为或者我误解了。

https://github.com/hyprwm/Hyprland/assets/51854433/5def7c3d-e761-43b3-bfec-035f44c5ce48