-
Notifications
You must be signed in to change notification settings - Fork 6
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
Wrong icon name #13
Comments
What do you mean by this, what colors if the icon itself is monochrome? |
|
|
From system resources, i guess. I don't even need the icons crate btw for both icons. I have the latest Fedora Workstation installed. use gtk::prelude::{BoxExt, GtkWindowExt};
use relm4::{gtk, ComponentParts, ComponentSender, RelmApp, RelmWidgetExt, SimpleComponent};
struct AppModel {}
struct AppWidgets {
image1: gtk::Image,
image2: gtk::Image,
}
impl SimpleComponent for AppModel {
type Input = ();
type Output = ();
type Init = ();
type Root = gtk::Window;
type Widgets = AppWidgets;
fn init_root() -> Self::Root {
gtk::Window::builder().title("Icons test").build()
}
/// Initialize the UI and model.
fn init(
_: Self::Init,
window: Self::Root,
_: ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
let model = AppModel {};
let vbox = gtk::Box::builder()
.orientation(gtk::Orientation::Vertical)
.spacing(5)
.build();
let image1 = gtk::Image::new();
image1.set_margin_all(5);
image1.set_icon_name(Some("network-workgroup"));
let image2 = gtk::Image::new();
image2.set_margin_all(5);
image2.set_icon_name(Some("network-workgroup-symbolic"));
window.set_child(Some(&vbox));
vbox.set_margin_all(5);
vbox.append(&image1);
vbox.append(&image2);
let widgets = AppWidgets { image1, image2 };
ComponentParts { model, widgets }
}
}
fn main() {
let app = RelmApp::new("relm4.test.icons");
app.run::<AppModel>(());
} [package]
name = "test_gtk_icons"
version = "0.1.0"
edition = "2021"
[dependencies]
relm4 = "0.9.1" |
Hm... I think that might be a system theme that you have installed, interesting. |
Are you sure |
I have all these icons already installed in my system, they come with Fedora distribution. But in case I want my app icons look the same on other systems I need to override these icons resources with relm4-icons. And since the crate has only symbolic versions of icons, I need to have all icons names with the |
I see. Don't get me wrong, I do think it is a fair request, I'm not 100% sure why removing |
What do you think is it a good idea to have only own icons resources and never allow use of system icons? |
Hard to say. On one hand I'd like to control the way application looks, on the other hand I'm glad I'm able to install Numix icons pack and many of the apps I use look better. I guess it needs to be configurable 🤔 |
Also there could be a problem when there is no particular icon in a system. |
I have
"network-workgroup"
in theicons.toml
file and use it in code:the generated file
icon_names.rs
contains these lines:the problem is the icon shown is not
network-workgroup-symbolic
but simplenetwork-workgroup
with colors.If I
set_icon_name: Some("network-workgroup-symbolic")
I get a symbolic icon as expected.The text was updated successfully, but these errors were encountered: