Windows-10-Toast-Notifications
Windows-10-Toast-Notifications copied to clipboard
Go to application on click?
When you click the notification is it possible to select the application that triggered the notification?
Sorry for the late reply. I'm not entirely sure if this is possible will check the same.
@Siecje I might have figured a way to enable this. Could you please explain the use case you are trying to implement
When you click any other notification it takes you to the application that created the notification.
You get a notification from Slack and you click it and it opens Slack with the message that triggered the notification.
I have same issue.
I tried some changes for solution but i couldn't.
I tried changes,
message_map = {WM_DESTROY: self.on_destroy, }
to
message_map = {WM_LBUTTONDOWN: self.on_destroy, }
or
message_map = {WA_CLICKACTIVE: self.on_destroy, }
that's not working.
Are there any updates on this?
Also interested in updates here. My use case would be to open a webpage when the notification is clicked. At a high level, that means being able to start a process with parameters passed in, I suppose. Even being able to override a method on click would be very useful!
I would love to do this guys. But I'm failing to implement this. Any help would be appreciated.
@sonerb Actually it's works if you tried to put a simple print in on_destroy method you will see that it's working (only with WA_CLICKACTIVE)
For some reasons, if you set a WA_CLICKACTIVE to map, notification will be auto clicked anyway after duration counted down
I've been struggling with it for about a day now... I've found something that works for me..
I've changed the CB to a wndProc self.wc.lpfnWndProc = self.wndProc
used win32gui to get the messages.
Shell_NotifyIcon(NIM_MODIFY, (self.hwnd, 0, NIF_INFO, WM_USER + 20, hicon, "Balloon Tooltip", msg, 200, title)) import win32gui win32gui.PumpMessages()
and after debugging...
def wndProc(self,hWnd, message, wParam, lParam): if message == 1044: if lParam == 1029: self.on_click(hWnd, message, wParam, lParam) self.on_destroy(hWnd, message, wParam, lParam) elif lParam == 1028: self.on_destroy(hWnd, message, wParam, lParam)
where lParam == 1029 it means notification was clicked.
when lParam == 1028 it means notification is done without clicking.
I am also need that. Can you also add buttons and images support? Thanks.
I'm real interested in some sort of click callback. Use case: Open an URL in browser on click.
@Talavidan88 Can you by any chance share a gist with a complete example. I'm having a hard time deciphering your instructions above. I think some of the formatting was lost.
Theoretically, if you had the handle of the window, you could win32gui.SetForegroundWindow
@teltmau5 , I added this functionality in pull request #38 To open a link in browser just create and pass callback function like this:
def open_browser_tab(url):
webbrowser.open(url, new=0)
Sorry for the late reply. I'm not entirely sure if this is possible will check the same.
just fyi, @Charnelx made this work in pull request #38 . could you merge it and put that on pypi?
EDIT: actually could you merge all your pull requests? people are clearly liking this enough to help out :)