Skip to content

Add multimonitor support for movewindow #178

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

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

ojasookert
Copy link

This PR makes progress on resolving #162 by enabling hy3:movewindow to move focused windows between monitors. While it functions as expected in most cases, it does not always ensure the window is placed exactly at the edge of the next monitor.

It has been working well for my personal use cases, but further testing is required to validate its behavior across different setups. Feedback and additional testing would be greatly appreciated!

Looking forward to any insights or suggestions. 🚀

@theammir
Copy link

i'm not sure if i have the plugin set up correctly, but it seemingly makes no difference on my machine. I'll try to investigate further

@outfoxxed
Copy link
Owner

I can't get it to shift across monitors either.

@outfoxxed
Copy link
Owner

Actually I was testing it wrong. It does work, kind of. Focus gets locked into an odd state that doesn't match what's happening visually after a move, and I would like windows placed at matching monitor edges where possible.

@outfoxxed
Copy link
Owner

Also a single window can't be moved across monitors. It needs at least 2 for some reason.

@ojasookert
Copy link
Author

Thanks for retesting @outfoxxed, I should have noted that I have cursor warping enabled with configuration, which avoids the focus issue for me:

# Move window with mainMod SHIFT+ arrow keys
bind = $mainMod SHIFT, left, hy3:movewindow, l
bind = $mainMod SHIFT, left, hy3:warpcursor 
[...]

@ojasookert ojasookert marked this pull request as draft February 1, 2025 10:40
@ojasookert
Copy link
Author

Marking this as a draft until noted issues are fixed.

@ojasookert
Copy link
Author

Added changes to detect edge placement, it should now place windows at the correct edge when moving across monitors.

@ojasookert
Copy link
Author

Ready for another review.

@ojasookert ojasookert marked this pull request as ready for review February 1, 2025 14:00
@ojasookert ojasookert changed the title Improve Window Transition Between Monitors (Partial Fix for #162) Add multimonitor support for movewindow Feb 1, 2025
@theammir
Copy link

theammir commented Feb 1, 2025

I use hyprsplit, and my secondary monitor is on top of the primary.
There is a single window on the first workspace of the primary display, and two windows on the second.

When the first workspace of the second display is active, and I'm moving a window upwards like so:
image
it moves to the first workspace of the primary display instead.

I'll try with regular workspaces later.

@ojasookert
Copy link
Author

@theammir I tried to reproduce the issue with hyprsplit but sadly could not - it works as expected. Perhaps you could share your configs in a gist so I could try to reproduce the issue?

@theammir
Copy link

theammir commented Feb 3, 2025

Here's the minimal setup. The plugins are ojasookert/hy3 on master and shezdy/hyprsplit on main

hyprland -v
Hyprland 0.47.0 built from branch main at commit 1d3904c3e7a8b74ea83669f73ee408bd38390b11  (configmgr: properly free glob memory).
Date: Tue Jan 28 12:19:52 2025
Tag: v0.47.0-9-g1d3904c3, commits: 5751
built against:
 aquamarine 0.7.1
 hyprlang 0.6.0
 hyprutils 0.5.0
 hyprcursor 0.1.11
 hyprgraphics 0.1.1


no flags were set
hyprland.conf
monitor = eDP-1,    1920x1080@144, 0x0,     1
monitor = HDMI-A-1, 1920x1080@60,  0x-1080, 1

exec-once = hyprpm reload -nn

plugin {
    hy3 {
        autotile {
            enable = true
        }
    }

    hyprsplit {
        num_workspaces = 5
        persistent_workspaces = true
    }
}

general {
    layout = hy3
}


$mainMod = SUPER
$shiftMod = SUPERSHIFT
$altMod = SUPERALT

bind = $mainMod, h, hy3:movefocus, l
bind = $mainMod, l, hy3:movefocus, r
bind = $mainMod, k, hy3:movefocus, u
bind = $mainMod, j, hy3:movefocus, d

bind = $shiftMod, h, hy3:movewindow, l
bind = $shiftMod, l, hy3:movewindow, r
bind = $shiftMod, k, hy3:movewindow, u
bind = $shiftMod, j, hy3:movewindow, d

bind = $mainMod, 1, split:workspace, 1
bind = $mainMod, 2, split:workspace, 2
bind = $mainMod, 3, split:workspace, 3
bind = $mainMod, 4, split:workspace, 4
bind = $mainMod, 5, split:workspace, 5

bind = $shiftMod, 1, hy3:movetoworkspace, 1, follow
bind = $shiftMod, 2, hy3:movetoworkspace, 2, follow
bind = $shiftMod, 3, hy3:movetoworkspace, 3, follow
bind = $shiftMod, 4, hy3:movetoworkspace, 4, follow
bind = $shiftMod, 5, hy3:movetoworkspace, 5, follow

@ojasookert
Copy link
Author

ojasookert commented Feb 5, 2025

@theammir Thank you for providing the minimal configuration. Sadly, I still could not reproduce the issue - the focused window hops monitors perfectly using hy3:movewindow even with the persistent workspaces defined in hyprsplit config.

I have to admit, I am not quite sure what's the expected behaviour of hy3:movetoworkspace when using hyprsplit - are you perhaps trying to use that dispatcher to move the window? Note that I found mention of a similar issue you are describing here.

Can you verify that both plugins are up to date?

@theammir
Copy link

theammir commented Feb 5, 2025

@ojasookert Thanks for mentioning movetoworkspace, but it does work as expected when moving windows within a single monitor with hy3's dispatcher since the very pull request you linked.
The issue I'm describing occurs with hy3:movewindow, but I thought I'd still include all the binds I use to control windows.

Expanding on the description of behaviour I'm experiencing, it comes to this: when moving a window towards the secondary monitor, it moves to the equally-numbered workspace of the primary instead. Similar thing happens when moving downwards. At the same time, no movement occurs at all when both monitors are on equal workspaces or when I'm trying to move the only window of a workspace.

Regarding the plugin versions, I do find it really odd how hyprpm list doesn't output neither full remote urls nor current revisions, however hyprpm update tells me this:

✔ Headers up to date.

→ checking for updates for hyprsplit                                                                                                                                                                                
→ Cloning https://github.com/shezdy/hyprsplit                                                                                                                                                                       
→ Plugin has revision set, resetting: main                                                                                                                                                                          
✔ repository hyprsplit is up-to-date.                                                                                                                                                                               
→ checking for updates for hy3                                                                                                                                                                                      
→ Cloning https://github.com/ojasookert/hy3                                                                                                                                                                         
→ Plugin has revision set, resetting: 5f5e9550cca1242cc01c0c66537aa25f4a99b5db                                                                                                                                      
✔ repository hy3 is up-to-date.                                                                                                                                                                                     
 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  6 / 6  Done!                                                                                                                                                   
✔ Ensuring plugin load state
✔ Plugin load state ensured

At this point, I'm not sure what's the issue on my side. Am I missing something?

@daniel-hernandez-sony
Copy link

Very much looking forward to this. Thank you everyone for working on this and testing. Let me know if another opinion / test could be useful

@Dimfred
Copy link

Dimfred commented Feb 27, 2025

@ojasookert thank you!
Checked out your branch and am running it. Works fine. But it seems that building hy3 on my own, kinda broke the font and some other things which is a little weird.
Any ideas?

@Dimfred
Copy link

Dimfred commented Apr 6, 2025

Any progress on this?

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

Successfully merging this pull request may close these issues.

5 participants