feat(startup settings): use /proc/{pid}/environ
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,18 @@ impl CoreSurface {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn pid(&self) -> Option<i32> {
|
||||
Some(
|
||||
self.weak_surface
|
||||
.upgrade()
|
||||
.ok()?
|
||||
.client()?
|
||||
.get_credentials(&self.dh)
|
||||
.ok()?
|
||||
.pid,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn wayland_state(&self) -> Arc<Mutex<WaylandState>> {
|
||||
self.state.upgrade().unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user