pub struct Workspace(/* private fields */);Expand description
pointer of workspace
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub unsafe fn new(search_all_user: bool) -> Self
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
Sourcepub fn get(pid: KWinPid, workspace_offset: usize) -> Self
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.
Sourcepub fn get_offset_with_readelf(readelf: &str, path_to_libkwin: &str) -> usize
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.