Hi!
I am trying to figure out a solution for creating a menu, with (in theory) 
indefinite amount of nested items, but it logically fails to work in a 
single command

The moment i realized, that you can feed keystrokes into the terminal and 
there is a relatively simple way of creating menus, i immediately thought 
of binding a set of frequently used commands to a menu items, which has 
proven to be decently comfortable doing routine operations.

Consequently, the list of commands (or mostly just set of keys and control 
characters) has been growing, and it became obvious, that it will be much 
easier to distribute commands by their logical "belonging" (like for 
database or logs scraping) to its own menu item, where each of them will be 
opening "next menu". First approach was to create a set of bash scripts, 
where each of them will create menu, while items of a "first menu" only 
calling those scripts. Recently, it started to be quite exhausting to edit 
or add new items, which inspired me to write a script, which will compose a 
single command, based on the file (with its own syntax), where each menu 
item described.

Turns out, that a single tmux display-menu command is reasonably limited.
First layer is quite easy to accomplish, but specifying a display-menu as 
one of the commands of a menu item require to pass all further arguments in 
a single string.
For example:
display-menu 'first layer' none 'display-menu "second layer" none 
"send-keys \"some keys\""'
Second layer already causes some complications for certain characters to be 
sent in "send-keys", but it can be bypassed using something that i 
certainly do not have name for: "escaping out of the main string" - "\'" 
\\special_char "\'"
Escaping a single quote inside of the double quotes in order to tell tmux 
to treat this quote not as the end of send-keys string is already too much, 
but works!

Is there a way to query a tmux to create a menu with more than two levels 
deep? Third level in a single command would be a string, that is already in 
a string of an outer menu, where a whole send-keys needs to be quoted, 
while keys to be sent is also needs to be separately quoted. I am sure 
there is a deeply undocumented ways of doing something like that, and it 
probably can be put in a for loop with 0 readability, but would be glad to 
hear, if there are any plans for improving menus functionality. Or any 
other ways of implementing nested menu items using only tmux, without any 
external code to create them

-- 
You received this message because you are subscribed to the Google Groups 
"tmux-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tmux-users+unsubscr...@googlegroups.com.
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/tmux-users/b1240c78-93ef-4d78-bdf1-cb5a4f30049bn%40googlegroups.com.

Reply via email to