I want to change the default icon of any dialog in zenity , I write this line of code for ERROR Dialog

zenity --error --text='Icon As It Is' --window-icon=/home/ --icon-name=64.png --no-wrap

From above Line I succeed To remove default icon, But I want To Change the default icon with 64.png (64.png is 64*64 screen resolution image).

The default icon in the dialog box for error is ' -(Minus) sign in red colour' ,for info ' small i in blue color '. It's this icon I want to change.

I am using Linux mint 19.

  • 1
    According to the man page (man zenity) there is no --icon-name option. Have you tried --window-icon=/home/64.png like shown in the examples? – roaima Dec 8 '18 at 13:41
  • @roaima Thanks For (man zenity ), You can see --icon-name=NAME ** For ERROR dialog if you type *zenity--help-error in terminal , I Tried Your Trick But nothing happen new, Actually when we use this only ** --window-icon=/home/64.png* in zenity error then default error icon is visible, But when we use in zenity error this --window-icon=/home/64.png --icon-name=64.png then no any icon is visible. – AlphaCoder Dec 8 '18 at 16:54
  • What OS are you using? I really don't see an --icon-name in my version on Debian Linux. – roaima Dec 8 '18 at 22:24
  • @roaima I am using Linux mint 19 and I want 64.png at dialog icon, you can see, the default icon for error is ' -(Minus) sign in red colour' ,for info ' small i in blue color ' – AlphaCoder Dec 9 '18 at 3:03

1st, --window-icon is the icon that is displayed in the title bar of the window, not the icon within the dialog box, which is placed to the left of the text you specify.

2nd, the latter icon can be set with --icon-name, which is an undocumented feature that does not appear in the man page.

However, a path is not allowed here, rather just one of the predefined names "error", "info", "question", "warning", and probably "password".

On Debian, these names are translated to icon file paths, for example "info" to /usr/share/icons/gnome/xx/status/dialog-information.png, where "xx" is the icon resolution that is calculated to be appropriate for being displayed in the dialog depending on the screen resolution, for instance "48x48".

If you set --icon-name to something invalid, then no icon is displayed at all.

If you omit --icon-name, then a hardcoded icon in zenity is used.

So, if you want to display a different icon for instance in the "information dialog", you would have to specify --icon-name=info and replace the existing icon e.g. /usr/share/icons/gnome/48x48/status/dialog-information.png with one of your liking, which can have a resolution different from 48x48.


Speaking of the gnome/ subdirectory: This corresponds to the icon theme I had selected in my appearance settings. Had I selected "Adwaita" for instance, then the subdirectory would be Adwaita/.

  • It seems like We are changing dialog icon permanently, It helps for ERROR and WARNING dialogs but for INFO I am writing program for multiple dialog icons at single run, – AlphaCoder Dec 9 '18 at 5:40
  • and how can i get this path as you specified /usr/share/icons/gnome/48*48/status/dialog-information.png – AlphaCoder Dec 9 '18 at 5:42
  • How to get the path? I don't know, I stumbled upon this in the past, when I was trying to accomplish the same as you. – nst0022 Dec 9 '18 at 10:07
  • I Tried with locate usr/share/icon/gnome/ , It was awesome experience. Thank You For conceal the mystry – AlphaCoder Dec 9 '18 at 11:49
  • I tried with changing default icon in 48*48 but it is still not work. – AlphaCoder Dec 9 '18 at 12:36

@nst0022 is correct, use --icon-name="foo", but it seems you can use any of the standard icon names in GNOME (see https://developer.gnome.org/icon-naming-spec/#names).

Thanks the folks answering this question here: https://askubuntu.com/questions/526202/getting-window-icon-to-work-with-zenity

New contributor
Paulo Raposo is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.