feat(startup settings): use /proc/{pid}/environ

This commit is contained in:
Nova
2022-12-10 09:17:37 -05:00
parent 7a4d557c61
commit 40bcd61b98
5 changed files with 68 additions and 33 deletions

View File

@@ -4,7 +4,7 @@ use super::{
};
use crate::{
core::{
client::{Client, INTERNAL_CLIENT},
client::{get_env, startup_settings, Client, INTERNAL_CLIENT},
registry::Registry,
},
nodes::{
@@ -68,7 +68,7 @@ impl PanelItem {
&nanoid!(),
true,
));
Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
let spatial = Spatial::add_to(&node, None, Mat4::IDENTITY, false).unwrap();
let specialization = ItemType::Panel(PanelItem {
node: Arc::downgrade(&node),
@@ -103,6 +103,13 @@ impl PanelItem {
node.add_local_signal("keyboard_deactivate", PanelItem::keyboard_deactivate_flex);
node.add_local_signal("keyboard_key_state", PanelItem::keyboard_key_state_flex);
node.add_local_signal("resize", PanelItem::resize_flex);
if let Some(startup_settings) = core_surface
.pid()
.and_then(|pid| get_env(pid).ok())
.and_then(|env| startup_settings(&env))
{
spatial.set_local_transform(startup_settings.transform);
}
node
}