Hyprland
Hyprland copied to clipboard
percentage values for the "resizeparams" dispatcher datatype
For window rules it is possible to resize like this:
size [x] [y] resizes a floating window (x,y -> int or %, e.g. 20% or 100)
But it seems for the dispatcher datatype it is not possible:
resizeparams | Pixel delta vec2 (e.g. 10 -10) or exact followed by exact vec2 (e.g. exact 1280 720)
Would it be possible to allow this?
try it first
also sir its fking christmas
:D
I did try :)
using: hyprctl dispatch resizeactive 40% 80% and hyprctl dispatch resizeactive exact 40% 80%
And it didn't work.
About the holidays, you owe no-one anything of course! In fact, thank you so much for this very nice piece of software!
If you find it annoying if issues are opened during these times, I'll postpone further comments for a few days :)
I am not annoyed, just disappointed that you are not taking the time to spend with your family and are instead tryna find bugs in hyprland. Go talk to your parents man
Ah I see!
Touching sentiment, but not to worry: we have a full program! And my parents (and kid!) are included in it :).
Just not just this moment. Sometimes it is nice to not be face to face social for a moment, and fiddle around a bit to recharge.
Hopefully you'll enjoy the holidays yourself :).

works as expected, so it's just a case of supporting % in the dispatcher.
That sounds promising
Trying to take inspiration from: https://github.com/hyprwm/Hyprland/blob/5fe437da7e6a56e0eab68f857f9e00612d44225a/src/events/Windows.cpp#L283-L288
But the calculation seems to be quite different here: https://github.com/hyprwm/Hyprland/blob/4fd90144d13a6a8d34ac77f9340ce7fd397c3464/src/managers/KeybindManager.cpp#L1454-L1464
A LOT is happening in the rule based one. Most of it seems to be preventing / detecting rule interactions though. My C++ is too crappy to feel confident taking a shot at it.
Bash was fine though, presumably it shouldn't be much different in C++, so I still intend to study up and make a PR later, but for those interested in the meantime this is how I made it work using a script and hyprclt:
first script to get active monitor dimensions:
#!/bin/bash
#will output monitor name, width ,height subtracting gaps and panels
hyprctl monitors -j \
| jq -r 'map(select(.focused == true)) | .[] | .name + " " +(.width|tostring) + " " + (.height|tostring)' \
| {
read -r name width height;
# check if panel is running, and subtract 2x20
# always subtract 2x outer gapsize (= 2x6=12)
gapsize=$(hyprctl getoption general:gaps_out -j | jq -r '.int')
margin=$((2 * gapsize))
width=$(($width-$margin))
pgrep waybar &> /dev/null && margin=$(($margin + 40))
height=$(($height - $margin))
echo "$name $width $height";
}
then read output of this script and apply to window resizing in %:
#!/bin/bash
$hyprlandscriptdir/monitor-active-dims.sh \
| {
read -r name width height
x=$1; y=$2;
if [ "$x" == '' ] || [ "$y" == '' ];
then
echo "usage: $0 percentX percentY"
exit 1;
fi
#subtract double border size of available monitor dims
borderSize=$(hyprctl getoption general:border_size -j | jq -r '.int')
width=$(( $width - 2 * $borderSize ))
height=$(( $height - 2 * $borderSize ))
newX=$(( $width * $x / 100 ))
newY=$(( $height * $y / 100 ))
hyprctl dispatch resizeactive exact $newX $newY
hyprctl dispatch centerwindow 1
}
of course the hardcoded panel process and -size is nasty in this script. So you have to adjust for yourself. I suspect the Hyprland internals have a way to do this in a cleaner way.