[][src]Module rustofi::window

raw representation of a rofi command, use this to create new components, or your own from-scratch apps A Window is the closest to an actual binding of a rofi command as is feasible. The types and functions here allow you to construct a rofi of any size or type anywhere on the screen with ease and even allows the construction of rofi's beyond that with the additional_args field.

Example

// examples/simple_window.rs
use rustofi::window::*;

fn fizzbuzz() -> Vec<String> {
    let mut results = Vec::new();
    // print fizzbuzz as a rofi!
    for x in 1..25 {
        // divisible by 3 or by 5
        match (x % 3 == 0, x % 5 == 0) {
            (false, false) => results.push(x.to_string()), // neither
            (false, true) => results.push("Fizz".to_string()), // divisible by 5
            (true, false) => results.push("Buzz".to_string()), // divisible by 3
            (true, true) => results.push("FizzBuzz".to_string()), // divisible by both
        }
    }
    results
}

fn main() {
    // create a window with 8 lines and a vector of strings and show it
    Window::new("FizzBuzz in Rofi!").lines(8).show(fizzbuzz());
}

Structs

Dimensions

represents the "dimensions" of the rofi window

Padding

represents the padding given to the rofi window on the X and Y axis

Window

represents the raw 'window' that rofi shows the Window can be customized to change the appearance of the shown window note that some fields will be overwritten by types in components.rs and lib.rs

Enums

Location

Each variant positions the rofi window at the described position on screen

ReturnFormat

type of entry that rofi will return, typically we want the raw string using StringReturn