Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extending the 'Adding a button into the header bar' section #12

Open
MadameMalady opened this issue Nov 22, 2022 · 1 comment
Open

Extending the 'Adding a button into the header bar' section #12

MadameMalady opened this issue Nov 22, 2022 · 1 comment

Comments

@MadameMalady
Copy link

I have some tips / information based on trial and error that I think could help extend this section a little bit.

Firstly, in this part, you say:

'If you were adding a new action icon it would go in /usr/share/icons/hicolor/scalable/actions'

However, this is only good if you're using default icons, and is no good if you have a theme set that's not hicolor.

A better way (to the best of my knowledge) to explain using symbolic icons would be that it will look for an svg matching the
specified svg name, in the currently set theme, so if you have for example a custon svg you want for a button, and your theme is Yaru, you would copy your svg to /usr/share/icons/Yaru/scalable/actions, than reference its name.

You can also replace a button other than a header bar one with an image with set_icon_name.
Adwaita has 'Adw.ButtonContent for adding an icon next to a label, which may also be worth looking into adding if interested.
I hope this was helpful.

@Taiko2k
Copy link
Owner

Taiko2k commented Nov 22, 2022

I find the topic of icons in GTK confusing, I'm not sure what the right way of doing it is.

Though,

However, this is only good if you're using default icons, and is no good if you have a theme set that's not hicolor.

A better way (to the best of my knowledge) to explain using symbolic icons would be that it will look for an svg matching the specified svg name, in the currently set theme, so if you have for example a custon svg you want for a button, and your theme is Yaru, you would copy your svg to /usr/share/icons/Yaru/scalable/actions, than reference its name.

Of course, you wouldn't put your app icon in a theme folder, because it wouldn't show if the user had a different theme selected. All themes inherit hicolor so it should work there. GTK should resolve the name without needing to specify file type too.

I don't think this is what most applications do though. I'm not sure what the generally accepted way of doing it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants