aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts/ResizeActive.sh
blob: afcdeb858476e359e0f8fcb0225adc44887248aa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
# Resize the active window by delta values (dx, dy) using Lua dispatch.

dx="${1:-0}"
dy="${2:-0}"

window_json="$(hyprctl activewindow -j)"
width="$(jq -r '.size[0]' <<<"$window_json")"
height="$(jq -r '.size[1]' <<<"$window_json")"

new_width=$((width + dx))
new_height=$((height + dy))

if ((new_width < 100)); then
  new_width=100
fi
if ((new_height < 100)); then
  new_height=100
fi

hyprctl dispatch "hl.dsp.window.resize({ x = ${new_width}, y = ${new_height} })"
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage