AntonyCorbett / OnlyT

Meeting Timer
MIT License
109 stars 42 forks source link

Disambiguate monitors with same friendly name #478

Open squogg opened 1 year ago

squogg commented 1 year ago

We've got several monitors behind SDI adaptors which are all reporting their name as "FOXUN", meaning it's a bit of a guessing game as to which to pick when things change (and also, we suspect, the reason why the countdown sometimes doesn't appear on the right monitor).

Would it be possible to perhaps order the list of monitors by some fixed ID and then append an incremental number where there are multiple friendly names..? (ie, so that for a given system that hasn't changed, FOXUN1 would always refer to the same monitor, as would FOXUN2, etc).

Happy to submit a proposed change if this hasn't been encountered/discussed before, and if it is not anticipated that this could cause other problems that I'm not aware of.

AntonyCorbett commented 1 year ago

@squogg Thanks. I think it has been noted previously. There are similar routines in OnlyM. I will check and get back to you.

AntonyCorbett commented 1 year ago

@squogg Do the monitors consistently appear in the same order in the Settings page drop-down list? I ask because in MonitorsService.GetSystemMonitors, the monitors are sorted by friendly name and then by the unique monitor ID. If the graphics driver always enumerates the devices in the same order then this should ensure that the monitors appear in the list in the same order too (even though they may have the same friendly name). We could append part of the ID or part of the device name to the friendly name, but if the system doesn't consistently enumerate monitors (e.g. if one or more is turned off) I don't think this would help. Your further suggestions or code snippets are welcome.

squogg commented 1 year ago

@AntonyCorbett Yes, the monitors are returned with the same registry/device info and therefore sorted in the same order - I think the issues are simply down to confusion due tot he same name currently (and possibly interaction with JW Library when the countdown timer sometimes doesn't appear as it's "under" JW Library - I need to investigate this one futher, as I think startup order might be an issue here).

Appending SanitizeScreenDeviceName(screen.DeviceName) to screen.DeviceFriendlyName() in GetSystemMonitors() would be consistent, and if this could be considered as an enhancement, it would be an aid to our AV team for those few times where we do rejig what is being displayed on what monitor.

I might also try to locally test adding something to config to allow user-specified friendly names using the monitor format stored in options.json - eg, something like:

"UserSpecifiedFriendlyMonitorNames": [ { "MONITOR\\HEC0030\\{4d36e96e-e325-11ce-bfc1-08002be10318}\\0005": "Main Hall Displays" }, { "MONITOR\\IVC0330\\{4d36e80a-e325-11ce-bfc1-08002be10318}\\0004": "Timer Monitor" } ],

If this latter helps the team, I'd like to get your thoughts about whether this too could be considered an enhancement, and if so, the most appropriate way to go about implementing it (trying to balance our needs with others/etc).

AntonyCorbett commented 1 year ago

interaction with JW Library when the countdown timer sometimes doesn't appear

This is a known issue. The problem is that the countdown will only display over the top of JWL if the OnlyT window is active at the time the countdown begins.

AntonyCorbett commented 1 year ago

Appending SanitizeScreenDeviceName(screen.DeviceName) to screen.DeviceFriendlyName() in GetSystemMonitors() would be consistent, and if this could be considered as an enhancement, it would be an aid to our AV team for those few times where we do rejig what is being displayed on what monitor.

Noted. Thanks

AntonyCorbett commented 1 year ago

I might also try to locally test adding something to config to allow user-specified friendly names using the monitor format stored in options.json - eg, something like:

Please feel free to submit a PR if you have time. You don't necessarily have to complete the UI - just the options so that the json file can be manually edited would be a good start.

squogg commented 1 year ago

Hi! Apologies for the delay in replying... I've got rudimentary UI support for renaming and it works with caveats. Before attempting a PR though:

First - please bear with me: my experience is 100% services/APIs/etc and a bit of web, with no WPF/MAUI/etc - so the observable bit isn't working as desired likey because I'm using a list in the view model which isn't changing - it's the properties on the list items do.

Second - I've added a few entries to the resources but I can't translate these - is there a protocol for that?

Third - I can see code patterns and I've tried to follow these, but I'm aware that I've likely missed something - so happy to modify/etc things if that would help.

AntonyCorbett commented 1 year ago

@squogg Sorry for the delay in responding!

Please feel free to create a "draft" PR to signify that it is work-in-progress. This would make it easier for me to offer guidance on some of the UI questions.

Regarding the resources, please add items to the resources.resx file only. Do not modify other language resource files. All localisation is done using the Crowdin platform, so any changes made to resources.resx (when the PR is merged to the master) will be dealt with automatically.