tmux-easy-menu v0.1.9
Easy configurable tmux display-menu

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 "tmux-menu show --menu $HOME/tmux-menu/examples/menu.yaml --workingdir #{panecurrent_path}"
^~~ Or add binary to your path
=============================
#
title: "..."
border: "rounded" # Optional
position:
x: ...
y: ...
#
items:
- Seperate: {} # Draw seperate line
#
- NoDim: # Add row, but unselectable
name: "..."
#
- Menu: # Add selectable row
name: "..."
shortcut: "..." # Optional
------------------
#
next_menu: "..." # Show this menu if it selected
#
... OR
#
command: "command %%KEY%% --cwd %%PWD" # Or run command, %%PWD will replaced with cwd
background: false
closeaftercommand: true
border: none # Select popup border type, optional
session: false # Run commmand in new session. Usefull for long running command.
session_name: name # Session name, which will be used if session is true. This must be unique.
inputs:
- KEY # This input will be replaced with '%%KEY%%' on command
position:
x: ...
y: ...
w: ...
h: ...
```
Dynamic menu
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
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
```