fix temporarily disabling a single monitor
The code in this else completely freezes my system when I run the
swayidle command to replicate xset dpms force off. No idea if it works
on multiple monitors, but for now avoid running when there's 1 monitor.
Also remove the comment with the function name in sway.
Don't switch to another disabled monitors
Since wlr_output_enable doesn't have any effect before finishing all the
procedure, a little hack allows to make use of focusmon(), which must
know the latest in about which output is currently disabled
Also improve performance in focusmon() and cleaner code in
outputmgrapplyortest()
Fix crash with no monitors left
When there's no monitors left, prevent the while in cleanupmon() to
become an infinite loop
Also switch to the left monitors instead of the right
closemon() has now only 1 parameter
Don't switch to disabled mons after unplug
Merge branch 'handleUnplug' into output-management
Back to closemon() with one parameter
With the recent changes in output-management, the extra argument in
closemon() would be needed only when unplugging the monitor, so it isn't
worth it anymore. Also now is more efficient.
Disable mon faster
Since focusmon() now never focuses disabled monitors, there's no need to
focus the disabled monitor first
Fix crash when disabling focused mon
m->link.next leads to errors if the monitor to disable doesn't have a
"next" (right) monitor and is currently focused. dirtmon() does more
checks.
In some previous commits m->link.next is told to be left monitor, which
is wrong
Also focusclient() explicitly checks for disabled monitors (this fixes
in case of more than one disabled monitor)
Merge branch 'handleUnplug' into output-management
Fix crash unplugging focused mon 2
Focus the top client on newmon, which we know for sure that it isn't
going to be unplugged or disabled and actually set that as the focused
monitor to move the focus. This is necessary to prevent crash when
disabling monitors with the output-management patch.
Merge branch 'handleUnplug' into output-management
Fix crash unplugging a focused mon
Focus newmon, which we know for sure that it isn't be unplugged or
disabled
Merge branch 'handleUnplug' into output-management
Focus client on a new monitor before closing
Block access to disabled monitor
Before this, pressing mod+comma or mod+period (focusmon function) moved
the focus to disabed monitors. Now, all disabled monitors are skipped
Move disabled clients to the left
To the nearest monitor to the left of the disabled one
Merge branch 'handleUnplug' into output-management
Closemon(), newmon as parameter
This allows to fix output-management: move clients to the monitor on the
left of the disabled one, instead of the leftmost (which might happen to
be the disabled one)
Also using wl_list_foreach() and then brake after the first iteration is
ugly and inefficient