mirror of
https://github.com/ItsDrike/nixdots
synced 2025-06-29 22:30:42 +00:00
Add hyprland-move-window script
This commit is contained in:
parent
14d5cf5261
commit
98f1ed0089
5 changed files with 47 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
}: let
|
||||
packages = {
|
||||
hyprland-swap-workspace = pkgs.callPackage ./hyprland-swap-workspace {};
|
||||
hyprland-move-window = pkgs.callPackage ./hyprland-move-window {};
|
||||
};
|
||||
in
|
||||
packages
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
{pkgs, ...}:
|
||||
pkgs.writeShellScriptBin "hyprland-move-window" ''
|
||||
${builtins.readFile ./hyprland-move-window.sh}
|
||||
''
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
|
||||
RESIZE_SIZE=${1:?Missing resize size}
|
||||
|
||||
RESIZE_PARAMS_X=0
|
||||
RESIZE_PARAMS_Y=0
|
||||
|
||||
DIRECTION=${2:?Missing move direction}
|
||||
case $DIRECTION in
|
||||
l)
|
||||
RESIZE_PARAMS_X=-$RESIZE_SIZE
|
||||
;;
|
||||
r)
|
||||
RESIZE_PARAMS_X=$RESIZE_SIZE
|
||||
;;
|
||||
u)
|
||||
RESIZE_PARAMS_Y=-$RESIZE_SIZE
|
||||
;;
|
||||
d)
|
||||
RESIZE_PARAMS_Y=$RESIZE_SIZE
|
||||
;;
|
||||
*)
|
||||
echo "kbye"
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
ACTIVE_WINDOW=$(hyprctl activewindow -j)
|
||||
IS_FLOATING=$(echo "$ACTIVE_WINDOW" | jq .floating)
|
||||
|
||||
if [ "$IS_FLOATING" = "true" ]; then
|
||||
hyprctl dispatch moveactive "$RESIZE_PARAMS_X" "$RESIZE_PARAMS_Y"
|
||||
else
|
||||
hyprctl dispatch movewindow "$DIRECTION"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue