[][src]Struct penrose::contrib::extensions::DMenu

pub struct DMenu { /* fields omitted */ }

A wrapper around the suckless dmenu program for creating dynamic menus in penrose.

Implementations

impl DMenu[src]

pub fn new(
    prompt: impl Into<String>,
    choices: Vec<impl Into<String>>,
    config: DMenuConfig
) -> Self
[src]

Create a new DMenu command which can be triggered and re-used by calling the run method

pub fn run(&self, screen_index: usize) -> Result<MenuMatch>[src]

Run this DMenu command and return the selected choice.

Example

let lines = vec!["some", "choices", "to", "pick", "from"];
let menu = DMenu::new(">>>", lines, DMenuConfig::default());

let screen_index = manager.active_screen_index();

match menu.run(screen_index)? {
    MenuMatch::Line(i, s) => println!("matched '{}' on line '{}'", s, i),
    MenuMatch::UserInput(s) => println!("user input: '{}'", s),
    MenuMatch::NoMatch => println!("no match"),
}

Trait Implementations

impl Clone for DMenu[src]

impl Debug for DMenu[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.