added a always-there variable called window_name, that contains.. who would have guessed.. the window name - LegendOfMiracles

This commit is contained in:
ur name 2020-10-19 15:57:58 +00:00 committed by ElKowar
parent 44be81d0b1
commit 4a9a712af8

View file

@ -104,7 +104,7 @@ impl App {
pos: Option<util::Coords>, pos: Option<util::Coords>,
size: Option<util::Coords>, size: Option<util::Coords>,
) -> Result<()> { ) -> Result<()> {
// remove and close existing window of the same type // remove and close existing window with the same name
let _ = self.close_window(window_name); let _ = self.close_window(window_name);
let mut window_def = self let mut window_def = self
@ -131,18 +131,22 @@ impl App {
// run on_screen_changed to set the visual correctly initially. // run on_screen_changed to set the visual correctly initially.
on_screen_changed(&window, None); on_screen_changed(&window, None);
window.connect_screen_changed(on_screen_changed); window.connect_screen_changed(on_screen_changed);
let mut almost_empty_local_state = HashMap::new();
let empty_local_state = HashMap::new(); almost_empty_local_state.insert(
VarName("window_name".to_string()),
crate::value::AttrValue::from_primitive(window_name.to_string()),
);
let root_widget = &widgets::widget_use_to_gtk_widget( let root_widget = &widgets::widget_use_to_gtk_widget(
&self.eww_config.get_widgets(), &self.eww_config.get_widgets(),
&mut self.eww_state, &mut self.eww_state,
window_name, window_name,
&empty_local_state, &almost_empty_local_state,
&window_def.widget, &window_def.widget,
)?; )?;
root_widget.get_style_context().add_class(&window_name.to_string()); root_widget.get_style_context().add_class(&window_name.to_string());
window.add(root_widget); window.add(root_widget);
// REAL SHIT 0_o :elkowar_with_a_looking_glass:
window.show_all(); window.show_all();
let gdk_window = window.get_window().context("couldn't get gdk window from gtk window")?; let gdk_window = window.get_window().context("couldn't get gdk window from gtk window")?;