The script
```sh
#! /usr/bin/env zsh
direction=$1
delta=10
active=($(hyprctl activewindow -j | jq -r '.address + "\n" + (.floating | tostring)'))
address=$active[1]
floating=$active[2]
# if the first argument to a dispatcher is a negative number,
# hyprctl parses it as an argument to itself, not to the dispatcher.
# since a move left would require arguments `-px px,...`, this
# has to be handled via a different dispatcher
handleMoveLeft () {
curr=($(hyprctl activewindow -j | jq -r '(.at[0] | tostring) + "\n" + (.at[1] | tostring)'))
y=$curr[2]
x=$(( curr[1] - $delta ))
hyprctl dispatch movewindowpixel "exact $x $y,address:$address"
exit 0
}
if $floating; then
case $direction in
l|left) handleMoveLeft ;;
r|right) resizeparams="$delta 0" ;;
u|up) resizeparams="0 -$delta" ;;
d|down) resizeparams="0 $delta" ;;
esac
hyprctl dispatch movewindowpixel "$resizeparams,address:$address"
else
hyprctl dispatch hy3:movewindow $direction,once,visible
fi
```
And the following bindings:
```hyprlang
binde = $mod SHIFT, left , exec, $scripts/move-floating-or-tiled-win.zsh left
binde = $mod SHIFT, down , exec, $scripts/move-floating-or-tiled-win.zsh down
binde = $mod SHIFT, up , exec, $scripts/move-floating-or-tiled-win.zsh up
binde = $mod SHIFT, right, exec, $scripts/move-floating-or-tiled-win.zsh right
```
I am trying to get a single bind to be able to move a floating window with
moveactive
and to move a tiled window withhy3:movewindow
.It is possible with sway, but I don't find a way to filter correctly the bind with hyprland. Is there any way to do that ?