NightmareXIV / NotificationMaster

Notifies you about various events while your game is minimized.
GNU Affero General Public License v3.0
9 stars 3 forks source link

Bring to foreground does not works reliably #3

Open perks opened 2 years ago

perks commented 2 years ago

Sometimes in PF I will alt tab while people discuss strats, sometimes however they will start the countdown early -- is there a way for the plugin to notify on countdown start?

Limiana commented 2 years ago

Hello, yes, this is possible Enable "Chat message notify" module and add a message with the following settings: Type: custom - 185 Text: "Battle commencing in" (you might need to adjust this bit if you are using language other than english) Search mode: exact Like this: image

perks commented 2 years ago

Ahh thank you! Had to change matching patern to regex (otherwise it wouldn't catch it) but seems to do the trick.

Does having overlays (ACT) in fullscreen windowless effect the "Bring to Foreground" feature? Noticed the flash notifications going off but that functionality doesn't seem to trigger

Limiana commented 2 years ago

Shouldn't need regex, make sure you're not including any extra spaces or new lines, especially if you have used copying from message log feature (in next version newlines won't be copied) If it still doesn't works without regex, can you attach file %appdata%\xivlauncher\pluginConfigs\NotificationMaster.json? As for bringing to foreground, there shouldn't be any interferences with act, but I'll test it additionally.

Limiana commented 2 years ago

I wasn't able to replicate bring to front problem. Can you tell me which steps exactly you're doing to make it happen?

perks commented 2 years ago

https://imgur.com/a/L4pYx0P Here is a gif I made. For" Engage" you can see the flash on notification but no switch. For "Battle Commencing" I couldn't actually get it to work correctly at all.

Limiana commented 2 years ago

You don't need to include * at the end of the message, just Battle commencing in If it still doesn't works after removing *, please attach file %appdata%\xivlauncher\pluginConfigs\NotificationMaster.json to your message. As for switching... I'll have to investigate that. I'll likely need to make debug build and send it to you to test it. I'll let you know when it's ready.

Limiana commented 2 years ago

Inability to always bring game foreground is confirmed as a bug. However, this is a windows bug: winapi function responsible for activating window functions very poorly. Unfortunately, fixing it is not easy and more time will be needed to do so.

perks commented 2 years ago

Yeah you are right, I checked and the the winapi function has a lot of caveats, most of which won't allow you to foreground another process. I tried implementing the AttachThreadInput hack and minimizing ffxiv process but it didn't seem to work :(

And you were right. In the text box editor in dalamud there was no trailing white space, but when I looked at the saved config json, there was a lot of whitespace + the new line stuff. Deleting that fixed it!

perks commented 2 years ago

https://github.com/Eternita-S/NotificationMaster/compare/master...perks:window-foreground-hack?expand=1 if you want to take a look maybe I did something wrong there

Limiana commented 2 years ago

Thank you! I'll try to give it a test and see if it's enough.

Limiana commented 2 years ago

Unfortunately AttachThreadInput doesn't works reliably. minimize + restore trick seems to do the job though