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

Behavior of hy3:movewindow on floating windows #85

Open
aacebedo opened this issue Mar 17, 2024 · 3 comments
Open

Behavior of hy3:movewindow on floating windows #85

aacebedo opened this issue Mar 17, 2024 · 3 comments

Comments

@aacebedo
Copy link

I am trying to get a single bind to be able to move a floating window with moveactive and to move a tiled window with hy3: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 ?

@postsolar
Copy link

#73 maybe?

@aacebedo
Copy link
Author

aacebedo commented Mar 18, 2024

Seems those commits have been reverted. Is there a new version incoming?

@postsolar
Copy link

postsolar commented Mar 19, 2024

In the meanwhile, I use a script for this:

The script
#! /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:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants