Skip to content

Commit dd9e2cf

Browse files
committed
Add support for bemenu
1 parent b222a86 commit dd9e2cf

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
| [Fuzzel](https://codeberg.org/dnkl/fuzzel) ||| XDG icons supported since v1.13.0 |
4545
| [Rofi](https://github.com/davatorium/rofi) || 🔄 | XDG icon support pending via [PR #2122](https://github.com/davatorium/rofi/pull/2122) |
4646
| [dmenu](https://tools.suckless.org/dmenu) ||| No XDG icon support |
47+
| [bemenu](https://github.com/Cloudef/bemenu)||| No XDG icon support |
4748
| Custom (stdin) ||| Depends on launcher implementation |
4849

4950
> [!TIP]
@@ -146,14 +147,14 @@ bzmenu -l custom --launcher-command "fuzzel -d --placeholder '{hint}'"
146147

147148
### Available Options
148149

149-
| Flag | Description | Supported Values | Default Value |
150-
| -------------------- | --------------------------------------------------------- | ----------------------------------- | ------------- |
151-
| `-l`, `--launcher` | Specify the launcher to use (**required**). | `dmenu`, `rofi`, `fuzzel`, `custom` | `None` |
152-
| `--launcher-command` | Specify the command to use when `custom` launcher is set. | Any valid shell command | `None` |
153-
| `-i`, `--icon` | Specify the icon type to use. | `font`, `xdg` | `font` |
154-
| `-s`, `--spaces` | Specify icon to text space count (font icons only). | Any positive integer | `1` |
155-
| `--scan-duration` | Specify the duration of device discovery in seconds. | Any positive integer | `10` |
156-
| `--back-on-escape` | Return to previous menu on escape. | N/A | `false` |
150+
| Flag | Description | Supported Values | Default Value |
151+
| -------------------- | --------------------------------------------------------- | --------------------------------------------- | ------------- |
152+
| `-l`, `--launcher` | Specify the launcher to use (**required**). | `dmenu`, `rofi`, `fuzzel`, `bemenu`, `custom` | `None` |
153+
| `--launcher-command` | Specify the command to use when `custom` launcher is set. | Any valid shell command | `None` |
154+
| `-i`, `--icon` | Specify the icon type to use. | `font`, `xdg` | `font` |
155+
| `-s`, `--spaces` | Specify icon to text space count (font icons only). | Any positive integer | `1` |
156+
| `--scan-duration` | Specify the duration of device discovery in seconds. | Any positive integer | `10` |
157+
| `--back-on-escape` | Return to previous menu on escape. | N/A | `false` |
157158

158159
## Contributing
159160

src/launcher.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub enum LauncherType {
2222
Fuzzel,
2323
Rofi,
2424
Dmenu,
25+
Bemenu,
2526
Custom,
2627
}
2728

@@ -38,6 +39,9 @@ pub enum LauncherCommand {
3839
Dmenu {
3940
prompt: Option<String>,
4041
},
42+
Bemenu {
43+
prompt: Option<String>,
44+
},
4145
Custom {
4246
program: String,
4347
args: Vec<String>,
@@ -88,6 +92,13 @@ impl Launcher {
8892
}
8993
cmd
9094
}
95+
LauncherCommand::Bemenu { prompt } => {
96+
let mut cmd = Command::new("bemenu");
97+
if let Some(hint_text) = prompt {
98+
cmd.arg("-p").arg(format!("{hint_text}: "));
99+
}
100+
cmd
101+
}
91102
LauncherCommand::Custom { program, args } => {
92103
let mut cmd = Command::new(&program);
93104
cmd.args(&args);
@@ -195,6 +206,7 @@ impl Launcher {
195206
placeholder: hint_text,
196207
}),
197208
LauncherType::Dmenu => Ok(LauncherCommand::Dmenu { prompt: hint_text }),
209+
LauncherType::Bemenu => Ok(LauncherCommand::Bemenu { prompt: hint_text }),
198210
LauncherType::Custom => {
199211
if let Some(cmd) = command_str {
200212
let processed_cmd = Self::substitute_placeholders(cmd, hint)?;

0 commit comments

Comments
 (0)