0

I'm trying to use shelljs to write a script that'll help load up my local env at once while setting up my tmux panes/windows... but I don't know how to represent the Ctrl button in the command.

Help? :-|

example of what I thought would work: shell.exec('Control+b z');

Brian Zhou
  • 574
  • 6
  • 15

1 Answers1

0

Solution with keyboard shortcuts is probably not possible (not to my knowledge).

But that's the part where tmux command takes part.

For example in my setup I want to open two side panels along with main pane.

I'm using following with Guake terminal:

// Rename tab to current path
shell.exec(`guake --rename-current-tab=${path} &`);
// Open new horizontal pane
shell.exec('tmux split-window -h');
// Open new vertical pane under pane that was created above
shell.exec('tmux split-window -v');

Here you can find a cheatsheet for tmux commands: https://gist.github.com/MohamedAlaa/2961058

michalhonc
  • 101
  • 1
  • 3
  • oh nice. I *think* that could work. Do you have any suggestions on how I can inject commands into each respective window? I guess I'd have to look at the other tmux commands. – Brian Zhou Feb 25 '19 at 05:06
  • I set up such thing only with basic .sh script (haven't tried to do it with shelljs yet). `tmux split-window -h -c "#{pane_current_path}" \; send-keys "npm run build" Enter &` But it should work with shelljs – michalhonc Feb 27 '19 at 06:10