diff --git a/cmd/zenity/main.go b/cmd/zenity/main.go index ec5b5a2..8008832 100644 --- a/cmd/zenity/main.go +++ b/cmd/zenity/main.go @@ -403,6 +403,10 @@ func loadFlags() []zenity.Option { opts = append(opts, zenity.DefaultCancel()) } + if notification { + icon = windowIcon + } + switch icon { case "error", "dialog-error": opts = append(opts, zenity.ErrorIcon) diff --git a/msg_unix.go b/msg_unix.go index c8817e4..eb86aaf 100644 --- a/msg_unix.go +++ b/msg_unix.go @@ -43,6 +43,9 @@ func message(kind messageKind, text string, opts options) error { case NoIcon: args = append(args, "--icon-name=") } + if i, ok := opts.icon.(string); ok { + args = append(args, "--icon-name", i) + } out, err := zenutil.Run(opts.ctx, args) _, err = strResult(opts, out, err) diff --git a/notify_unix.go b/notify_unix.go index fd1c4cc..c31c095 100644 --- a/notify_unix.go +++ b/notify_unix.go @@ -19,7 +19,10 @@ func notify(text string, opts options) error { case PasswordIcon: args = append(args, "--window-icon=dialog-password") case NoIcon: - args = append(args, "--window-icon=dialog") + args = append(args, "--window-icon=") + } + if i, ok := opts.icon.(string); ok { + args = append(args, "--window-icon", i) } _, err := zenutil.Run(opts.ctx, args) diff --git a/notify_windows.go b/notify_windows.go index c335943..1b4003d 100644 --- a/notify_windows.go +++ b/notify_windows.go @@ -42,8 +42,6 @@ func notify(text string, opts options) error { args.InfoFlags |= 0x2 // NIIF_WARNING case ErrorIcon: args.InfoFlags |= 0x3 // NIIF_ERROR - case NoIcon: - // default: icon := getIcon(opts.icon) if icon.handle != 0 { diff --git a/util_unix.go b/util_unix.go index a9e6271..ca66265 100644 --- a/util_unix.go +++ b/util_unix.go @@ -42,9 +42,6 @@ func appendWidthHeight(args []string, opts options) []string { } func appendWindowIcon(args []string, opts options) []string { - if i, ok := opts.windowIcon.(string); ok { - args = append(args, "--window-icon", i) - } switch opts.windowIcon { case ErrorIcon: args = append(args, "--window-icon=error") @@ -55,6 +52,9 @@ func appendWindowIcon(args []string, opts options) []string { case QuestionIcon: args = append(args, "--window-icon=question") } + if i, ok := opts.windowIcon.(string); ok { + args = append(args, "--window-icon", i) + } return args }