D4koon / WhatsappTray

Minimize Whatsapp Desktop-Client to Tray
GNU General Public License v3.0
388 stars 30 forks source link

[Enhancement] Make clicking X minimize WhatsApp to tray instead of closing it. #2

Closed cactysman closed 7 years ago

cactysman commented 7 years ago

Pretty simple. Catch the closing event and just minimize the app. Could be a setting or something.

I'm used to clicking X on apps like Discord or Steam because they still keep running afterwards. WhatsApp just closes which is annoying.

cactysman commented 7 years ago

I'm not a C++ programmer but I still tried to create that feature myself here: https://github.com/Metaa/WhatsappTray/blob/master/WhatsappTray/Hook.cpp

The code of course is messy because of all the debugging but it's just supposed to be a dump of how far I got. I just couldn't get to the point where I could catch WM_CLOSE.

cactysman commented 7 years ago

I was talking to someone and we came to the conclusion that intercepting the close event is unlikely to be possible without injecting custom code throught something like DLLs.

This tool could be used to replace one of WhatsApps static DLL files (libEGL? it's only 93kb of size) with one that wraps the original DLL and would then add our code to it so that we can intercept the close event internally: https://www.codeproject.com/articles/16541/create-your-proxy-dlls-automatically

D4koon commented 7 years ago

I think its not that hard :) I setup my new pc yesterday with vs and only reread the code. Today i will try to implement it.

D4koon commented 7 years ago

Wow that is actualy harder than i thought -.- Maybe i give it a another try on the we.

D4koon commented 7 years ago

Finaly i found a way to implement this :D Its a bit hackish but who cares als long as it works...

You have to start it with --closeToTray

I will upload a binary soon.

cactysman commented 7 years ago

Woah, that works like a charm! Awesome!

Thanks a lot 👍 Finally a reason to use the desktop client.

riz-hossain commented 3 years ago

I just tried --closeToTray but it still closes .. i know this was done in 2017 ..

cactysman commented 3 years ago

I just tried --closeToTray but it still closes .. i know this was done in 2017 ..

Never stopped working for me. 😮

riz-hossain commented 3 years ago

I just tried --closeToTray but it still closes .. i know this was done in 2017 ..

Never stopped working for me. 😮

Thanks for confirming, I must be doing something wrong. I will give it a try again later in the week.

iZuRriX commented 3 years ago

Finaly i found a way to implement this :D Its a bit hackish but who cares als long as it works...

You have to start it with --closeToTray

I will upload a binary soon.

Can you explain how you did? What am I supposed to change and where?

D4koon commented 3 years ago

Rightclick on the tray-icon and activate "close to tray"