fix blank line in shortcuts dmenu mode
This commit is contained in:
parent
4d857b9a99
commit
80d4d72417
1 changed files with 4 additions and 5 deletions
|
|
@ -4,21 +4,20 @@ use serde_json::json;
|
|||
use crate::{
|
||||
config::ScriptConf,
|
||||
lib::{
|
||||
SDUError,
|
||||
cli::{ShortcutCommand, ShortcutMode},
|
||||
sway_ipc::{get_sway_connection, run_sway_command},
|
||||
SDUError,
|
||||
},
|
||||
};
|
||||
|
||||
fn print_shortcuts(mode: &ShortcutMode, shortcuts: Vec<ScriptConf>) -> String {
|
||||
match mode {
|
||||
ShortcutMode::Dmenu => {
|
||||
let mut dmenu_shortcuts: String = String::new();
|
||||
let mut dmenu_entries = Vec::<String>::new();
|
||||
for shortcut in shortcuts {
|
||||
dmenu_shortcuts =
|
||||
format!("{}\n{} {}", dmenu_shortcuts, shortcut.icon, shortcut.name)
|
||||
dmenu_entries.push(format!("{} {}", shortcut.icon, shortcut.name));
|
||||
}
|
||||
dmenu_shortcuts
|
||||
dmenu_entries.join("\n")
|
||||
}
|
||||
ShortcutMode::Json => json!(shortcuts).to_string(),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue