pub struct GraphicalEnvironment {
pub wayland_display: Option<OsString>,
pub x11_display: Option<OsString>,
pub xdg_runtime_dir: Option<OsString>,
pub activation_token: Option<String>,
}Expand description
The graphical session to connect to: the variables that locate its display server, as some process sees them.
A long-running process can outlive the graphical session it was started in, so a platform
that attaches to a display server later can be given a fresher environment than its own.
While connected, programs the platform launches (for example to open a URL) get these
variables instead of the ones this process started with. Apply
App::graphical_environment to the programs an app launches, for the same reason.
Fields§
§wayland_display: Option<OsString>WAYLAND_DISPLAY: a socket name relative to xdg_runtime_dir, or an absolute path.
x11_display: Option<OsString>DISPLAY: the X11 display name.
xdg_runtime_dir: Option<OsString>XDG_RUNTIME_DIR: the directory containing Wayland sockets.
activation_token: Option<String>XDG_ACTIVATION_TOKEN: lets the first window take focus on Wayland.
A platform takes this process’s token from its environment when it’s created, and uses it if it starts windowed. Pass one here to switch to windowed mode later, for example the token of the process that asked for a window.
Implementations§
Source§impl GraphicalEnvironment
impl GraphicalEnvironment
Sourcepub fn detect() -> GraphicalEnvironment
pub fn detect() -> GraphicalEnvironment
Reads the display variables from this process’s environment.
This only reads environment variables: whether they name a reachable display server is
checked when a platform connects. Leaves activation_token unset: see its documentation.
Sourcepub fn apply_to(&self, command: &mut Command)
pub fn apply_to(&self, command: &mut Command)
Sets this environment’s display variables on command, and removes the ones it doesn’t
set, so the program connects to this graphical session rather than the one this process
started in. Leaves XDG_ACTIVATION_TOKEN alone.
Sourcepub fn guess_compositor(&self) -> &'static str
pub fn guess_compositor(&self) -> &'static str
Returns the compositor this environment selects: Wayland, then X11, then headless.
Does not attempt to connect to the compositor.
Trait Implementations§
Source§impl Clone for GraphicalEnvironment
impl Clone for GraphicalEnvironment
Source§fn clone(&self) -> GraphicalEnvironment
fn clone(&self) -> GraphicalEnvironment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphicalEnvironment
impl Debug for GraphicalEnvironment
Source§impl Default for GraphicalEnvironment
impl Default for GraphicalEnvironment
Source§fn default() -> GraphicalEnvironment
fn default() -> GraphicalEnvironment
Auto Trait Implementations§
impl Freeze for GraphicalEnvironment
impl RefUnwindSafe for GraphicalEnvironment
impl Send for GraphicalEnvironment
impl Sync for GraphicalEnvironment
impl Unpin for GraphicalEnvironment
impl UnsafeUnpin for GraphicalEnvironment
impl UnwindSafe for GraphicalEnvironment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().