[dev] [st] [PATCH] multiplexer (tmux integration)

From: Amer <amerlyq_AT_gmail.com>
Date: Mon, 15 Aug 2016 02:48:24 +0300

I suppose this patch isn't mature enough, so you are welcome.

  * added -m/-M command line options to demand/ignore multiplexer
    (using only -m option to toggle defaults isn't robust enough)
  * config options to specify exec wrapper and finalizing commands
  * sessions are named after the -n option (if specified)
  ~ adaptable to other multiplexers / etc. beside tmux (not tested)

  * problems when using patch with other software (dvtm, byobu, etc)
  * other possible wrappers beside tmux (?) fitting overall idea
  * any opinion from alternative implementation till vars naming


  * killing terminal by WM cleanly kills the embedded tmux session
    => only created by the same terminal session is killed
  * detached session stays alive (terminal closes on detach)
  * attaching to the session from another terminal and closing
    former one will relocate the session without killing
    (however, now it behaves like any ordinary independent session)

  + using tmux by default or demand it explicitly by -m/-M
  + arguments after -e are used as command for tmux new-session
  + no need for additional monitoring script
    => cleaner process tree, lesser startup time
  + no need for arguable options in your ~/.tmux.conf
    => all your other tmux sessions aren't affected


## Tmux wrapper (bash only!)

$ st -e r.tmux
$ cat r.tmux
  #!/bin/bash -e
  trap "tmux list-clients -t st-$$ 2>/dev/null |
  { read -r _ && ! read -n1 -r _; } &&
  tmux kill-session -t st-$$
  tmux new-session -s st-$$ -- "$_AT_"

  + works the same way as the patch in question (see Behavior)
  + can be used even with packaged 'st' (no src hacking required)
  - related WM shortcuts must be changed to $ st -e r.tmux ...
  - creates additional process, cluttering your process tree
  - shell on exit must propagate HUP to childs and call EXIT trap
    => so it only works in bash? (dash, etc. are out of question)

## Tmux native

  set -g destroy-unattached on

  + easy (one option with support from the box)
  + no need to modify any st sources or WM shortcuts
  - works only with tmux
  - always destroys any unattached session (even on manual detach!)
  ~ useful if you use tmux for multiplexing only and rarely detach
    * you can switch option manually each time before detach
    * or bind it (with one-time-set guards) to 'pref d'
    * option can be guarded in config to be disabled for SSH
    * also for global tmux session you can use separate tmux.conf

Received on Mon Aug 15 2016 - 01:48:24 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 15 2016 - 02:00:16 CEST