sqweek / dialog

Simple cross-platform dialog API for go-lang
ISC License
492 stars 76 forks source link

Set the icon #22

Open meskio opened 5 years ago

meskio commented 5 years ago

Should we have support to set up the icon for the dialogs?

I have the code for linux: https://0xacab.org/leap/go-dialog/commit/887ac7700af3a5642c2d2e27d8ac56860d6622b6

But I haven't explore yet how to do it for windows and cocoa, or if it makes sense there.

sqweek commented 5 years ago

Is this an icon which appears next to the message in the dialog? Or is it part of the title bar? I expect the former, just trying to clarify as I'm not familiar with the gtk call.

I'm not sure how I feel about the api requiring a filename. On the one hand it's simple because we don't have to worry about os-specific icon types/structures/formats, but on the other hand it's awkward for someone who wants to use builtin icons and seems to mandate that the file is read from disk every time a dialog is opened.

meskio commented 5 years ago

The icon is used as the application icon. So, at least in gnome, is the icon that appears in the menu bar on the window list, is used when you switch apps with alt-tab or in the notifications when the dialogs pop up in background.

sqweek commented 5 years ago

Ahhh gotcha. I feel like that's a bit out of scope for this package - isn't that usually handled by distributing a .Desktop file with the app? Or some other app-wide call? I could be mistaken, I don't think I ever figured this out for linux as my regular window manager there didn't use icons.

Or is the problem that you have configured an icon for the rest of your app but it doesn't affect dialogs spawned by this package?

meskio commented 5 years ago

The .Desktop adds the image to the menu entry, but not to the dialogs. Without the icon being selected the dialogs spawned appear with an ugly default icon.