Secondary windows on the active monitor
Multi-monitor: secondary windows of the selected apps (Telegram media viewer, etc.) open on the monitor of the app's active window instead of the remembered one
Author: limpompo
Useful if you have several monitors. Many apps remember which monitor a
secondary window (media viewer, player, dialog) was opened on and open it there
again, even if you now work with the app on another monitor. For example,
Telegram Desktop opens photos and videos on the monitor where the viewer was
last time, not where the chat is.

The mod intercepts the showing of secondary windows of the apps from the
Applications list and, if a window is about to appear on a different monitor
than the app's active window, moves it to the active window's monitor before
it is shown. By default the list contains a placeholder (test.exe), replace it with your app, for example Telegram Desktop (Telegram.exe);
add any other app by its executable name in the mod settings.
For apps that are not built with Qt, the mod decides which windows are regular
ones by a heuristic (it skips menus, tooltips, tool windows and the like), so
it may move something it shouldn't, such as a drop-down list or a splash
screen. Telegram is the only app the mod was tested with; if another app
misbehaves, use the Window title filter of that app.
Which windows are moved: all secondary windows of the app that get their
own window - for Telegram also picture-in-picture video, call windows and
chats opened in a separate window. Menus, tooltips, notifications and tool
windows are not moved. If you keep some windows on another monitor on purpose,
set a Window title filter for the app to limit the mod to windows with a
given title.
How a window is placed:
- it keeps its relative position on the screen (a window in the top right
corner of one monitor appears in the top right corner of the other);
- a window larger than the target monitor is shrunk to fit;
- a fullscreen window stays fullscreen;
- a maximized window stays maximized, and when restored it stays on the new
monitor;
- monitors with different scaling are taken into account.
Keeping the position and accounting for scaling can each be turned off in the
settings.
The mod is loaded into every process and unloads itself at once from those that
are not in the Applications list. An app added to the list starts to work
after it is restarted; removing an app from the list applies immediately.
System files and app data are not modified.