Skip to content

Commit

Permalink
env: Harden running commands in tmux so failures are obvious
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Chancellor <[email protected]>
  • Loading branch information
nathanchance committed Dec 14, 2024
1 parent a786218 commit 62394fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions configs/tmux/.tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ bind-key c new-window dbxe
bind-key C new-window

# open specific distrobox container using N
bind-key N command-prompt -p "distrobox container:" "new-window 'dbxe %1'"
bind-key N command-prompt -p "distrobox container:" "new-window 'dbxe %1; or exec fish -l'"
bind-key E command-prompt -p "new ephemeral distrobox container:" "new-window 'dbxeph %1'"

# run commands in either host or distrobox
bind-key r command-prompt -p "run command (distrobox):" "new-window 'dbxe -- fish -c \"%1\"'"
bind-key R command-prompt -p "run command (host):" "new-window '%1'"
bind-key r command-prompt -p "run command (distrobox):" "new-window 'dbxe -- fish -c \"begin; %1; end; or exec fish -l\"; or exec fish -l'"
bind-key R command-prompt -p "run command (host):" "new-window 'begin; %1; end; or exec fish -l'"

# split panes using | and - (distrobox) and H and V (host)
bind-key | split-window -h dbxe
Expand Down
4 changes: 2 additions & 2 deletions python/scripts/tmxrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
if args.detach:
tmx_cmd.append('-d')

CMD_STR = ' '.join(args.args)
CMD_STR = f"begin; {' '.join(args.args)}; end; or exec fish -l"
if mode == 'container':
CMD_STR = f"dbxe -- fish -c '{CMD_STR}'"
CMD_STR = f"dbxe -- fish -c '{CMD_STR}'; or exec fish -l"
tmx_cmd.append(CMD_STR)

lib.utils.run(tmx_cmd)

0 comments on commit 62394fb

Please sign in to comment.