-
Notifications
You must be signed in to change notification settings - Fork 44
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
hy3:movefocus
doesn't change monitor
#2
Comments
On the roadmap currently, just not my top priority. |
#!/bin/bash
NowWindow="$(hyprctl activewindow -j | jaq ".address")"
if [ "$1" == "right" ] ; then
hyprctl dispatch hy3:movefocus r && sleep 0.05
ThenWindow="$(hyprctl activewindow -j | jaq ".address")"
if [ "$NowWindow" == "$ThenWindow" ]; then
# hyprctl dispatch focusmonitor +1
hyprctl dispatch movefocus r
fi
elif [ "$1" == "left" ] ; then
hyprctl dispatch hy3:movefocus l && sleep 0.05
ThenWindow="$(hyprctl activewindow -j | jaq ".address")"
if [ "$NowWindow" == "$ThenWindow" ]; then
# hyprctl dispatch focusmonitor -1
hyprctl dispatch movefocus l
fi
fi a... "workaround". |
@JustSimplyKyle works for me! ❤️ For anyone else stumbling upon this. Should be called like this, for example:
|
I modified the script so that up and down is also working. #!/bin/bash
NowWindow="$(hyprctl activewindow -j | jq ".address")"
hyprctl dispatch hy3:movefocus "$1" # && sleep 0.05
ThenWindow="$(hyprctl activewindow -j | jq ".address")"
if [ "$NowWindow" == "$ThenWindow" ]; then
hyprctl dispatch movefocus "$1"
fi Deleting the sleep 0.05 is working fine for me. You may put it back if you experience any issues.
|
Hi guys, here the same behavior for "movetoworkspace", or at least a ... sloppy solution for a problem that has no real other solution ("implemented") yet. I feel dirty myself for coding this, and not just reading into the C++ Code. Basically does the same as the code above: if the window was able to move, do nothing. If it wasn't, move it to ANOTHER workspace. Not the correct one. Not on the correct side. Works best with 2 screens and a low amount of windows on each workspace. This is just a small quick fix. movescreen.sh:
And in the hyprland.conf:
|
iirc, you can do |
With what command exactly? |
I was thinking of the dispatcher |
Oh, i didn't know that! This works perfectly as well! Also, i found a small bug as well: if you move a window that was first on the left half of a screen to the top half, the position itself doesn't change. But position and size together should be good enough to pin down if the window actually moved. For this dirty dirty script, i won't care about the edge case. So to summarize:
Of course it still doesn't move to the correct side, but that's for later, i suppose. |
Question: Does Hyprland order the Monitor's ID deterministicly? If so, for a purely horizontal layout, it may be possible to put the order in an array, and move it accordingly to the input(l,r,u,d) |
I just checked with a 3 monitor setup. Sadly, it does not. At least when i reorder the monitors afterwards, "+1" still goes into the same direction as beforehand. |
#!/bin/bash
mapfile -t SortedMonitors <<< "$(hyprctl monitors -j | jq -r 'sort_by(.x) | .[] | .id')"
# SortedMonitors=(2 0 1)
CurrentMonitor="$(hyprctl activeworkspace -j | jq ".monitorID")"
Direction="$1"
SortedMonitorsSize="${#SortedMonitors[@]}"
declare CurrentIndex
# find the index of the current monitor in the sorted monitors array
for index in "${!SortedMonitors[@]}"; do
if [[ "${SortedMonitors[$index]}" == "$CurrentMonitor" ]]; then
CurrentIndex="$index"
break
fi
done
if [[ $Direction == "r" ]]; then
((CurrentIndex++))
elif [[ $Direction == "l" ]]; then
((CurrentIndex--))
fi
# Loopback logic
if (( CurrentIndex == SortedMonitorsSize )); then
CurrentIndex=0
elif (( CurrentIndex < 0 )); then
CurrentIndex=$((SortedMonitorsSize - 1))
fi
NextMonitorId="${SortedMonitors[$CurrentIndex]}"
hyprctl dispatch movewindow mon:"$NextMonitorId" @oddlySpecificLama , use this with arguments |
I was unhappy with the latency introduced by the movefocus script (switching windows felt slow, even after removing the sleep - timing the script, executing it tooks 50 ms). Turns out hyprctl is rather slow to load, probably due to linking to unnecessarily many dynamic libraries. So here's my hacked version that:
SOCAT="socat - $XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket.sock"
if [ "$1" = "r" ] ; then
NowWindow="$(echo -n '[[BATCH]]j/activewindow;/dispatch hy3:movefocus r' |$SOCAT |grep -vE '^(ok)?$' | jaq '.address')"
ThenWindow="$(echo -n 'j/activewindow' |$SOCAT | jaq ".address")"
if [ "$NowWindow" = "$ThenWindow" ]; then
echo -n '/dispatch movefocus r' |$SOCAT
fi
elif [ "$1" = "l" ] ; then
NowWindow="$(echo -n '[[BATCH]]j/activewindow;/dispatch hy3:movefocus l' |$SOCAT |grep -vE '^(ok)?$' | jaq ".address")"
ThenWindow="$(echo -n 'j/activewindow' |$SOCAT| jaq ".address")"
if [ "$NowWindow" = "$ThenWindow" ]; then
echo -n '/dispatch movefocus l' |$SOCAT
fi
fi I think the grep thing is a bit ugly, but what can you do, hyprctl sometimes gives JSON and sometimes "ok". :( Definitely feels much snappier, though! |
... or this PR for hyprctl to link against much less libraries: hyprwm/Hyprland#7212 |
When using multiple monitors, moving the focus or a window towards the other monitor doesn't change the monitor/workspace.
Expected behavior:
Using
hy3:movefocus
orhy3:movewindow
against the edge of the monitor moves to the workspace on the next monitor likemovefocus
and i3/sway.Actual behavior:
hy3:movefocus
stops at the edge of the monitor.The text was updated successfully, but these errors were encountered: