hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.6k stars 827 forks source link

resizeactive exact not behaving as expected #2948

Open PrymalInstynct opened 1 year ago

PrymalInstynct commented 1 year ago

Hyprland Version

v0.27.2

Bug or Regression?

Bug

Description

I put together a startup script to open a default set of apps in a specific layout and found that the resizeactive exact dispatch does not seem to work as expected in some scenarios.

My monitor set up is a 5120x1440 ultrawide with a 1920x1080 vertical orientation on the right.

The goal is for a starting layout to look like this:

Ultrawide

Vertical

However, when I use the hyprctl dispatch resizeactive exact command on the kitty tile it will make the tile much bigger then the size I am trying to set.

See the script below for exact steps to reproduce and my workaround.

How to reproduce

Script (See comments in script for the behavior)

#!/bin/bash
# Open kitty on DP-1 in workspace 1
/usr/bin/hyprctl dispatch focusmonitor DP-1
/usr/bin/hyprctl dispatch exec [workspace 1] /usr/bin/kitty
# Wait for kitty to be fully started
sleep 1
# Ensure the kitty window is in focus
/usr/bin/hyprctl dispatch focuswindow kitty
# Open Brave in workspace 1 (Always opens to the Left of kitty)
/usr/bin/hyprctl dispatch exec [workspace 1] /usr/bin/brave
# Wait for Brave to be fully started
sleep 2
# Ensure the kitty window is in focus
/usr/bin/hyprctl dispatch focuswindow kitty
# Open VSCode in workspace 1 (Always opens to the left of kitty, ensuring it is in the center of the screen)
/usr/bin/hyprctl dispatch exec [workspace 1] /usr/bin/code
# wait for VSCode to be fully started
sleep 2
# Change focus to DP-2
/usr/bin/hyprctl dispatch focusmonitor DP-2
# Open Discord in workspace 2 on DP-2
/usr/bin/hyprctl dispatch exec [workspace 2] /usr/bin/discord
# Wait for Discord to be fully started (Stupid Splash Screen)
sleep 5
# Ensure DP-2 is still in focous
/usr/bin/hyprctl dispatch focusmonitor DP-2
# Open Spotify in workspace 2
/usr/bin/hyprctl dispatch exec [workspace 2] /usr/bin/spotify
# Change focus to Brave
/usr/bin/hyprctl dispatch focuswindow Brave
# Resize Brave tile to exactly 1312x1373 (works every time)
/usr/bin/hyprctl dispatch resizeactive exact 1312 1373
# Change focus to kitty
/usr/bin/hyprctl dispatch focuswindow kitty

#####
# Resize kitty tile to exactly 1220x1373 (Makes the tile bigger for some reason)
# /usr/bin/hyprctl dispatch resizeactive exact 1220 1373
####

# Resize kitty tile to 1220x1373 (This command removes 662 pixels from the size of the window which is currently sitting at 1882x1373)
# Oddly I thought using /usr/bin/hyprctl dispatch resizeactive -662 -1 would have worked to make it smaller but it needs to be positive which is confusing
/usr/bin/hyprctl dispatch resizeactive 662 1

Crash reports, logs, images, videos

No response

izmyname commented 1 month ago

Does it still happen?

PrymalInstynct commented 1 month ago

There were some changes in the last release or two that affected how resizing worked. I am not 100% sure if this issue was addressed or not.

izmyname commented 1 month ago

Can you repro your issue? Does it work, as expected now?

PrymalInstynct commented 1 month ago

I will test this weekend

PrymalInstynct commented 1 month ago

No, it does not appear to be working as expected.

Client size before command

Window 5f068e23bd20 -> prymalinstynct@mini01:~:
    mapped: 1
    hidden: 0
    at: 3838,68
    size: 1265,1355
    workspace: 1 (1)
    floating: 0
    pseudo: 0
    monitor: 1
    class: Alacritty
    title: prymalinstynct@mini01:~
    initialClass: Alacritty
    initialTitle: Alacritty
    pid: 1519
    xwayland: 0
    pinned: 0
    fullscreen: 0
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    tags:
    swallowing: 0
    focusHistoryID: 0

Command

/usr/bin/hyprctl dispatch resizeactive exact 1312 1355

Client size after command

Window 5f068e23bd20 -> prymalinstynct@mini01:~:
    mapped: 1
    hidden: 0
    at: 3885,68
    size: 1218,1355
    workspace: 1 (1)
    floating: 0
    pseudo: 0
    monitor: 1
    class: Alacritty
    title: prymalinstynct@mini01:~
    initialClass: Alacritty
    initialTitle: Alacritty
    pid: 1519
    xwayland: 0
    pinned: 0
    fullscreen: 0
    fullscreenmode: 0
    fakefullscreen: 0
    grouped: 0
    tags:
    swallowing: 0
    focusHistoryID: 0
octovert commented 1 month ago

I also have a 5120x1440 ultrawide. I'm also seeing something similar. In my hyprland.conf I have the following:

bind = $mehMod, S, resizeactive, exact 25% 100%

The goal being that I can quickly tap this hotkey to get a window to occupy 1/4 of the screen (which is a nice size for a browser window or editor). This works properly on the window on the far left. However any other window will keep growing endlessly when this hotkey is used.