How to change Zenity dialog icon

zenity

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.

Best Answer

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.

Update:

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/.

Related Question