Crate rofi_plugin_sys

Source
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§

pub use cairo_sys;
pub use glib_sys;

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.
ModeType
Indicator what type of mode this is. For now it can be the classic switcher, or also implement a completer.
Property
Property structure.
PropertyLink
RofiDistance
RofiDistanceUnit
RofiHighlightColorStyle
Theme highlight.
RofiHighlightStyle
Style of text highlight.
RofiImage
RofiIntMatcher
Internal structure for matching.
RofiPadding
RofiRangePair
Structure to hold a range.
ThemeColor
Represents the color in a theme.
ThemeMedia
Theme media description.
ThemeWidget
Theme widget.
ThreadState
Structure with data to process by each worker thread.
WindowLocation
Bitflags indicating location or gravity of window.

Enums§

PropertyType
The type of a property.
RofiCursorType
Cursor type.
RofiDirection
RofiDistanceModifier
RofiImageType
Theme image
RofiLineStyle
Style of line.
RofiOrientation
Type of orientation.
RofiPixelUnit
Distance unit type.
RofiScaleType
ThemeMediaType
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§

ProtypeTypeName
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§

ConfigEntry
ModeCompleterResult
Handle the user accepting an entry in completion mode. Returns the next action to take.
ModeCreate
Create a new instance of this mode. Free (free) result after use, after using mode_destroy.
ModeDestroy
Destroy the current mode. Still ready to restart.
ModeFree
Free the switcher.
ModeGetCompletion
Obtains the string to complete.
ModeGetDisplayValue
Get the string to display for the entry.
ModeGetIcon
Obtains the icon of the entry if available.
ModeGetMessage
Message to show in the message bar.
ModeGetNumEntries
Get the number of entries to display (unfiltered).
ModeInit
Initialize the Mode.
ModePreprocessInput
Preprocess the input for sorting.
ModeResult
Process the result of the user selection.
ModeTokenMatch
Token match for the matching algorithm.

Unions§

PropertyValue