Expand description
This crate provides raw FFI bindings to Rofi’s C plugin interface,
manually written from the headers in /usr/include/rofi
.
See the examples folder for examples on how to use this crate.
These bindings are raw, unsafe
and very low-level
so if you just want to write a Rofi plugin
you’ll probably want an easier-to-use library instead,
such as rofi-mode.
Set RUSTFLAGS="--cfg rofi_next"
when building
to change the API to use unreleased Rofi features
(as of 2025-01-08).
Items only available when this is turned on will be marked
“Semver-exempt and only available with cfg(rofi_next)
.”
in the documentation.
Re-exports§
Modules§
- helper
- Helper utilities.
- icon_
fetcher - Small helper to fetch icons. This makes use of the ‘view’ threadpool.
- menu
- States returned by the rofi window.
- view
- Functions related to Rofi’s menu view.
Structs§
- GModule
- An opaque C type from GLib.
- Mode
- Structure defining a switcher.
- Mode
Type - Indicator what type of mode this is. For now it can be the classic switcher, or also implement a completer.
- Property
- Property structure.
- Property
Link - Rofi
Distance - Rofi
Distance Unit - Rofi
Highlight Color Style - Theme highlight.
- Rofi
Highlight Style - Style of text highlight.
- Rofi
Image - Rofi
IntMatcher - Internal structure for matching.
- Rofi
Padding - Rofi
Range Pair - Structure to hold a range.
- Theme
Color - Represents the color in a theme.
- Theme
Media - Theme media description.
- Theme
Widget - Theme widget.
- Thread
State - Structure with data to process by each worker thread.
- Window
Location - Bitflags indicating location or gravity of window.
Enums§
- Property
Type - The type of a property.
- Rofi
Cursor Type - Cursor type.
- Rofi
Direction - Rofi
Distance Modifier - Rofi
Image Type - Theme image
- Rofi
Line Style - Style of line.
- Rofi
Orientation - Type of orientation.
- Rofi
Pixel Unit - Distance unit type.
- Rofi
Scale Type - Theme
Media Type - Describes the media constraint type.
Constants§
- ABI_
VERSION - ABI version to check if loaded plugin is compatible.
- EXIT
- Mode to exit Rofi.
- NEXT_
DIALOG - Mode to skip to the next cycle-able dialog.
- PREVIOUS_
DIALOG - Mode to go to the previous dialog.
- RELOAD_
DIALOG - Mode to reload current dialog.
- RESET_
DIALOG - Mode to reload the dialog and unset user input.
Statics§
- Protype
Type ⚠Name - This array maps
PropertyType
to a user-readable name. - tpool⚠
Functions§
- mode_
completer_ ⚠result - Acts on the user interaction. Returns the next mode state.
- mode_
create ⚠ - Returns a new instance of the mode.
- mode_
destroy ⚠ - Destroy the mode.
- mode_
free ⚠ - Free the resources allocated for this mode.
- mode_
get_ ⚠completion - Get a string that can be used for completion. It should have no markup.
- mode_
get_ ⚠display_ name - Get the name of the mode as it should be presented to the user.
- mode_
get_ ⚠display_ value - Returns the string as it should be displayed for the entry and the state of how it should be displayed.
- mode_
get_ ⚠icon - Returns the icon for the selected line.
- mode_
get_ ⚠message - Query the mode for a user display.
- mode_
get_ ⚠name - Get the name of the mode.
- mode_
get_ ⚠num_ entries - Get the number of entries in the mode.
- mode_
get_ ⚠private_ data - A helper function for modes: get the private data object.
- mode_
init ⚠ - Initialize a mode.
- mode_
is_ ⚠completer - Check if a mode is a valid completer.
- mode_
preprocess_ ⚠input - Process the input so it can be used for matching and sorting. This includes removing Pango markup.
- mode_
result ⚠ - Acts on the user interaction.
- mode_
set_ ⚠config - Adds the display-name configuration option for the mode. Should be called once for each mode.
- mode_
set_ ⚠private_ data - A helper function for modes: set the private data object.
- mode_
token_ ⚠match - Match entry against the set of tokens.
Type Aliases§
- Config
Entry - Mode
Completer Result - Handle the user accepting an entry in completion mode. Returns the next action to take.
- Mode
Create - Create a new instance of this mode.
Free (free) result after use, after using
mode_destroy
. - Mode
Destroy - Destroy the current mode. Still ready to restart.
- Mode
Free - Free the switcher.
- Mode
GetCompletion - Obtains the string to complete.
- Mode
GetDisplay Value - Get the string to display for the entry.
- Mode
GetIcon - Obtains the icon of the entry if available.
- Mode
GetMessage - Message to show in the message bar.
- Mode
GetNum Entries - Get the number of entries to display (unfiltered).
- Mode
Init - Initialize the Mode.
- Mode
Preprocess Input - Preprocess the input for sorting.
- Mode
Result - Process the result of the user selection.
- Mode
Token Match - Token match for the matching algorithm.