Window icons (unix).

This commit is contained in:
Nuno Cruces 2022-05-24 12:02:51 +01:00
parent 205db7d4be
commit 550da1f8ed
5 changed files with 14 additions and 6 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 {

View File

@ -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
}