toast icon indicating copy to clipboard operation
toast copied to clipboard

Windows 7?

Open ivanbportugal opened this issue 8 years ago • 6 comments

Any chance this might be enhanced to work on Windows 7?

Unable to find type [Windows.UI.Notifications.ToastNotificationManager,Windows.UI.Notifications, ContentType=WindowsRuntime].    
At C:\Users\<user>\AppData\Local\Temp\<long-hash>.ps1:2 char:1                                       
+ [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifi ...                                                      
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                          
    + CategoryInfo          : InvalidOperation: (Windows.UI.Noti...=WindowsRuntime:TypeName) [], RuntimeException                
    + FullyQualifiedErrorId : TypeNotFound                                                                                       

ivanbportugal avatar Feb 19 '17 22:02 ivanbportugal

I'm happy to investigate getting this working with Windows 7 - however just note that the full functionality of this library is likely incompatible with some of the APIs available in Windows 7.

For instance, Windows 7 doesn't have Toast notifications, instead Balloon notifications are used - but I currently don't know how that will work, because that requires an app to add it's own tray icon. Luckily I have a spare Windows 7 license laying around, so I can do some more thorough investigating at some point.

Can't put a time-frame, or a guarantee on this - as I don't have much time right now - but it's open for anybody to pick up if they desire 😛


Edit: Also note that adding Windows 7 support will likely add support for Windows XP and Vista - but I certainly won't be going out of my way to test either of them.

jmshal avatar Feb 19 '17 23:02 jmshal

@jacobmarshall Thanks for the prompt reply. I will occasionally look into this too... Probably start by reverse engineering this Balloon Notifier

ivanbportugal avatar Feb 20 '17 01:02 ivanbportugal

@jacobmarshall Thanks for the prompt reply. I will occasionally look into this too... Probably start by reverse engineering this Balloon Notifier

@ivanbportugal It looks like node-notifier uses http://www.paralint.com/projects/notifu/ to deliver notifications for Windows prior to Windows 8. But while this kind of tool would solve this issue - I'm hesitant to use external pre-compiled binaries. Especially when the same outcome could be achieved using PowerShell.

I might take a quick look tonight - depending on how quickly I can setup a Windows 7 VM, and update you in the morning as to how much effort I believe it may take. I wouldn't mind doing some major refactoring, as this tool was almost the first tool I wrote in Go, so there's probably a lot which could be improved upon.

jmshal avatar Feb 20 '17 01:02 jmshal

@jacobmarshall Agreed. I'll let you know if I think of anything else 👍 Sorry for the accidental close + reopen!

ivanbportugal avatar Feb 20 '17 14:02 ivanbportugal

Spent some time last night trying to install Windows 7, eventually got it working, but I ended up using Hyper-V, which I've used very little of in the past. Still need to finish setting it up (networking isn't working).

I will keep this issue updated when I know more.

jmshal avatar Feb 20 '17 20:02 jmshal

the following should work on w7 (not tested, I have no win7 available here)

[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
$o = New-Object System.Windows.Forms.NotifyIcon

$o.Icon="D:\path\to\some.ico"
$o.BalloonTipIcon="Error"
$o.BalloonTipText="A file needed to complete the operation could not be found."
$o.BalloonTipTitle="File Not Found"

$o.Visible=$True
$o.ShowBalloonTip(10000)

xiorcal avatar Jan 12 '18 20:01 xiorcal