Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Created January 29, 2025 23:13
Show Gist options
  • Save ormaaj/00e9983192e28315d346c028542a89f8 to your computer and use it in GitHub Desktop.
Save ormaaj/00e9983192e28315d346c028542a89f8 to your computer and use it in GitHub Desktop.
tmux panes
%hidden trace='strace -DDYYyqqqf'
%hidden el=/usr/bin/execlineb
%hidden bashargs='-sipo vi +o posix +o histexpand -O lastpipe -O extglob -O expand_aliases +O array_expand_once +O sourcepath'
%hidden kshargs='-sipo vi -o posix'
%hidden shexec='import os, os.path, sys, pwd; \
os.sched_setscheduler(0, os.SCHED_OTHER, os.sched_param(0)); \
os.nice(-os.getpriority(os.PRIO_PROCESS, 0)); \
os.environ.setdefault("TMPDIR", "/tmp"); \
os.environ.setdefault("BASH_COMPAT", "51"); \
p = { k: str(v) for k, v in zip(("USER", None, "UID", "GID", None, "HOME", "SHELL"), pwd.getpwuid(os.geteuid())) if k }; \
os.execve(p["SHELL"], (lambda sh: [sh, *(sh == "bash" and sys.argv[1:] or [])])(os.path.basename(os.path.realpath(p["SHELL"]))), { **os.environ, **p })'
set -g default-shell $el
set -g default-command "bash $bashargs"
run-shell -C "bind -T prefix c new-window -- python -c \$shexec $bashargs"
run-shell -C "bind -T prefix '\"' split-window -v -- python -c \$shexec $bashargs"
run-shell -C "bind -T prefix % split-window -h -- python -c \$shexec $bashargs"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment