diff --git a/src/plwm.pl b/src/plwm.pl index 059bf97..9c608f1 100644 --- a/src/plwm.pl +++ b/src/plwm.pl @@ -1648,9 +1648,16 @@ % Update geometry if it changed global_key_value(monitor_geom, Output, PrevGeom), (PrevGeom \= Geom -> - global_key_newvalue(monitor_geom, Output, Geom), - format(string(Msg), "Monitor \"~s\" geometry reconfigured", [Output]), - writeln(Msg) + (nb_getval(monitor_geom, AMonGeom), gen_assoc(OldMon, AMonGeom, Geom) -> + % If a previous monitor has this geom, this one became a mirror, unmanage it + delete_monitor(Output), + format(string(Msg), "Monitor \"~s\" is a mirror to \"~s\", unmanaging it", [Output, OldMon]), + writeln(Msg) + ; + global_key_newvalue(monitor_geom, Output, Geom), + format(string(Msg), "Monitor \"~s\" geometry reconfigured", [Output]), + writeln(Msg) + ) ; true) % Add new monitor @@ -2040,7 +2047,7 @@ init_monitor(Mon, Geom) :- % A monitor with this geometry is already managed, don't register mirror nb_getval(monitor_geom, AMonGeom), gen_assoc(OldMon, AMonGeom, Geom) -> - format(string(Msg), "Monitor \"~s\" has same geometry as \"~s\", ignoring it", [Mon, OldMon]), + format(string(Msg), "Monitor \"~s\" is a mirror to \"~s\", ignoring it", [Mon, OldMon]), writeln(Msg) ;