Skip to main content

Workspace

Struct Workspace 

Source
pub struct Workspace(/* private fields */);
Expand description

pointer of workspace

Implementations§

Source§

impl Workspace

Source

pub unsafe fn new(search_all_user: bool) -> Self

Automatically create a workspace pointer with default offset (might be wrong!) and automatically detected kwin_wayland (may also wrong!). Use for test and demo only.

SAFETY: Ensure the WORKSPACE_OFFSET is correct.

require root permissions to calculate the workspace’s offset. If the root permission is provided by

Source

pub fn get(pid: KWinPid, workspace_offset: usize) -> Self

get workspace from kwin_wayland, the pid should met kwin_wayland’s pid, otherwise I cannot tell what happens. since it relys on reading “/proc/{pid}/maps”, root access might be needed.

It will use an offset that calculated in compile-time, if runtime detect is needed, using get_with_readelf instead (executablereadelf should in enviroment $PATH)

require root permissions to calculate the workspace’s offset.

Source

pub fn get_offset_with_readelf(readelf: &str, path_to_libkwin: &str) -> usize

using readelf to detect the true offset in path_to_libkwin.so.

By default, param readelf could be str "readelf" since the executable readelf often in $PATH. And set path_to_libkwin to "/usr/lib/libkwin.so" suits most of the cases.

Source

pub fn get_mouse(&self) -> Mouse

get mouse_pos offset from pointer of workspace.

Due to unsafety of KWinPid, this function is actually unsafe. Caller should ensure the pid is still valid.

Trait Implementations§

Source§

impl Eq for Workspace

Source§

impl PartialEq for Workspace

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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 StructuralPartialEq for Workspace

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> 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, 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.