From 8e6ce6b4b188fed07914fdce6f17305eea3b7a0f Mon Sep 17 00:00:00 2001 From: Ja-sonYun Date: Wed, 14 Feb 2024 11:26:18 +0900 Subject: [PATCH] support modifying tmux display-menu border style --- examples/menu.yaml | 1 + src/tmux/mod.rs | 4 ++++ src/tmux/subcommand/display_menu.rs | 1 + src/tmux/subcommand/display_popup.rs | 4 ---- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/examples/menu.yaml b/examples/menu.yaml index 33c60b0..6768e01 100644 --- a/examples/menu.yaml +++ b/examples/menu.yaml @@ -40,6 +40,7 @@ # h: ... title: " menu " +border: "simple" items: - NoDim: diff --git a/src/tmux/mod.rs b/src/tmux/mod.rs index 1979844..95e2455 100644 --- a/src/tmux/mod.rs +++ b/src/tmux/mod.rs @@ -21,6 +21,10 @@ impl Tmux { spawn_binary(self.binary.clone(), arguments, non_block) } + fn construct_border_arguments(border: &str) -> Vec { + vec!["-b".to_string(), border.to_string()] + } + fn construct_position_arguments(position: &Position) -> Vec { if let (Some(w), Some(h)) = (position.w.clone(), position.h.clone()) { vec![ diff --git a/src/tmux/subcommand/display_menu.rs b/src/tmux/subcommand/display_menu.rs index 73f30ca..cd928f6 100644 --- a/src/tmux/subcommand/display_menu.rs +++ b/src/tmux/subcommand/display_menu.rs @@ -47,6 +47,7 @@ impl Tmux { } arguments.append(&mut Self::construct_title_arguments(&menu.title)); arguments.append(&mut Self::construct_position_arguments(&menu.position)); + arguments.append(&mut Self::construct_border_arguments(&menu.border)); arguments.push("".to_string()); // We have to add seperator here before menu items arguments.append(&mut Self::construct_menu_arguments( &menu.items, diff --git a/src/tmux/subcommand/display_popup.rs b/src/tmux/subcommand/display_popup.rs index 8e9f201..58812ce 100644 --- a/src/tmux/subcommand/display_popup.rs +++ b/src/tmux/subcommand/display_popup.rs @@ -7,10 +7,6 @@ use anyhow::Result; static DISPLAY_POPUP: &str = "display-popup"; impl Tmux { - fn construct_border_arguments(border: &str) -> Vec { - vec!["-b".to_string(), border.to_string()] - } - pub fn display_popup( &self, command: String,