pub struct Api<'rofi> { /* private fields */ }Expand description
The Rofi API, controlled by a lifetime to be only accessible while Rofi is running.
Implementations§
Source§impl Api<'_>
impl Api<'_>
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Sourcepub fn take_display_name(&mut self) -> Option<String>
pub fn take_display_name(&mut self) -> Option<String>
Sourcepub fn replace_display_name(&mut self, display_name: String) -> Option<String>
pub fn replace_display_name(&mut self, display_name: String) -> Option<String>
Replace the current display name, returning the previous one.
Returns None if there was no previous display name.
Sourcepub fn set_display_name<T: Display>(&mut self, display_name: T)
pub fn set_display_name<T: Display>(&mut self, display_name: T)
Set the display name of the current mode.
§Panics
Panics if the given string contains any interior nul bytes.
Sourcepub fn supports_image<P: AsRef<Path>>(&self, path: P) -> bool
pub fn supports_image<P: AsRef<Path>>(&self, path: P) -> bool
Check whether the given file path is an image in one of Rofi’s supported formats, by looking at its file extension.
Sourcepub fn query_icon(&mut self, name: &str, size: u32) -> IconRequest
pub fn query_icon(&mut self, name: &str, size: u32) -> IconRequest
Query the icon theme for an icon with a specific name and size.
name can also be a full path.
§Panics
Panics if name contains interior nul bytes.
Sourcepub fn query_icon_cstr(&mut self, name: &CStr, size: u32) -> IconRequest
pub fn query_icon_cstr(&mut self, name: &CStr, size: u32) -> IconRequest
Query the icon theme for an icon with a specific name and size.
name can also be a full path.
Sourcepub fn query_icon_wh(
&mut self,
name: &str,
width: u32,
height: u32,
) -> IconRequest
pub fn query_icon_wh( &mut self, name: &str, width: u32, height: u32, ) -> IconRequest
Query the icon theme for an icon with a specific name and size.
name can also be a full path.
§Panics
Panics if name contains interior nul bytes.
Sourcepub fn query_icon_wh_cstr(
&mut self,
name: &CStr,
width: u32,
height: u32,
) -> IconRequest
pub fn query_icon_wh_cstr( &mut self, name: &CStr, width: u32, height: u32, ) -> IconRequest
Query the icon theme for an icon with a specific name and size.
name can also be a full path.
Sourcepub fn retrieve_icon(
&mut self,
request: IconRequest,
) -> Result<Surface, IconError>
pub fn retrieve_icon( &mut self, request: IconRequest, ) -> Result<Surface, IconError>
Finalize an icon request and retrieve the inner icon.
The returned icon will be the best match for the requested size, but you may need to resize it to desired size.
It may be ergonomically preferable to use IconRequest::wait instead of this function.
§Errors
Errors if the icon was not found, or an error occurred inside the returned Cairo surface.