Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
| [Fuzzel](https://codeberg.org/dnkl/fuzzel) | ✅ | ✅ | XDG icons supported since v1.13.0 |
| [Rofi](https://github.com/davatorium/rofi) | ✅ | 🔄 | XDG icon support pending via [PR #2122](https://github.com/davatorium/rofi/pull/2122) |
| [dmenu](https://tools.suckless.org/dmenu) | ✅ | ❌ | No XDG icon support |
| [bemenu](https://github.com/Cloudef/bemenu)| ✅ | ❌ | No XDG icon support |
| Custom (stdin) | ✅ | ❔ | Depends on launcher implementation |

> [!TIP]
Expand Down Expand Up @@ -162,13 +163,13 @@ iwmenu -l custom --launcher-command "fuzzel -d --placeholder '{hint}' {password_

### Available Options

| Flag | Description | Supported Values | Default Value |
| -------------------- | --------------------------------------------------------- | ----------------------------------- | ------------- |
| `-l`, `--launcher` | Specify the launcher to use (**required**). | `dmenu`, `rofi`, `fuzzel`, `custom` | `None` |
| `--launcher-command` | Specify the command to use when `custom` launcher is set. | Any valid shell command | `None` |
| `-i`, `--icon` | Specify the icon type to use. | `font`, `xdg` | `font` |
| `-s`, `--spaces` | Specify icon to text space count (font icons only). | Any positive integer | `1` |
| `--back-on-escape` | Return to previous menu on escape. | N/A | `false` |
| Flag | Description | Supported Values | Default Value |
| -------------------- | --------------------------------------------------------- | --------------------------------------------- | ------------- |
| `-l`, `--launcher` | Specify the launcher to use (**required**). | `dmenu`, `rofi`, `fuzzel`, `bemenu`, `custom` | `None` |
| `--launcher-command` | Specify the command to use when `custom` launcher is set. | Any valid shell command | `None` |
| `-i`, `--icon` | Specify the icon type to use. | `font`, `xdg` | `font` |
| `-s`, `--spaces` | Specify icon to text space count (font icons only). | Any positive integer | `1` |
| `--back-on-escape` | Return to previous menu on escape. | N/A | `false` |

## Contributing

Expand Down
22 changes: 22 additions & 0 deletions src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub enum LauncherType {
Fuzzel,
Rofi,
Dmenu,
Bemenu,
Custom,
}

Expand All @@ -40,6 +41,10 @@ pub enum LauncherCommand {
Dmenu {
prompt: Option<String>,
},
Bemenu {
prompt: Option<String>,
password_mode: bool,
},
Custom {
program: String,
args: Vec<String>,
Expand Down Expand Up @@ -98,6 +103,19 @@ impl Launcher {
}
cmd
}
LauncherCommand::Bemenu {
prompt,
password_mode,
} => {
let mut cmd = Command::new("bemenu");
if let Some(hint_text) = prompt {
cmd.arg("-p").arg(format!("{hint_text}: "));
}
if password_mode {
cmd.arg("--password").arg("indicator");
}
cmd
}
LauncherCommand::Custom { program, args } => {
let mut cmd = Command::new(&program);
cmd.args(&args);
Expand Down Expand Up @@ -253,6 +271,10 @@ impl Launcher {
password_mode,
}),
LauncherType::Dmenu => Ok(LauncherCommand::Dmenu { prompt: hint_text }),
LauncherType::Bemenu => Ok(LauncherCommand::Bemenu {
prompt: hint_text,
password_mode,
}),
LauncherType::Custom => {
if let Some(cmd) = command_str {
let processed_cmd = Self::substitute_placeholders(cmd, hint, password_mode)?;
Expand Down