From dca86beebefeb1f328be4213243d4257169fcf8f Mon Sep 17 00:00:00 2001 From: MikeMaximus Date: Sat, 24 Feb 2018 09:28:06 -0600 Subject: [PATCH] Changes for issue #125 --- GBM/Forms/frmMain.vb | 47 +++++++++++++++++++++++++++++++--- deb-package/gbm/DEBIAN/control | 4 +-- gbm.sh | 2 +- 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/GBM/Forms/frmMain.vb b/GBM/Forms/frmMain.vb index 1f85d61..6ade7dd 100644 --- a/GBM/Forms/frmMain.vb +++ b/GBM/Forms/frmMain.vb @@ -1225,6 +1225,11 @@ Public Class frmMain End Sub Public Sub UpdateLog(sLogUpdate As String, Optional bTrayUpdate As Boolean = True, Optional objIcon As System.Windows.Forms.ToolTipIcon = ToolTipIcon.Info, Optional bTimeStamp As Boolean = True) Handles oBackup.UpdateLog, oRestore.UpdateLog + Dim prsNotify As Process + Dim sUrgency As String + Dim sIconLocation As String + Dim sNotifyArgs As String + 'Thread Safe (If one control requires an invoke assume they all do) If txtLog.InvokeRequired = True Then Dim d As New UpdateLogCallBack(AddressOf UpdateLog) @@ -1260,9 +1265,45 @@ Public Class frmMain txtLog.Select(txtLog.TextLength, 0) txtLog.ScrollToCaret() - gMonTray.BalloonTipText = sLogUpdate - gMonTray.BalloonTipIcon = objIcon - If bTrayUpdate Then gMonTray.ShowBalloonTip(10000) + + If bTrayUpdate Then + If mgrCommon.IsUnix Then + 'Build args for notify-send + Select Case objIcon + Case ToolTipIcon.Error + sUrgency = "critical" + Case ToolTipIcon.Warning + sUrgency = "normal" + Case ToolTipIcon.Info + sUrgency = "low" + Case Else + sUrgency = "low" + End Select + + sIconLocation = "/usr/share/icons/hicolor/256x256/apps/gbm.png" + sNotifyArgs = "-i " & sIconLocation & " -u " & sUrgency & " -t 10000 """ & App_NameLong & """ """ & sLogUpdate.Replace("""", "\""") & """" + + Try + 'Execute notify-send + prsNotify = New Process + prsNotify.StartInfo.FileName = "/usr/bin/notify-send" + prsNotify.StartInfo.Arguments = sNotifyArgs + prsNotify.StartInfo.UseShellExecute = False + prsNotify.StartInfo.RedirectStandardOutput = True + prsNotify.StartInfo.CreateNoWindow = True + prsNotify.Start() + Catch ex As Exception + 'Show default notification style + gMonTray.BalloonTipText = sLogUpdate + gMonTray.BalloonTipIcon = objIcon + gMonTray.ShowBalloonTip(10000) + End Try + Else + gMonTray.BalloonTipText = sLogUpdate + gMonTray.BalloonTipIcon = objIcon + gMonTray.ShowBalloonTip(10000) + End If + End If End If Application.DoEvents() End Sub diff --git a/deb-package/gbm/DEBIAN/control b/deb-package/gbm/DEBIAN/control index 7ef146f..30abda0 100644 --- a/deb-package/gbm/DEBIAN/control +++ b/deb-package/gbm/DEBIAN/control @@ -2,8 +2,8 @@ Package: gbm Architecture: all Maintainer: Sebastian Riedel Priority: optional -Version: 1.0.5 +Version: 1.0.8 Homepage: https://mikemaximus.github.io/gbm-web/ Bugs: https://github.com/MikeMaximus/gbm/issues -Depends: mono-vbnc, libsqlite3-0, p7zip-full +Depends: mono-vbnc, libsqlite3-0, p7zip-full, libnotify-bin Description: Automatically backup your saved games! diff --git a/gbm.sh b/gbm.sh index 1ca9e26..8a751d7 100755 --- a/gbm.sh +++ b/gbm.sh @@ -1,6 +1,6 @@ #!/bin/sh -e #check for all dependencies -for prog in mono readlink df 7za;do +for prog in mono readlink df 7za notify-send;do [ -n "`whereis -b ${prog} | cut -sd' ' -f2`" ] || (echo "Please install ${prog}" && exit 1); done for lib in libsqlite3;do