Skip to main content

Connector

Struct Connector 

Source
pub struct Connector(pub u64);
Expand description

A connector that is potentially connected to an output device.

A connector is the part that sticks out of your graphics card. A graphics card usually has many connectors but one few of them are actually connected to a monitor.

Tuple Fields§

§0: u64

Implementations§

Source§

impl Connector

Source

pub fn exists(self) -> bool

Returns whether this connector existed at the time get_connector was called.

This only implies existence at the time get_connector was called. Even if this function returns true, the connector might since have disappeared.

Source

pub fn connected(self) -> bool

Returns whether the connector is connected to an output device.

Source

pub fn scale(self) -> f64

Returns the scale of the currently connected monitor.

Source

pub fn set_scale(self, scale: f64)

Sets the scale to use for the currently connected monitor.

Source

pub fn ty(self) -> ConnectorType

Returns the connector type.

Source

pub fn mode(self) -> Mode

Returns the current mode of the connector.

Source

pub fn set_mode(self, width: i32, height: i32, refresh_millihz: Option<u32>)

Tries to set the mode of the connector.

If the refresh rate is not specified, tries to use the first mode with the given width and height.

The default mode is the first mode advertised by the connector. This is usually the native mode.

Source

pub fn modes(self) -> Vec<Mode>

Returns the available modes of the connector.

Source

pub fn width(self) -> i32

Returns the logical width of the connector.

The returned value will be different from mode().width() if the scale is not 1.

Source

pub fn height(self) -> i32

Returns the logical height of the connector.

The returned value will be different from mode().height() if the scale is not 1.

Source

pub fn refresh_rate(self) -> u32

Returns the refresh rate in mhz of the current mode of the connector.

This is a shortcut for mode().refresh_rate().

Source

pub fn position(self) -> (i32, i32)

Retrieves the position of the output in the global compositor space.

Source

pub fn set_position(self, x: i32, y: i32)

Sets the position of the connector in the global compositor space.

x and y must be non-negative and must not exceed a currently unspecified limit. Any reasonable values for x and y should work.

This function allows the connector to overlap with other connectors, however, such configurations are not supported and might result in unexpected behavior.

Source

pub fn set_enabled(self, enabled: bool)

Enables or disables the connector.

By default, all connectors are enabled.

Source

pub fn set_transform(self, transform: Transform)

Sets the transformation to apply to the content of this connector.

Source

pub fn name(self) -> String

Source

pub fn model(self) -> String

Source

pub fn manufacturer(self) -> String

Source

pub fn serial_number(self) -> String

Source

pub fn set_vrr_mode(self, mode: VrrMode)

Sets the VRR mode.

Source

pub fn set_vrr_cursor_hz(self, hz: f64)

Sets the VRR cursor refresh rate.

Limits the rate at which cursors are updated on screen when VRR is active.

Setting this to infinity disables the limiter.

Source

pub fn set_tearing_mode(self, mode: TearingMode)

Sets the tearing mode.

Source

pub fn set_format(self, format: Format)

Sets the format to use for framebuffers.

Source

pub fn set_colors(self, color_space: ColorSpace, eotf: Eotf)

Sets the color space and EOTF of the connector.

By default, the default values are used which usually means sRGB color space with gamma22 EOTF.

If the output supports it, HDR10 can be enabled by setting the color space to BT.2020 and the EOTF to PQ.

Note that some displays might ignore incompatible settings.

Source

pub fn set_blend_space(self, blend_space: BlendSpace)

Sets the space in which blending is performed for this output.

The default is BlendSpace::SRGB

Source

pub fn set_brightness(self, brightness: Option<f64>)

Sets the brightness of the output.

By default or when brightness is None, the brightness depends on the EOTF:

This should only be used with the PQ transfer function. If the default transfer function is used, you should instead calibrate the hardware directly.

When used with the default transfer function, the default brightness is anchored at 80 cd/m^2. That is, setting this to 40 cd/m^2 makes everything appear half as bright as normal and creates 50% HDR headroom.

This has no effect unless the vulkan renderer is used.

Source

pub fn active_workspace(self) -> Workspace

Get the currently visible/active workspace.

If this connector is not connected, or is there no active workspace, returns a workspace whose exists() returns false.

Source

pub fn workspaces(self) -> Vec<Workspace>

Get all workspaces on this connector.

If this connector is not connected, returns an empty list.

Source

pub fn connector_in_direction(self, direction: Direction) -> Connector

Find the closest connector in the given direction.

Uses center-to-center distance calculation and prefers outputs better aligned with the movement axis.

If no connector exists in the given direction, returns a connector whose exists() returns false.

Source

pub fn set_use_native_gamut(self, use_native_gamut: bool)

Configures whether the display primaries are used.

By default, Jay pretends that the display uses sRGB primaries. This is also how most other systems behave. In reality, most displays use a much larger gamut. For example, they advertise that they support 95% of the DCI-P3 gamut. If the display is interpreting colors in their native gamut, then colors will appear more saturated than their specification.

If this is set to true, Jay assumes that the display uses the primaries advertised in its EDID. This might produce more accurate colors while also allowing color-managed applications to use the full gamut of the display.

This setting has no effect when the display is explicitly operating in a wide color space.

The default is false.

Trait Implementations§

Source§

impl Clone for Connector

Source§

fn clone(&self) -> Connector

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Connector

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Connector

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for Connector

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Connector

Source§

fn eq(&self, other: &Connector) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Connector

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for Connector

Source§

impl Eq for Connector

Source§

impl StructuralPartialEq for Connector

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,