tmux-easy-menu v0.1.2

Easy configurable tmux display-menu

Alt Text

Setup

cargo install tmux-menu

Configuration

To see more actual config files, checkout ./examples folder. ```yaml

On tmux.conf, add below line.

#

bind-key k run-shell "$HOME/tmux-menu/target/debug/tmux-menu show --menu $HOME/tmux-menu/examples/menu.yaml --workingdir #{panecurrent_path}"

^~~ Or add binary to your path

=============================

#

title: "..."

#

position:

x: ...

y: ...

#

items:

- Seperate: {} # Draw seperate line

#

- NoDim: # Add row, but unselectable

name: "..."

#

- Menu: # Add selectable row

name: "..."

shortcut: "..."

------------------

#

next_menu: "..." # Show this menu if it selected

#

... OR

#

command: "command %%KEY%%" # Or run command

background: false

closeaftercommand: true

inputs:

- KEY # This input will be replaced with '%%KEY%%' on command

position:

x: ...

y: ...

w: ...

h: ...

```

Dynamic menu

Alt Text Alt Text Below example will show running brew services on display-menu, and restart it if clicked. ```bash

!/bin/bash

generatebrewservicesrestartmenu.sh

TEMPMENUFILE="/tmp/tempmenu.yaml" rm -f $TEMPMENUFILE cat > $TEMPMENU_FILE << EOM title: " brew services " items: - Seperate: {} - NoDim: name: " Running services " - NoDim: name: " (select to restart) " - Seperate: {} EOM

brew services list | while read line do program=$(echo $line | awk '{print $1}') status=$(echo $line | awk '{print $2}')

if [ "$status" == "started" ]; then
    cat >> $TEMP_MENU_FILE <<- EOM

- Menu: name: "$program" shortcut: ".." command: "brew services restart $program" background: true EOM fi done

$PATHTOBINARY/tmux-menu show --menu $TEMPMENUFILE rm -f $TEMPMENUFILE and add menu item as below yaml - Menu: name: "restart brew services" shortcut: b command: "$PATHTOSCRIPT/generatebrewservicesrestartmenu.sh" background: true ```