pub struct DMenu { /* private fields */ }Expand description
A wrapper around the suckless dmenu program for creating dynamic menus in penrose.
Implementations§
Source§impl DMenu
impl DMenu
Sourcepub fn new(config: &DMenuConfig, screen_index: usize) -> Self
pub fn new(config: &DMenuConfig, screen_index: usize) -> Self
Create a new DMenu command which can be triggered and reused by calling
the run method for a basic dmenu prompt, or the build_menu
for more advanced selection menus.
Sourcepub fn run(&self) -> Result<()>
pub fn run(&self) -> Result<()>
Used for launching regular old DMenu with no menu matching
via the dmenu_run wrapper script.
Run this DMenu command and return the selected choice.
§Example
let screen_index = 0;
let dmenu = DMenu::new(&DMenuConfig::default(), screen_index);
let choices = vec!["some", "choices", "to", "pick", "from"];
match dmenu.build_menu(choices).unwrap() {
MenuMatch::Line(i, s) => println!("matched '{}' on line '{}'", s, i),
MenuMatch::UserInput(s) => println!("user input: '{}'", s),
MenuMatch::NoMatch => println!("no match"),
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for DMenu
impl RefUnwindSafe for DMenu
impl Send for DMenu
impl Sync for DMenu
impl Unpin for DMenu
impl UnsafeUnpin for DMenu
impl UnwindSafe for DMenu
Blanket Implementations§
impl<T> Any for Twhere
T: Any,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more