mirror of
https://github.com/tmate-io/tmate.git
synced 2026-01-23 02:24:06 +00:00
Compare commits
174 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac919516f4 | ||
|
|
6cb27ead4e | ||
|
|
15001bfa77 | ||
|
|
3efc8496cc | ||
|
|
2ff8bc134d | ||
|
|
9a1aa9ae9d | ||
|
|
17fcc8b76d | ||
|
|
7c0bbf3e16 | ||
|
|
05a849ba2b | ||
|
|
fde4b58228 | ||
|
|
17d4a8a7df | ||
|
|
ef11a7b30e | ||
|
|
577e04df6c | ||
|
|
b1079b4393 | ||
|
|
a258907cf8 | ||
|
|
169eb64b99 | ||
|
|
be4a88507e | ||
|
|
c9ec7af632 | ||
|
|
808b564564 | ||
|
|
e5ce3f04d2 | ||
|
|
8123fa34f8 | ||
|
|
f6a4ae6042 | ||
|
|
cbec43f56d | ||
|
|
339e6c4357 | ||
|
|
9e3e39d66d | ||
|
|
ba6ac3a363 | ||
|
|
46564a0311 | ||
|
|
cc01f3f13a | ||
|
|
f0a4707ef3 | ||
|
|
5e00bfa5e1 | ||
|
|
f895fe01b1 | ||
|
|
9fe8b32293 | ||
|
|
7e02dba7ef | ||
|
|
bfa3c104d7 | ||
|
|
e5f6e68fad | ||
|
|
9fc6e96444 | ||
|
|
86ec8d1ad6 | ||
|
|
2b86031308 | ||
|
|
2b14611544 | ||
|
|
d3c8808b0f | ||
|
|
8b62c54748 | ||
|
|
ba860b8f45 | ||
|
|
1600a81e58 | ||
|
|
0272757aa5 | ||
|
|
9781946a70 | ||
|
|
442143cd90 | ||
|
|
c71307ed5c | ||
|
|
fa49dc980d | ||
|
|
206c0f38b4 | ||
|
|
19341bc544 | ||
|
|
c78198dc59 | ||
|
|
c63c8fbf90 | ||
|
|
6e84bab68c | ||
|
|
7f693a97ae | ||
|
|
4efe25d91d | ||
|
|
7262aead73 | ||
|
|
7153958e99 | ||
|
|
74ff522983 | ||
|
|
44635e752d | ||
|
|
d654ff2219 | ||
|
|
3e5d919b14 | ||
|
|
4e7caeb536 | ||
|
|
e25ab3cc8b | ||
|
|
299c7c670c | ||
|
|
fd4ac27d59 | ||
|
|
32d48cbc9d | ||
|
|
b01c6ecebd | ||
|
|
b645ce15cb | ||
|
|
2ffcbbd185 | ||
|
|
72ddb7eb08 | ||
|
|
25f6a934cf | ||
|
|
3f6c6d4447 | ||
|
|
608763a41a | ||
|
|
b27f3bacc0 | ||
|
|
27169b7c07 | ||
|
|
fe81322cc4 | ||
|
|
d433fe6956 | ||
|
|
e840ff7582 | ||
|
|
c9813a8c42 | ||
|
|
46a29037d4 | ||
|
|
d41b06dea2 | ||
|
|
71d31e60e6 | ||
|
|
02694d2a96 | ||
|
|
c88870b0a3 | ||
|
|
78305a7077 | ||
|
|
1ade196fb2 | ||
|
|
9b5bb8390c | ||
|
|
b88f66192f | ||
|
|
37c71cfe15 | ||
|
|
474487c33e | ||
|
|
a7c5507464 | ||
|
|
cdfb6d7ef1 | ||
|
|
5658b628b9 | ||
|
|
b429a00cce | ||
|
|
410ccce4a3 | ||
|
|
312a7a1e62 | ||
|
|
ed598e9fe1 | ||
|
|
fa97b0a95b | ||
|
|
3dfc79fb09 | ||
|
|
cc20e826e0 | ||
|
|
9742aeaf9b | ||
|
|
0d4aaa6def | ||
|
|
87794a3adb | ||
|
|
5fc5c03dad | ||
|
|
0d6de44a37 | ||
|
|
81f78f0da7 | ||
|
|
c38e0a4bbc | ||
|
|
1f0b317088 | ||
|
|
6c35d17800 | ||
|
|
df0983af39 | ||
|
|
fa81d838da | ||
|
|
45d62482da | ||
|
|
bcb41a09b3 | ||
|
|
9e2fbb31ec | ||
|
|
985504ff2c | ||
|
|
e304673c65 | ||
|
|
b8a102d26f | ||
|
|
d980d965dd | ||
|
|
f0239a8fe9 | ||
|
|
2e4503ad4e | ||
|
|
54ea8f74ae | ||
|
|
e647eeb0c9 | ||
|
|
26945d7956 | ||
|
|
c7851e0ee7 | ||
|
|
a011b67f56 | ||
|
|
c3f93e7178 | ||
|
|
931b1c6d59 | ||
|
|
e9d369a09e | ||
|
|
6adf561507 | ||
|
|
95adc0e6ba | ||
|
|
02753ba9ea | ||
|
|
acc1090e77 | ||
|
|
fc864529f5 | ||
|
|
782dd941da | ||
|
|
ba8290aeae | ||
|
|
4f6bc0a0a9 | ||
|
|
f7c8f1ae29 | ||
|
|
ba97ae1737 | ||
|
|
7669cfb330 | ||
|
|
bc0c9c7920 | ||
|
|
07c23ccc05 | ||
|
|
2130a07b70 | ||
|
|
26f899be10 | ||
|
|
bdb8bb790e | ||
|
|
8760f877e1 | ||
|
|
97882f9ce2 | ||
|
|
5fce21728e | ||
|
|
fa64b89ad7 | ||
|
|
49e9f93738 | ||
|
|
8028560f82 | ||
|
|
225a384dbb | ||
|
|
404379049a | ||
|
|
2a1bb91bf7 | ||
|
|
a33bb3e876 | ||
|
|
8cf1504ba6 | ||
|
|
427b820426 | ||
|
|
1d6bd50343 | ||
|
|
405cd82a82 | ||
|
|
64e14eaff5 | ||
|
|
ca29dc9abc | ||
|
|
dc42c35f1f | ||
|
|
b5b5221c13 | ||
|
|
995af0e2b7 | ||
|
|
5d21faa99c | ||
|
|
c9815307eb | ||
|
|
c1846177fc | ||
|
|
506adf3764 | ||
|
|
d551ab8e5c | ||
|
|
68d797587e | ||
|
|
6dc58ab6de | ||
|
|
a2520da195 | ||
|
|
3a73f17354 | ||
|
|
ea9873e60e | ||
|
|
cfb78654c2 |
165 changed files with 2745 additions and 1765 deletions
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
github: nviennot
|
||||
41
.github/workflows/DragonflyBSD.yml
vendored
Normal file
41
.github/workflows/DragonflyBSD.yml
vendored
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
name: DragonflyBSD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/DragonflyBSD.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/DragonflyBSD.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
DragonflyBSD:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: vmactions/dragonflybsd-vm@v0
|
||||
with:
|
||||
prepare: |
|
||||
pkg install -y automake autoconf libtool pkgconf libevent msgpack libssh gsed
|
||||
usesh: true
|
||||
run: |
|
||||
gsed -i "s/OK/0/g" tty-term.c
|
||||
autoupdate
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
|
||||
40
.github/workflows/FreeBSD.yml
vendored
Normal file
40
.github/workflows/FreeBSD.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: FreeBSD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/FreeBSD.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/FreeBSD.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
FreeBSD:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: vmactions/freebsd-vm@v0
|
||||
with:
|
||||
prepare: |
|
||||
pkg install -y automake autoconf libtool pkgconf libevent msgpack libssh
|
||||
usesh: true
|
||||
run: |
|
||||
autoupdate
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
|
||||
37
.github/workflows/MacOS.yml
vendored
Normal file
37
.github/workflows/MacOS.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: MacOS
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/MacOS.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/MacOS.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
MacOS:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
brew install automake msgpack libssh
|
||||
autoupdate
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
|
||||
|
||||
40
.github/workflows/NetBSD.yml
vendored
Normal file
40
.github/workflows/NetBSD.yml
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
name: NetBSD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/NetBSD.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/NetBSD.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
NetBSD:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: vmactions/netbsd-vm@v0
|
||||
with:
|
||||
prepare: |
|
||||
pkg_add automake autoconf libtool pkgconf libevent msgpack libssh
|
||||
usesh: true
|
||||
run: |
|
||||
autoupdate
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
|
||||
50
.github/workflows/OpenBSD.yml
vendored
Normal file
50
.github/workflows/OpenBSD.yml
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: OpenBSD
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/OpenBSD.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/OpenBSD.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
OpenBSD:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: vmactions/openbsd-vm@v0
|
||||
with:
|
||||
prepare: |
|
||||
pkg_add automake-1.16.3 autoconf-2.71 libtool pkgconf libevent msgpack libssh curl
|
||||
usesh: true
|
||||
run: |
|
||||
sed -i 's,<event.h>,<event2/event.h>,' *.[ch]
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-Makefile_am | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-server_c | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-tmate-debug_c | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-tmate_h | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-tmux_c | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-tmux_h | patch
|
||||
curl https://raw.githubusercontent.com/openbsd/ports/master/sysutils/tmate/patches/patch-osdep-openbsd_c | patch
|
||||
export AUTOMAKE_VERSION=1.16
|
||||
export AUTOCONF_VERSION=2.71
|
||||
autoupdate
|
||||
./autogen.sh
|
||||
./configure
|
||||
make
|
||||
make install
|
||||
|
||||
|
||||
|
||||
37
.github/workflows/Ubuntu.yml
vendored
Normal file
37
.github/workflows/Ubuntu.yml
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: Ubuntu
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/Ubuntu.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
paths:
|
||||
- '**.c'
|
||||
- '**.h'
|
||||
- 'compat/*'
|
||||
- '.github/workflows/Ubuntu.yml'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
Ubuntu:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- run: |
|
||||
sudo apt-get install -y build-essential automake libtool libevent-dev libncurses5-dev libmsgpack-dev libssh-dev pkg-config
|
||||
autoupdate
|
||||
ACLOCAL_PATH=/usr/share/aclocal ./autogen.sh
|
||||
./configure
|
||||
make
|
||||
sudo make install
|
||||
|
||||
|
||||
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -21,3 +21,8 @@ cscope.*
|
|||
ctags
|
||||
*.log
|
||||
tmate.1.*
|
||||
downloads/
|
||||
ext/
|
||||
libssh-*/
|
||||
msgpack-*/
|
||||
releases/
|
||||
|
|
|
|||
46
.travis.yml
46
.travis.yml
|
|
@ -1,10 +1,40 @@
|
|||
language: c
|
||||
services:
|
||||
- docker
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
- compiler: clang
|
||||
env: CFLAGS="-g -O2"
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get -y install debhelper autotools-dev dh-autoreconf file libncurses5-dev libevent-dev pkg-config libutempter-dev build-essential
|
||||
script: (CFLAGS= ./autogen.sh) && ./configure --enable-debug && make
|
||||
include:
|
||||
- arch: amd64
|
||||
env: PLATFORM=amd64
|
||||
- arch: amd64
|
||||
env: PLATFORM=i386
|
||||
- arch: arm64
|
||||
env: PLATFORM=arm32v6
|
||||
- arch: arm64
|
||||
env: PLATFORM=arm32v7
|
||||
- arch: arm64
|
||||
env: PLATFORM=arm64v8
|
||||
- arch: s390x
|
||||
env: PLATFORM=s390x
|
||||
- arch: ppc64le
|
||||
env: PLATFORM=ppc64le
|
||||
|
||||
script:
|
||||
- 'docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM'
|
||||
# On arch=arm64, some directories are not setup correctly, and 'ruby -S gem
|
||||
# install dpl' required by the release push scripts fails.
|
||||
- 'if [ "$TRAVIS_TAG" ]; then sudo chown -R $USER: /var/lib/gems /usr/local/bin; fi'
|
||||
- 'if [ "$TRAVIS_TAG" ]; then ./build_static_release.sh $TRAVIS_TAG $PLATFORM; fi'
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: T2109tjjOsrVLEpJZK/uxmO0AuDGXYFdN4AAsNTmVwu/W5dcX57Kk2TCgqDuLfD21iGGXP0U/OYHM06IfBDODBWCA9P8ASHYsenS7wIiFnvCEMbfzoAFyBMrXN2kNdM2+ho3aqc0xE2lQKOKDLxpGm5FZrzujscXXzxQjWBU5Hk=
|
||||
skip_cleanup: true
|
||||
overwrite: true
|
||||
file_glob: true
|
||||
file: releases/*.tar.*
|
||||
on:
|
||||
repo: tmate-io/tmate
|
||||
branch: master
|
||||
tags: true
|
||||
|
|
|
|||
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
ARG PLATFORM=amd64
|
||||
FROM ${PLATFORM}/alpine:3.10 AS build
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
RUN apk add --no-cache wget cmake make gcc g++ linux-headers zlib-dev openssl-dev \
|
||||
automake autoconf libevent-dev ncurses-dev msgpack-c-dev libexecinfo-dev \
|
||||
ncurses-static libexecinfo-static libevent-static msgpack-c ncurses-libs \
|
||||
libevent libexecinfo openssl zlib
|
||||
|
||||
RUN set -ex; \
|
||||
mkdir -p /src/libssh/build; \
|
||||
cd /src; \
|
||||
wget -O libssh.tar.xz https://www.libssh.org/files/0.9/libssh-0.9.0.tar.xz; \
|
||||
tar -xf libssh.tar.xz -C /src/libssh --strip-components=1; \
|
||||
cd /src/libssh/build; \
|
||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr \
|
||||
-DWITH_SFTP=OFF -DWITH_SERVER=OFF -DWITH_PCAP=OFF \
|
||||
-DWITH_STATIC_LIB=ON -DWITH_GSSAPI=OFF ..; \
|
||||
make -j $(nproc); \
|
||||
make install
|
||||
|
||||
COPY compat ./compat
|
||||
COPY *.c *.h autogen.sh Makefile.am configure.ac ./
|
||||
|
||||
RUN ./autogen.sh && ./configure --enable-static
|
||||
RUN make -j $(nproc)
|
||||
RUN objcopy --only-keep-debug tmate tmate.symbols && chmod -x tmate.symbols && strip tmate
|
||||
RUN ./tmate -V
|
||||
|
||||
FROM alpine:3.9
|
||||
|
||||
RUN apk --no-cache add bash
|
||||
RUN mkdir /build
|
||||
ENV PATH=/build:$PATH
|
||||
COPY --from=build /build/tmate.symbols /build
|
||||
COPY --from=build /build/tmate /build
|
||||
13
Makefile.am
13
Makefile.am
|
|
@ -6,8 +6,8 @@ CLEANFILES = tmate.1.mdoc tmate.1.man
|
|||
|
||||
# Distribution tarball options.
|
||||
EXTRA_DIST = \
|
||||
CHANGES FAQ README TODO COPYING examples compat/*.[ch] \
|
||||
array.h compat.h tmux.h tmate.h osdep-*.c mdoc2man.awk tmate.1
|
||||
CHANGES FAQ README TODO COPYING example_tmux.conf compat/*.[ch] \
|
||||
array.h compat.h tmux.h osdep-*.c xmalloc.h mdoc2man.awk tmate.1
|
||||
dist-hook:
|
||||
make clean
|
||||
grep "^#found_debug=" configure
|
||||
|
|
@ -33,8 +33,8 @@ CFLAGS += -g
|
|||
CFLAGS += -Wno-long-long -Wall -W -Wnested-externs -Wformat=2
|
||||
CFLAGS += -Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations
|
||||
CFLAGS += -Wwrite-strings -Wshadow -Wpointer-arith -Wsign-compare
|
||||
CFLAGS += -Wundef -Wbad-function-cast -Winline -Wcast-align
|
||||
CFLAGS += -Wdeclaration-after-statement -Wno-pointer-sign -Wno-attributes
|
||||
CFLAGS += -Wundef -Wbad-function-cast -Winline
|
||||
CFLAGS += -Wno-pointer-sign -Wno-attributes
|
||||
CPPFLAGS += -DDEBUG
|
||||
endif
|
||||
if IS_COVERAGE
|
||||
|
|
@ -44,6 +44,9 @@ endif
|
|||
CPPFLAGS += -iquote.
|
||||
endif
|
||||
|
||||
CFLAGS += -Wno-unused-parameter -Wno-unused-variable -Wno-null-pointer-arithmetic
|
||||
CFLAGS += -Wno-deprecated-declarations -Wno-format-nonliteral
|
||||
|
||||
# Set flags for Solaris.
|
||||
if IS_SUNOS
|
||||
if IS_GCC
|
||||
|
|
@ -58,7 +61,7 @@ if IS_SUNCC
|
|||
CFLAGS += -erroff=E_EMPTY_DECLARATION
|
||||
endif
|
||||
|
||||
# Set _LINUX_SOURCE_COMPAT for AIX for mallocing 0 bytes
|
||||
# Set _LINUX_SOURCE_COMPAT for AIX for malloc(0).
|
||||
if IS_AIX
|
||||
DEFS += -D_LINUX_SOURCE_COMPAT=1
|
||||
endif
|
||||
|
|
|
|||
15
README
15
README
|
|
@ -8,7 +8,7 @@ This release runs on OpenBSD, FreeBSD, NetBSD, Linux, OS X and Solaris.
|
|||
|
||||
tmux depends on libevent 2.x. Download it from:
|
||||
|
||||
http://www.monkey.org/~provos/libevent/
|
||||
http://libevent.org
|
||||
|
||||
To build tmux from a release tarball, do:
|
||||
|
||||
|
|
@ -33,13 +33,17 @@ the source tree with:
|
|||
Some common questions are answered in the FAQ file and a more extensive (but
|
||||
slightly out of date) guide is available in the OpenBSD FAQ at
|
||||
http://www.openbsd.org/faq/faq7.html#tmux. A rough todo list is in the TODO
|
||||
file and some example configurations are in the examples directory.
|
||||
file and an example configuration in example_tmux.conf.
|
||||
|
||||
A vim(1) syntax file is available at:
|
||||
|
||||
https://github.com/keith/tmux.vim
|
||||
https://raw.githubusercontent.com/keith/tmux.vim/master/syntax/tmux.vim
|
||||
|
||||
And a bash(1) completion file at:
|
||||
|
||||
https://github.com/przepompownia/tmux-bash-completion
|
||||
|
||||
For debugging, running tmux with -v or -vv will generate server and client log
|
||||
files in the current directory.
|
||||
|
||||
|
|
@ -56,10 +60,7 @@ welcome. Please send by email to:
|
|||
|
||||
tmux-users@googlegroups.com
|
||||
|
||||
This file and the CHANGES, FAQ, SYNCING and TODO files are licensed under
|
||||
the ISC license. Files under examples/ remain copyright their authors unless
|
||||
otherwise stated in the file but permission has been received to distribute
|
||||
them with tmux. All other files have a license and copyright notice at their
|
||||
start.
|
||||
This file and the CHANGES, FAQ, SYNCING and TODO files are licensed under the
|
||||
ISC license. All other files have a license and copyright notice at their start.
|
||||
|
||||
-- Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
|
|
|
|||
26
TODO
26
TODO
|
|
@ -62,6 +62,20 @@
|
|||
* command to toggle selection not to move it in copy-mode
|
||||
* regex searching
|
||||
* copy-pipe should have -x as well
|
||||
* copy mode key bindings should just be a standard key table, using
|
||||
something like "copy-mode start-selection"; it could use
|
||||
command-prompt for search, goto, etc:
|
||||
|
||||
bind -Temacs command-prompt -p'Search Up: ' 'copy-mode search-up %%'
|
||||
|
||||
it'd need a separate lookup, because modes are per-pane, perhaps a
|
||||
table() cb to give the table name ("vi" or "emacs"). anything in the
|
||||
table fires the command, anything not in the table is injected as a
|
||||
key
|
||||
* searching in copy mode should unwrap lines, so if you seach for "foobar"
|
||||
then it should be found even if it is now "foo\nbar" (if the WRAP flag
|
||||
is set on the line)
|
||||
* {} to go to next/previous blank line in copy mode
|
||||
|
||||
- layout stuff
|
||||
* way to tag a layout as a number/name
|
||||
|
|
@ -118,18 +132,8 @@
|
|||
comes from config for new sessions and windows. likewise, panes and
|
||||
jobs and run-shell and lock command all start with slightly different
|
||||
environments
|
||||
* multiline status line?
|
||||
* multiline status line? separate command prompt and status line?
|
||||
* customizable command aliases
|
||||
* automatic pane logging
|
||||
* BCE? We are halfway there (output side is done for pane backgrounds),
|
||||
just need to change how screen/grid handles erase
|
||||
* copy mode key bindings should just be a standard key table, using
|
||||
something like "copy-mode start-selection"; it could use
|
||||
command-prompt for search, goto, etc:
|
||||
|
||||
bind -Temacs command-prompt -p'Search Up: ' 'copy-mode search-up %%'
|
||||
|
||||
it'd need a separate lookup, because modes are per-pane, perhaps a
|
||||
table() cb to give the table name ("vi" or "emacs"). anything in the
|
||||
table fires the command, anything not in the table is injected as a
|
||||
key
|
||||
|
|
|
|||
25
alerts.c
25
alerts.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -29,6 +29,7 @@ int alerts_enabled(struct window *, int);
|
|||
void alerts_callback(int, short, void *);
|
||||
void alerts_reset(struct window *);
|
||||
|
||||
void alerts_run_hook(struct session *, struct winlink *, int);
|
||||
int alerts_check_all(struct session *, struct winlink *);
|
||||
int alerts_check_bell(struct session *, struct winlink *);
|
||||
int alerts_check_activity(struct session *, struct winlink *);
|
||||
|
|
@ -55,8 +56,6 @@ alerts_callback(__unused int fd, __unused short events, __unused void *arg)
|
|||
|
||||
RB_FOREACH(w, windows, &windows) {
|
||||
RB_FOREACH(s, sessions, &sessions) {
|
||||
if (s->flags & SESSION_UNATTACHED)
|
||||
continue;
|
||||
RB_FOREACH(wl, winlinks, &s->windows) {
|
||||
if (wl->window != w)
|
||||
continue;
|
||||
|
|
@ -73,6 +72,22 @@ alerts_callback(__unused int fd, __unused short events, __unused void *arg)
|
|||
alerts_fired = 0;
|
||||
}
|
||||
|
||||
void
|
||||
alerts_run_hook(struct session *s, struct winlink *wl, int flags)
|
||||
{
|
||||
struct cmd_find_state fs;
|
||||
|
||||
if (cmd_find_from_winlink(&fs, s, wl) != 0)
|
||||
return;
|
||||
|
||||
if (flags & WINDOW_BELL)
|
||||
hooks_run(s->hooks, NULL, &fs, "alert-bell");
|
||||
if (flags & WINDOW_SILENCE)
|
||||
hooks_run(s->hooks, NULL, &fs, "alert-silence");
|
||||
if (flags & WINDOW_ACTIVITY)
|
||||
hooks_run(s->hooks, NULL, &fs, "alert-activity");
|
||||
}
|
||||
|
||||
int
|
||||
alerts_check_all(struct session *s, struct winlink *wl)
|
||||
{
|
||||
|
|
@ -81,8 +96,10 @@ alerts_check_all(struct session *s, struct winlink *wl)
|
|||
alerts = alerts_check_bell(s, wl);
|
||||
alerts |= alerts_check_activity(s, wl);
|
||||
alerts |= alerts_check_silence(s, wl);
|
||||
if (alerts != 0)
|
||||
if (alerts != 0) {
|
||||
alerts_run_hook(s, wl, alerts);
|
||||
server_status_session(s);
|
||||
}
|
||||
|
||||
return (alerts);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
2
array.h
2
array.h
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2006 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
33
build_static_release.sh
Executable file
33
build_static_release.sh
Executable file
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/bash
|
||||
set -eux
|
||||
|
||||
# This is invoked by .travis.yml
|
||||
|
||||
VERSION=$1
|
||||
PLATFORM=$2
|
||||
|
||||
SRC_VERSION=`cat configure.ac | grep AC_INIT | sed -E 's/^AC_INIT\(tmate, (.+)\)$/\1/'`
|
||||
|
||||
if [ $SRC_VERSION != $VERSION ]; then
|
||||
echo "Version mismatch: $SRC_VERSION != $VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_NAME=tmate-$VERSION-static-linux-$PLATFORM
|
||||
echo "Building $RELEASE_NAME"
|
||||
|
||||
docker build . --tag local-$PLATFORM/tmate-build --build-arg PLATFORM=$PLATFORM
|
||||
|
||||
mkdir -p releases
|
||||
cd releases
|
||||
|
||||
rm -rf $RELEASE_NAME
|
||||
mkdir -p $RELEASE_NAME
|
||||
docker run --rm local-$PLATFORM/tmate-build cat /build/tmate > $RELEASE_NAME/tmate
|
||||
chmod +x $RELEASE_NAME/tmate
|
||||
tar -cf - $RELEASE_NAME | xz > tmate-$VERSION-static-linux-$PLATFORM.tar.xz
|
||||
|
||||
rm -rf $RELEASE_NAME-symbols
|
||||
mkdir -p $RELEASE_NAME-symbols
|
||||
docker run --rm local-$PLATFORM/tmate-build cat /build/tmate.symbols > $RELEASE_NAME-symbols/tmate.symbols
|
||||
tar -cf - $RELEASE_NAME-symbols | xz > dbg-symbols-tmate-$VERSION-static-linux-$PLATFORM.tar.xz
|
||||
39
cfg.c
39
cfg.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -71,7 +71,7 @@ start_cfg(void)
|
|||
cfg_add_cause("%s: %s", TMUX_CONF, strerror(errno));
|
||||
|
||||
if (cfg_file == NULL && (home = find_home()) != NULL) {
|
||||
xasprintf(&cfg_file, "%s/.tmux.conf", home);
|
||||
xasprintf(&cfg_file, "%s/.tmate.conf", home);
|
||||
if (access(cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||
free(cfg_file);
|
||||
cfg_file = NULL;
|
||||
|
|
@ -81,20 +81,6 @@ start_cfg(void)
|
|||
cfg_add_cause("%s: %s", cfg_file, cause);
|
||||
free(cause);
|
||||
|
||||
#ifdef TMATE
|
||||
cause = NULL;
|
||||
if ((home = find_home()) != NULL) {
|
||||
xasprintf(&tmate_cfg_file, "%s/.tmate.conf", home);
|
||||
if (access(tmate_cfg_file, R_OK) != 0 && errno == ENOENT) {
|
||||
free(tmate_cfg_file);
|
||||
tmate_cfg_file = NULL;
|
||||
}
|
||||
}
|
||||
if (tmate_cfg_file != NULL && load_cfg(tmate_cfg_file, cfg_cmd_q, &cause) == -1)
|
||||
cfg_add_cause("%s: %s", cfg_file, cause);
|
||||
free(cause);
|
||||
#endif
|
||||
|
||||
cmdq_continue(cfg_cmd_q);
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +135,20 @@ load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
|
|||
return (found);
|
||||
}
|
||||
|
||||
static void print_cfg_errors(void)
|
||||
{
|
||||
u_int i;
|
||||
|
||||
for (i = 0; i < cfg_ncauses; i++) {
|
||||
tmate_info("%s", cfg_causes[i]);
|
||||
free(cfg_causes[i]);
|
||||
}
|
||||
|
||||
free(cfg_causes);
|
||||
cfg_causes = NULL;
|
||||
cfg_ncauses = 0;
|
||||
}
|
||||
|
||||
void
|
||||
cfg_default_done(__unused struct cmd_q *cmdq)
|
||||
{
|
||||
|
|
@ -157,7 +157,14 @@ cfg_default_done(__unused struct cmd_q *cmdq)
|
|||
cfg_finished = 1;
|
||||
|
||||
#ifdef TMATE
|
||||
/* We do it this late, this way, CLI options take precedence over cfg file */
|
||||
tmate_load_cli_options();
|
||||
|
||||
tmate_session_start();
|
||||
if (tmate_foreground && cfg_ncauses) {
|
||||
print_cfg_errors();
|
||||
exit(1);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!RB_EMPTY(&sessions))
|
||||
|
|
|
|||
71
client.c
71
client.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -32,6 +32,7 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "tmux.h"
|
||||
#include "tmate.h"
|
||||
|
||||
struct tmuxproc *client_proc;
|
||||
struct tmuxpeer *client_peer;
|
||||
|
|
@ -213,8 +214,67 @@ client_exit_message(void)
|
|||
#ifdef TMATE
|
||||
extern const struct cmd_entry cmd_attach_session_entry;
|
||||
extern const struct cmd_entry cmd_new_session_entry;
|
||||
|
||||
/* For foreground mode */
|
||||
static int __argc;
|
||||
static const char **__argv;
|
||||
#endif
|
||||
|
||||
int run_headless_command(int argc, const char **argv, int flags, void (*err_callback)(const char *))
|
||||
{
|
||||
struct cmd_q *cmd_q;
|
||||
struct cmd_list *cmdlist;
|
||||
char *cause;
|
||||
cmd_q = cmdq_new(NULL); /* No client */
|
||||
|
||||
if ((cmdlist = cmd_list_parse(argc, (char **)argv, NULL, 0, &cause)) == NULL) {
|
||||
if (err_callback)
|
||||
err_callback(cause);
|
||||
return -1;
|
||||
}
|
||||
|
||||
cmdq_run(cmd_q, cmdlist, NULL);
|
||||
cmd_list_free(cmdlist);
|
||||
cmdq_free(cmd_q);
|
||||
|
||||
if (flags & DEFER_ERRORS_CFG)
|
||||
return 0;
|
||||
|
||||
/* error messages land in cfg_causes */
|
||||
int ret = cfg_ncauses ? -1 : 0;
|
||||
for (u_int i = 0; i < cfg_ncauses; i++) {
|
||||
if (err_callback)
|
||||
err_callback(cfg_causes[i]);
|
||||
free(cfg_causes[i]);
|
||||
}
|
||||
|
||||
free(cfg_causes);
|
||||
cfg_causes = NULL;
|
||||
cfg_ncauses = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void initial_client_cmd_err_callback(const char *cause)
|
||||
{
|
||||
tmate_info("%s", cause);
|
||||
}
|
||||
|
||||
void run_initial_client_cmd(void)
|
||||
{
|
||||
int argc = __argc;
|
||||
const char **argv = __argv;
|
||||
|
||||
const char *default_argv[] = {"new-session"};
|
||||
if (argc == 0) {
|
||||
argc = 1;
|
||||
argv = default_argv;
|
||||
}
|
||||
|
||||
if (run_headless_command(argc, argv, 0, initial_client_cmd_err_callback) < 0)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Client main loop. */
|
||||
int
|
||||
client_main(struct event_base *base, int argc, char **argv, int flags,
|
||||
|
|
@ -232,6 +292,8 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
|
|||
size_t size;
|
||||
#ifdef TMATE
|
||||
int cant_nest = 0;
|
||||
__argc = argc;
|
||||
__argv = (const char **)argv;
|
||||
#endif
|
||||
|
||||
/* Ignore SIGCHLD now or daemon() in the server will leave a zombie. */
|
||||
|
|
@ -296,6 +358,13 @@ client_main(struct event_base *base, int argc, char **argv, int flags,
|
|||
fprintf(stderr, "no server running on %s\n",
|
||||
socket_path);
|
||||
} else {
|
||||
#ifdef TMATE
|
||||
if (errno == ENOENT)
|
||||
fprintf(stderr, "You must specify a socket name with -S. For example: \n"
|
||||
" tmate -S /tmp/tmate.sock new-session -d\n"
|
||||
" tmate -S /tmp/tmate.sock wait tmate-ready\n");
|
||||
else
|
||||
#endif
|
||||
fprintf(stderr, "error connecting to %s (%s)\n",
|
||||
socket_path, strerror(errno));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -35,7 +35,7 @@ const struct cmd_entry cmd_break_pane_entry = {
|
|||
.alias = "breakp",
|
||||
|
||||
.args = { "dPF:s:t:", 0, 0 },
|
||||
.usage = "[-dP] [-F format] " CMD_SRCDST_PANE_USAGE,
|
||||
.usage = "[-dP] [-F format] [-s src-pane] [-t dst-window]",
|
||||
|
||||
.sflag = CMD_PANE,
|
||||
.tflag = CMD_WINDOW_INDEX,
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -46,6 +46,8 @@ const struct cmd_entry cmd_clock_mode_entry = {
|
|||
.args = { "t:", 0, 0 },
|
||||
.usage = CMD_TARGET_PANE_USAGE,
|
||||
|
||||
.tflag = CMD_PANE,
|
||||
|
||||
.flags = 0,
|
||||
.exec = cmd_copy_mode_exec
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
57
cmd-find.c
57
cmd-find.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2015 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -400,6 +400,7 @@ int
|
|||
cmd_find_get_session(struct cmd_find_state *fs, const char *session)
|
||||
{
|
||||
struct session *s, *s_loop;
|
||||
struct client *c;
|
||||
|
||||
log_debug("%s: %s", __func__, session);
|
||||
|
||||
|
|
@ -416,6 +417,13 @@ cmd_find_get_session(struct cmd_find_state *fs, const char *session)
|
|||
if (fs->s != NULL)
|
||||
return (0);
|
||||
|
||||
/* Look for as a client. */
|
||||
c = cmd_find_client(NULL, session, 1);
|
||||
if (c != NULL && c->session != NULL) {
|
||||
fs->s = c->session;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Stop now if exact only. */
|
||||
if (fs->flags & CMD_FIND_EXACT_SESSION)
|
||||
return (-1);
|
||||
|
|
@ -878,6 +886,22 @@ cmd_find_from_session(struct cmd_find_state *fs, struct session *s)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* Find state from a winlink. */
|
||||
int
|
||||
cmd_find_from_winlink(struct cmd_find_state *fs, struct session *s,
|
||||
struct winlink *wl)
|
||||
{
|
||||
cmd_find_clear_state(fs, NULL, 0);
|
||||
|
||||
fs->s = s;
|
||||
fs->wl = wl;
|
||||
fs->w = wl->window;
|
||||
fs->wp = wl->window->active;
|
||||
|
||||
cmd_find_log_state(__func__, fs);
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Find state from a window. */
|
||||
int
|
||||
cmd_find_from_window(struct cmd_find_state *fs, struct window *w)
|
||||
|
|
@ -906,15 +930,27 @@ cmd_find_from_pane(struct cmd_find_state *fs, struct window_pane *wp)
|
|||
return (0);
|
||||
}
|
||||
|
||||
/* Find current state. */
|
||||
int
|
||||
cmd_find_current(struct cmd_find_state *fs, struct cmd_q *cmdq, int flags)
|
||||
{
|
||||
cmd_find_clear_state(fs, cmdq, flags);
|
||||
if (cmd_find_current_session(fs) != 0) {
|
||||
if (~flags & CMD_FIND_QUIET)
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (-1);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Split target into pieces and resolve for the given type. Fills in the given
|
||||
* state. Returns 0 on success or -1 on error.
|
||||
*/
|
||||
int
|
||||
cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
|
||||
const char *target, enum cmd_find_type type, int flags)
|
||||
cmd_find_target(struct cmd_find_state *fs, struct cmd_find_state *current,
|
||||
struct cmd_q *cmdq, const char *target, enum cmd_find_type type, int flags)
|
||||
{
|
||||
struct cmd_find_state current;
|
||||
struct mouse_event *m;
|
||||
char *colon, *period, *copy = NULL;
|
||||
const char *session, *window, *pane;
|
||||
|
|
@ -934,15 +970,8 @@ cmd_find_target(struct cmd_find_state *fs, struct cmd_q *cmdq,
|
|||
fs->current = &marked_pane;
|
||||
else if (cmd_find_valid_state(&cmdq->current))
|
||||
fs->current = &cmdq->current;
|
||||
else {
|
||||
cmd_find_clear_state(¤t, cmdq, flags);
|
||||
if (cmd_find_current_session(¤t) != 0) {
|
||||
if (~flags & CMD_FIND_QUIET)
|
||||
cmdq_error(cmdq, "no current session");
|
||||
goto error;
|
||||
}
|
||||
fs->current = ¤t;
|
||||
}
|
||||
else
|
||||
fs->current = current;
|
||||
|
||||
/* An empty or NULL target is the current. */
|
||||
if (target == NULL || *target == '\0')
|
||||
|
|
@ -1187,7 +1216,7 @@ cmd_find_client(struct cmd_q *cmdq, const char *target, int quiet)
|
|||
const char *path;
|
||||
|
||||
/* A NULL argument means the current client. */
|
||||
if (target == NULL) {
|
||||
if (cmdq != NULL && target == NULL) {
|
||||
c = cmd_find_current_client(cmdq);
|
||||
if (c == NULL && !quiet)
|
||||
cmdq_error(cmdq, "no current client");
|
||||
|
|
|
|||
|
|
@ -73,14 +73,13 @@ cmd_if_shell_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
struct format_tree *ft;
|
||||
const char *cwd;
|
||||
|
||||
cwd = wp->cwd;
|
||||
|
||||
if (cmdq->client != NULL && cmdq->client->session == NULL)
|
||||
cwd = cmdq->client->cwd;
|
||||
else if (s != NULL)
|
||||
cwd = s->cwd;
|
||||
else
|
||||
cwd = NULL;
|
||||
|
||||
ft = format_create(cmdq, 0);
|
||||
format_defaults(ft, NULL, s, wl, wp);
|
||||
shellcmd = format_expand(ft, args->argv[0]);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2011 George Nachman <tmux@georgester.com>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ cmd_load_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
return (CMD_RETURN_WAIT);
|
||||
}
|
||||
|
||||
if (c != NULL && c->session == NULL)
|
||||
if (c != NULL && c->session == NULL && c->cwd != NULL)
|
||||
cwd = c->cwd;
|
||||
else if ((s = c->session) != NULL)
|
||||
else if ((s = c->session) != NULL && s->cwd != NULL)
|
||||
cwd = s->cwd;
|
||||
else
|
||||
cwd = ".";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -68,13 +68,13 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
{
|
||||
struct args *args = self->args;
|
||||
struct client *c = cmdq->client;
|
||||
struct session *s, *attach_sess;
|
||||
struct session *s, *as;
|
||||
struct session *groupwith = cmdq->state.tflag.s;
|
||||
struct window *w;
|
||||
struct environ *env;
|
||||
struct termios tio, *tiop;
|
||||
const char *newname, *target, *update, *errstr, *template;
|
||||
const char *path, *cwd, *to_free;
|
||||
const char *path, *cwd, *to_free = NULL;
|
||||
char **argv, *cmd, *cause, *cp;
|
||||
int detached, already_attached, idx, argc;
|
||||
u_int sx, sy;
|
||||
|
|
@ -100,7 +100,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
cmdq_error(cmdq, "bad session name: %s", newname);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
if ((attach_sess = session_find(newname)) != NULL) {
|
||||
if ((as = session_find(newname)) != NULL) {
|
||||
if (args_has(args, 'A')) {
|
||||
/*
|
||||
* This cmdq is now destined for
|
||||
|
|
@ -108,7 +108,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
* will have already been prepared, copy this
|
||||
* session into its tflag so it can be used.
|
||||
*/
|
||||
cmdq->state.tflag.s = attach_sess;
|
||||
cmd_find_from_session(&cmdq->state.tflag, as);
|
||||
return (cmd_attach_session(cmdq,
|
||||
args_has(args, 'D'), 0, NULL,
|
||||
args_has(args, 'E')));
|
||||
|
|
@ -118,7 +118,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
}
|
||||
}
|
||||
|
||||
if ((target = args_get(args, 't')) == NULL)
|
||||
if ((target = args_get(args, 't')) != NULL) {
|
||||
if (groupwith == NULL) {
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
goto error;
|
||||
}
|
||||
} else
|
||||
groupwith = NULL;
|
||||
|
||||
/* Set -d if no client. */
|
||||
|
|
@ -126,19 +131,21 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
if (c == NULL)
|
||||
detached = 1;
|
||||
|
||||
if (tmate_foreground)
|
||||
detached = 1;
|
||||
|
||||
/* Is this client already attached? */
|
||||
already_attached = 0;
|
||||
if (c != NULL && c->session != NULL)
|
||||
already_attached = 1;
|
||||
|
||||
/* Get the new session working directory. */
|
||||
to_free = NULL;
|
||||
if (args_has(args, 'c')) {
|
||||
ft = format_create(cmdq, 0);
|
||||
format_defaults(ft, c, NULL, NULL, NULL);
|
||||
to_free = cwd = format_expand(ft, args_get(args, 'c'));
|
||||
format_free(ft);
|
||||
} else if (c != NULL && c->session == NULL)
|
||||
} else if (c != NULL && c->session == NULL && c->cwd != NULL)
|
||||
cwd = c->cwd;
|
||||
else
|
||||
cwd = ".";
|
||||
|
|
@ -208,7 +215,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
if (!args_has(args, 't') && args->argc != 0) {
|
||||
argc = args->argc;
|
||||
argv = args->argv;
|
||||
} else if (target == NULL) {
|
||||
} else if (groupwith == NULL) {
|
||||
cmd = options_get_string(global_s_options, "default-command");
|
||||
if (cmd != NULL && *cmd != '\0') {
|
||||
argc = 1;
|
||||
|
|
@ -257,7 +264,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
* If a target session is given, this is to be part of a session group,
|
||||
* so add it to the group and synchronize.
|
||||
*/
|
||||
if (args_has(args, 't')) {
|
||||
if (groupwith != NULL) {
|
||||
session_group_add(groupwith, s);
|
||||
session_group_synchronize_to(s);
|
||||
session_select(s, RB_MIN(winlinks, &s->windows)->idx);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
11
cmd-queue.c
11
cmd-queue.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -201,12 +201,13 @@ cmdq_continue_one(struct cmd_q *cmdq)
|
|||
char *tmp;
|
||||
int flags = !!(cmd->flags & CMD_CONTROL);
|
||||
|
||||
tmp = cmd_print(cmd);
|
||||
log_debug("cmdq %p: %s", cmdq, tmp);
|
||||
#ifdef TMATE
|
||||
if (tmate_should_replicate_cmd(cmd->entry))
|
||||
tmate_exec_cmd(tmp);
|
||||
tmate_exec_cmd(cmd);
|
||||
#endif
|
||||
|
||||
tmp = cmd_print(cmd);
|
||||
log_debug("cmdq %p: %s", cmdq, tmp);
|
||||
free(tmp);
|
||||
|
||||
cmdq->time = time(NULL);
|
||||
|
|
@ -214,7 +215,7 @@ cmdq_continue_one(struct cmd_q *cmdq)
|
|||
|
||||
cmdq_guard(cmdq, "begin", flags);
|
||||
|
||||
if (cmd_prepare_state(cmd, cmdq) != 0)
|
||||
if (cmd_prepare_state(cmd, cmdq, NULL) != 0)
|
||||
goto error;
|
||||
retval = cmd->entry->exec(cmd, cmdq);
|
||||
if (retval == CMD_RETURN_ERROR)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -68,7 +68,6 @@ cmd_resize_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
return (CMD_RETURN_NORMAL);
|
||||
}
|
||||
|
||||
w = wl->window;
|
||||
if (args_has(args, 'Z')) {
|
||||
if (w->flags & WINDOW_ZOOMED)
|
||||
window_unzoom(w);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
* Copyright (c) 2011 Marcel P. Partap <mpartap@gmx.net>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ cmd_run_shell_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
else
|
||||
cwd = NULL;
|
||||
ft = format_create(cmdq, 0);
|
||||
format_defaults(ft, NULL, s, wl, wp);
|
||||
format_defaults(ft, cmdq->state.c, s, wl, wp);
|
||||
shellcmd = format_expand(ft, args->argv[0]);
|
||||
format_free(ft);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ cmd_save_buffer_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
goto do_print;
|
||||
}
|
||||
|
||||
if (c != NULL && c->session == NULL)
|
||||
if (c != NULL && c->session == NULL && c->cwd != NULL)
|
||||
cwd = c->cwd;
|
||||
else if ((s = c->session) != NULL)
|
||||
else if ((s = c->session) != NULL && s->cwd != NULL)
|
||||
cwd = s->cwd;
|
||||
else
|
||||
cwd = ".";
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -47,7 +47,7 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
{
|
||||
struct args *args = self->args;
|
||||
struct environ *env;
|
||||
const char *name, *value;
|
||||
const char *name, *value, *target;
|
||||
|
||||
name = args->argv[0];
|
||||
if (*name == '\0') {
|
||||
|
|
@ -64,10 +64,19 @@ cmd_set_environment_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
else
|
||||
value = args->argv[1];
|
||||
|
||||
if (args_has(self->args, 'g') || cmdq->state.tflag.s == NULL)
|
||||
if (args_has(self->args, 'g'))
|
||||
env = global_environ;
|
||||
else
|
||||
else {
|
||||
if (cmdq->state.tflag.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
else
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
env = cmdq->state.tflag.s->environ;
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'u')) {
|
||||
if (value != NULL) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -100,7 +100,7 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
struct client *c;
|
||||
const struct options_table_entry *oe;
|
||||
struct options *oo;
|
||||
const char *optstr, *valstr;
|
||||
const char *optstr, *valstr, *target;
|
||||
|
||||
/* Get the option name and value. */
|
||||
optstr = args->argv[0];
|
||||
|
|
@ -140,29 +140,29 @@ cmd_set_option_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
else if (oe->scope == OPTIONS_TABLE_WINDOW) {
|
||||
if (args_has(self->args, 'g'))
|
||||
oo = global_w_options;
|
||||
else {
|
||||
if (wl == NULL) {
|
||||
cmdq_error(cmdq,
|
||||
"couldn't set '%s'%s", optstr,
|
||||
(!args_has(args, 't') && !args_has(args,
|
||||
'g')) ? " need target window or -g" : "");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
else if (wl == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL) {
|
||||
cmdq_error(cmdq, "no such window: %s",
|
||||
target);
|
||||
} else
|
||||
cmdq_error(cmdq, "no current window");
|
||||
return (CMD_RETURN_ERROR);
|
||||
} else
|
||||
oo = wl->window->options;
|
||||
}
|
||||
} else if (oe->scope == OPTIONS_TABLE_SESSION) {
|
||||
if (args_has(self->args, 'g'))
|
||||
oo = global_s_options;
|
||||
else {
|
||||
if (s == NULL) {
|
||||
cmdq_error(cmdq,
|
||||
"couldn't set '%s'%s", optstr,
|
||||
(!args_has(args, 't') && !args_has(args,
|
||||
'g')) ? " need target session or -g" : "");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
else if (s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL) {
|
||||
cmdq_error(cmdq, "no such session: %s",
|
||||
target);
|
||||
} else
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
} else
|
||||
oo = s->options;
|
||||
}
|
||||
} else {
|
||||
cmdq_error(cmdq, "unknown table");
|
||||
return (CMD_RETURN_ERROR);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -93,11 +93,28 @@ cmd_show_environment_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
struct args *args = self->args;
|
||||
struct environ *env;
|
||||
struct environ_entry *envent;
|
||||
const char *target;
|
||||
|
||||
if (args_has(self->args, 'g') || cmdq->state.tflag.s == NULL)
|
||||
if ((target = args_get(args, 't')) != NULL) {
|
||||
if (cmdq->state.tflag.s == NULL) {
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
if (args_has(self->args, 'g'))
|
||||
env = global_environ;
|
||||
else
|
||||
else {
|
||||
if (cmdq->state.tflag.s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL)
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
else
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
}
|
||||
env = cmdq->state.tflag.s->environ;
|
||||
}
|
||||
|
||||
if (args->argc != 0) {
|
||||
envent = environ_find(env, args->argv[0]);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -63,12 +63,13 @@ const struct cmd_entry cmd_show_window_options_entry = {
|
|||
enum cmd_retval
|
||||
cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
{
|
||||
struct args *args = self->args;
|
||||
struct session *s = cmdq->state.tflag.s;
|
||||
struct winlink *wl = cmdq->state.tflag.wl;
|
||||
struct options *oo;
|
||||
enum options_table_scope scope;
|
||||
int quiet;
|
||||
struct args *args = self->args;
|
||||
struct session *s = cmdq->state.tflag.s;
|
||||
struct winlink *wl = cmdq->state.tflag.wl;
|
||||
struct options *oo;
|
||||
enum options_table_scope scope;
|
||||
int quiet;
|
||||
const char *target;
|
||||
|
||||
if (args_has(self->args, 's')) {
|
||||
oo = global_options;
|
||||
|
|
@ -78,13 +79,27 @@ cmd_show_options_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||
scope = OPTIONS_TABLE_WINDOW;
|
||||
if (args_has(self->args, 'g'))
|
||||
oo = global_w_options;
|
||||
else
|
||||
else if (wl == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL) {
|
||||
cmdq_error(cmdq, "no such window: %s", target);
|
||||
} else
|
||||
cmdq_error(cmdq, "no current window");
|
||||
return (CMD_RETURN_ERROR);
|
||||
} else
|
||||
oo = wl->window->options;
|
||||
} else {
|
||||
scope = OPTIONS_TABLE_SESSION;
|
||||
if (args_has(self->args, 'g'))
|
||||
oo = global_s_options;
|
||||
else
|
||||
else if (s == NULL) {
|
||||
target = args_get(args, 't');
|
||||
if (target != NULL) {
|
||||
cmdq_error(cmdq, "no such session: %s", target);
|
||||
} else
|
||||
cmdq_error(cmdq, "no current session");
|
||||
return (CMD_RETURN_ERROR);
|
||||
} else
|
||||
oo = s->options;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -307,6 +307,10 @@ cmd_string_variable(const char *s, size_t *p)
|
|||
free(buf);
|
||||
if (envent == NULL)
|
||||
return (xstrdup(""));
|
||||
#ifdef TMATE
|
||||
if (envent->value == NULL)
|
||||
return (xstrdup(""));
|
||||
#endif
|
||||
return (xstrdup(envent->value));
|
||||
|
||||
error:
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -45,28 +45,23 @@ const struct cmd_entry cmd_swap_pane_entry = {
|
|||
enum cmd_retval
|
||||
cmd_swap_pane_exec(struct cmd *self, struct cmd_q *cmdq)
|
||||
{
|
||||
struct winlink *src_wl, *dst_wl;
|
||||
struct window *src_w, *dst_w;
|
||||
struct window_pane *tmp_wp, *src_wp, *dst_wp;
|
||||
struct layout_cell *src_lc, *dst_lc;
|
||||
u_int sx, sy, xoff, yoff;
|
||||
|
||||
dst_wl = cmdq->state.tflag.wl;
|
||||
dst_w = dst_wl->window;
|
||||
dst_w = cmdq->state.tflag.wl->window;
|
||||
dst_wp = cmdq->state.tflag.wp;
|
||||
src_wl = cmdq->state.sflag.wl;
|
||||
src_w = src_wl->window;
|
||||
src_w = cmdq->state.sflag.wl->window;
|
||||
src_wp = cmdq->state.sflag.wp;
|
||||
server_unzoom_window(dst_w);
|
||||
|
||||
if (args_has(self->args, 'D')) {
|
||||
src_wl = dst_wl;
|
||||
src_w = dst_w;
|
||||
src_wp = TAILQ_NEXT(dst_wp, entry);
|
||||
if (src_wp == NULL)
|
||||
src_wp = TAILQ_FIRST(&dst_w->panes);
|
||||
} else if (args_has(self->args, 'U')) {
|
||||
src_wl = dst_wl;
|
||||
src_w = dst_w;
|
||||
src_wp = TAILQ_PREV(dst_wp, window_panes, entry);
|
||||
if (src_wp == NULL)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
* Copyright (c) 2013 Thiago de Arruda <tpadilha84@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
|
|
|
|||
121
cmd.c
121
cmd.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -388,10 +388,23 @@ usage:
|
|||
}
|
||||
|
||||
static int
|
||||
cmd_prepare_state_flag(struct cmd_find_state *fs, enum cmd_entry_flag flag,
|
||||
const char *target, struct cmd_q *cmdq)
|
||||
cmd_prepare_state_flag(char c, const char *target, enum cmd_entry_flag flag,
|
||||
struct cmd_q *cmdq, struct cmd_q *parent)
|
||||
{
|
||||
int targetflags, error;
|
||||
int targetflags, error;
|
||||
struct cmd_find_state *fs = NULL;
|
||||
struct cmd_find_state *current = NULL;
|
||||
struct cmd_find_state tmp;
|
||||
|
||||
if (flag == CMD_NONE ||
|
||||
flag == CMD_CLIENT ||
|
||||
flag == CMD_CLIENT_CANFAIL)
|
||||
return (0);
|
||||
|
||||
if (c == 't')
|
||||
fs = &cmdq->state.tflag;
|
||||
else if (c == 's')
|
||||
fs = &cmdq->state.sflag;
|
||||
|
||||
if (flag == CMD_SESSION_WITHPANE) {
|
||||
if (target != NULL && target[strcspn(target, ":.")] != '\0')
|
||||
|
|
@ -400,6 +413,55 @@ cmd_prepare_state_flag(struct cmd_find_state *fs, enum cmd_entry_flag flag,
|
|||
flag = CMD_SESSION;
|
||||
}
|
||||
|
||||
targetflags = 0;
|
||||
switch (flag) {
|
||||
case CMD_SESSION:
|
||||
case CMD_SESSION_CANFAIL:
|
||||
case CMD_SESSION_PREFERUNATTACHED:
|
||||
if (flag == CMD_SESSION_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_SESSION_PREFERUNATTACHED)
|
||||
targetflags |= CMD_FIND_PREFER_UNATTACHED;
|
||||
break;
|
||||
case CMD_MOVEW_R:
|
||||
flag = CMD_WINDOW_INDEX;
|
||||
/* FALLTHROUGH */
|
||||
case CMD_WINDOW:
|
||||
case CMD_WINDOW_CANFAIL:
|
||||
case CMD_WINDOW_MARKED:
|
||||
case CMD_WINDOW_INDEX:
|
||||
if (flag == CMD_WINDOW_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_WINDOW_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
if (flag == CMD_WINDOW_INDEX)
|
||||
targetflags |= CMD_FIND_WINDOW_INDEX;
|
||||
break;
|
||||
case CMD_PANE:
|
||||
case CMD_PANE_CANFAIL:
|
||||
case CMD_PANE_MARKED:
|
||||
if (flag == CMD_PANE_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_PANE_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
break;
|
||||
default:
|
||||
fatalx("unknown %cflag %d", c, flag);
|
||||
}
|
||||
|
||||
log_debug("%s: flag %c %d %#x", __func__, c, flag, targetflags);
|
||||
if (parent != NULL) {
|
||||
if (c == 't')
|
||||
current = &parent->state.tflag;
|
||||
else if (c == 's')
|
||||
current = &parent->state.sflag;
|
||||
} else {
|
||||
error = cmd_find_current(&tmp, cmdq, targetflags);
|
||||
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
|
||||
return (-1);
|
||||
current = &tmp;
|
||||
}
|
||||
|
||||
switch (flag) {
|
||||
case CMD_NONE:
|
||||
case CMD_CLIENT:
|
||||
|
|
@ -409,61 +471,42 @@ cmd_prepare_state_flag(struct cmd_find_state *fs, enum cmd_entry_flag flag,
|
|||
case CMD_SESSION_CANFAIL:
|
||||
case CMD_SESSION_PREFERUNATTACHED:
|
||||
case CMD_SESSION_WITHPANE:
|
||||
targetflags = 0;
|
||||
if (flag == CMD_SESSION_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_SESSION_PREFERUNATTACHED)
|
||||
targetflags |= CMD_FIND_PREFER_UNATTACHED;
|
||||
|
||||
error = cmd_find_target(fs, cmdq, target, CMD_FIND_SESSION,
|
||||
targetflags);
|
||||
if (error != 0 && flag != CMD_SESSION_CANFAIL)
|
||||
error = cmd_find_target(fs, current, cmdq, target,
|
||||
CMD_FIND_SESSION, targetflags);
|
||||
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
|
||||
return (-1);
|
||||
break;
|
||||
case CMD_MOVEW_R:
|
||||
error = cmd_find_target(fs, cmdq, target, CMD_FIND_SESSION,
|
||||
CMD_FIND_QUIET);
|
||||
error = cmd_find_target(fs, current, cmdq, target,
|
||||
CMD_FIND_SESSION, CMD_FIND_QUIET);
|
||||
if (error == 0)
|
||||
break;
|
||||
flag = CMD_WINDOW_INDEX;
|
||||
/* FALLTHROUGH */
|
||||
case CMD_WINDOW:
|
||||
case CMD_WINDOW_CANFAIL:
|
||||
case CMD_WINDOW_MARKED:
|
||||
case CMD_WINDOW_INDEX:
|
||||
targetflags = 0;
|
||||
if (flag == CMD_WINDOW_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_WINDOW_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
if (flag == CMD_WINDOW_INDEX)
|
||||
targetflags |= CMD_FIND_WINDOW_INDEX;
|
||||
|
||||
error = cmd_find_target(fs, cmdq, target, CMD_FIND_WINDOW,
|
||||
targetflags);
|
||||
if (error != 0 && flag != CMD_WINDOW_CANFAIL)
|
||||
error = cmd_find_target(fs, current, cmdq, target,
|
||||
CMD_FIND_WINDOW, targetflags);
|
||||
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
|
||||
return (-1);
|
||||
break;
|
||||
case CMD_PANE:
|
||||
case CMD_PANE_CANFAIL:
|
||||
case CMD_PANE_MARKED:
|
||||
targetflags = 0;
|
||||
if (flag == CMD_PANE_CANFAIL)
|
||||
targetflags |= CMD_FIND_QUIET;
|
||||
if (flag == CMD_PANE_MARKED)
|
||||
targetflags |= CMD_FIND_DEFAULT_MARKED;
|
||||
|
||||
error = cmd_find_target(fs, cmdq, target, CMD_FIND_PANE,
|
||||
targetflags);
|
||||
if (error != 0 && flag != CMD_PANE_CANFAIL)
|
||||
error = cmd_find_target(fs, current, cmdq, target,
|
||||
CMD_FIND_PANE, targetflags);
|
||||
if (error != 0 && ~targetflags & CMD_FIND_QUIET)
|
||||
return (-1);
|
||||
break;
|
||||
default:
|
||||
fatalx("unknown %cflag %d", c, flag);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
|
||||
cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq, struct cmd_q *parent)
|
||||
{
|
||||
const struct cmd_entry *entry = cmd->entry;
|
||||
struct cmd_state *state = &cmdq->state;
|
||||
|
|
@ -503,14 +546,14 @@ cmd_prepare_state(struct cmd *cmd, struct cmd_q *cmdq)
|
|||
s = args_get(cmd->args, 't');
|
||||
log_debug("preparing -t state: target %s", s == NULL ? "none" : s);
|
||||
|
||||
error = cmd_prepare_state_flag(&state->tflag, entry->tflag, s, cmdq);
|
||||
error = cmd_prepare_state_flag('t', s, entry->tflag, cmdq, parent);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
s = args_get(cmd->args, 's');
|
||||
log_debug("preparing -s state: target %s", s == NULL ? "none" : s);
|
||||
|
||||
error = cmd_prepare_state_flag(&state->sflag, entry->sflag, s, cmdq);
|
||||
error = cmd_prepare_state_flag('s', s, entry->sflag, cmdq, parent);
|
||||
if (error != 0)
|
||||
return (error);
|
||||
|
||||
|
|
|
|||
2
colour.c
2
colour.c
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
2
compat.h
2
compat.h
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2006 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2006 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
#define Assert(Cond) if (!(Cond)) abort()
|
||||
|
||||
static const char Base64[] =
|
||||
|
|
@ -122,7 +124,7 @@ static const char Pad64 = '=';
|
|||
*/
|
||||
|
||||
int
|
||||
b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
|
||||
b64_ntop(const char *src, size_t srclength, char *target, size_t targsize) {
|
||||
size_t datalength = 0;
|
||||
uint8_t input[3];
|
||||
uint8_t output[4];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Dagobert Michelsen
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
110
compat/fgetln.c
110
compat/fgetln.c
|
|
@ -1,43 +1,26 @@
|
|||
/* $NetBSD: fgetln.c,v 1.3 2007/08/07 02:06:58 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright (c) 2015 Joerg Jung <jung@openbsd.org>
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Christos Zoulas.
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
/*
|
||||
* portable fgetln() version, NOT reentrant
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "tmux.h"
|
||||
|
||||
|
|
@ -45,41 +28,34 @@ char *
|
|||
fgetln(FILE *fp, size_t *len)
|
||||
{
|
||||
static char *buf = NULL;
|
||||
static size_t bufsiz = 0;
|
||||
char *ptr;
|
||||
static size_t bufsz = 0;
|
||||
size_t r = 0;
|
||||
char *p;
|
||||
int c, e;
|
||||
|
||||
|
||||
if (buf == NULL) {
|
||||
bufsiz = BUFSIZ;
|
||||
if ((buf = malloc(bufsiz)) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fgets(buf, bufsiz, fp) == NULL)
|
||||
if (!fp || !len) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
|
||||
*len = 0;
|
||||
while ((ptr = strchr(&buf[*len], '\n')) == NULL) {
|
||||
size_t nbufsiz = bufsiz + BUFSIZ;
|
||||
char *nbuf = realloc(buf, nbufsiz);
|
||||
|
||||
if (nbuf == NULL) {
|
||||
int oerrno = errno;
|
||||
free(buf);
|
||||
errno = oerrno;
|
||||
buf = NULL;
|
||||
return NULL;
|
||||
} else
|
||||
buf = nbuf;
|
||||
|
||||
*len = bufsiz;
|
||||
if (fgets(&buf[bufsiz], BUFSIZ, fp) == NULL)
|
||||
return buf;
|
||||
|
||||
bufsiz = nbufsiz;
|
||||
}
|
||||
|
||||
*len = (ptr - buf) + 1;
|
||||
return buf;
|
||||
if (!buf) {
|
||||
if (!(buf = calloc(1, BUFSIZ)))
|
||||
return NULL;
|
||||
bufsz = BUFSIZ;
|
||||
}
|
||||
while ((c = getc(fp)) != EOF) {
|
||||
buf[r++] = c;
|
||||
if (r == bufsz) {
|
||||
if (!(p = reallocarray(buf, 2, bufsz))) {
|
||||
e = errno;
|
||||
free(buf);
|
||||
errno = e;
|
||||
buf = NULL, bufsz = 0;
|
||||
return NULL;
|
||||
}
|
||||
buf = p, bufsz = 2 * bufsz;
|
||||
}
|
||||
if (c == '\n')
|
||||
break;
|
||||
}
|
||||
return (*len = r) ? buf : NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2013 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2010 Dagobert Michelsen
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2010 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
|
|||
42
configure.ac
42
configure.ac
|
|
@ -1,7 +1,8 @@
|
|||
# configure.ac
|
||||
|
||||
AC_INIT(tmate, 2.2.0)
|
||||
AC_INIT(tmate, 2.4.0)
|
||||
|
||||
AM_SILENT_RULES([yes])
|
||||
AC_CONFIG_AUX_DIR(etc)
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
|
|
@ -47,8 +48,21 @@ AC_ARG_ENABLE(
|
|||
found_static=$enable_static
|
||||
)
|
||||
if test "x$found_static" = xyes; then
|
||||
LDFLAGS="$LDFLAGS -static"
|
||||
# XXX Static build are only doable with the musl library
|
||||
PKG_CONFIG="pkg-config --static"
|
||||
|
||||
CFLAGS="$CFLAGS -flto"
|
||||
LDFLAGS="$LDFLAGS -flto -static -no-pie"
|
||||
|
||||
PKG_CHECK_MODULES([ZLIB], [zlib], [
|
||||
CPPFLAGS="$ZLIB_CFLAGS $CPPFLAGS"
|
||||
LIBS="$ZLIB_LIBS $LIBS"
|
||||
])
|
||||
|
||||
PKG_CHECK_MODULES([LIBCRYPTO], [libcrypto], [
|
||||
CPPFLAGS="$LIBCRYPTO_CFLAGS $CPPFLAGS"
|
||||
LIBS="$LIBCRYPTO_LIBS $LIBS"
|
||||
])
|
||||
fi
|
||||
|
||||
# Is this gcc?
|
||||
|
|
@ -89,6 +103,7 @@ AC_CHECK_HEADERS(
|
|||
bitstring.h \
|
||||
curses.h \
|
||||
dirent.h \
|
||||
execinfo.h \
|
||||
fcntl.h \
|
||||
inttypes.h \
|
||||
libutil.h \
|
||||
|
|
@ -108,9 +123,13 @@ AC_CHECK_HEADERS(
|
|||
# Look for library needed for flock.
|
||||
AC_SEARCH_LIBS(flock, bsd)
|
||||
|
||||
# Look for library needed for backtrace
|
||||
AC_SEARCH_LIBS(backtrace, execinfo)
|
||||
|
||||
# Check for some functions that are replaced or omitted.
|
||||
AC_CHECK_FUNCS(
|
||||
[ \
|
||||
backtrace \
|
||||
dirfd \
|
||||
flock \
|
||||
setproctitle \
|
||||
|
|
@ -167,10 +186,17 @@ if test "x$found_curses" = xno; then
|
|||
fi
|
||||
|
||||
# Look for utempter.
|
||||
AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
|
||||
if test "x$have_utempter" = xyes; then
|
||||
AC_DEFINE(HAVE_UTEMPTER)
|
||||
LIBS="$LIBS -lutempter"
|
||||
AC_CHECK_HEADER(utempter.h, found_utempter=yes, found_utempter=no)
|
||||
if test "x$found_utempter" = xyes; then
|
||||
AC_SEARCH_LIBS(
|
||||
utempter_add_record,
|
||||
utempter,
|
||||
found_utempter=yes,
|
||||
found_utempter=no
|
||||
)
|
||||
if test "x$found_utempter" = xyes; then
|
||||
AC_DEFINE(HAVE_UTEMPTER)
|
||||
fi
|
||||
fi
|
||||
|
||||
PKG_CHECK_MODULES(
|
||||
|
|
@ -189,7 +215,7 @@ fi
|
|||
|
||||
PKG_CHECK_MODULES(
|
||||
LIBSSH,
|
||||
libssh >= 0.6.0,
|
||||
libssh >= 0.8.4,
|
||||
[
|
||||
CPPFLAGS="$LIBSSH_CFLAGS $CPPFLAGS"
|
||||
LIBS="$LIBSSH_LIBS $LIBS"
|
||||
|
|
@ -198,7 +224,7 @@ PKG_CHECK_MODULES(
|
|||
found_libssh=no
|
||||
)
|
||||
if test "x$found_libssh" = xno; then
|
||||
AC_MSG_ERROR("libssh >= 0.6.0 not found")
|
||||
AC_MSG_ERROR("libssh >= 0.8.4 not found")
|
||||
fi
|
||||
|
||||
# Check for b64_ntop.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
* Copyright (c) 2012 George Nachman <tmux@georgester.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2012 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
* Copyright (c) 2012 George Nachman <tmux@georgester.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* $OpenBSD$ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
|
@ -196,10 +196,10 @@ void
|
|||
environ_push(struct environ *env)
|
||||
{
|
||||
struct environ_entry *envent;
|
||||
char **vp, *v;
|
||||
char *v;
|
||||
|
||||
for (vp = environ; *vp != NULL; vp++) {
|
||||
v = xstrdup(*vp);
|
||||
while (*environ != NULL) {
|
||||
v = xstrdup(*environ);
|
||||
v[strcspn(v, "=")] = '\0';
|
||||
|
||||
unsetenv(v);
|
||||
|
|
|
|||
66
example_tmux.conf
Normal file
66
example_tmux.conf
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#
|
||||
# Example .tmux.conf
|
||||
#
|
||||
# By Nicholas Marriott. Public domain.
|
||||
#
|
||||
|
||||
# Some tweaks to the status line
|
||||
set -g status-bg green
|
||||
set -g status-right "%H:%M"
|
||||
set -g window-status-current-attr "underscore"
|
||||
|
||||
# No bells at all
|
||||
set -g bell-action none
|
||||
|
||||
# Lock after 15 minutes
|
||||
set -g lock-after-time 1800
|
||||
|
||||
# Keep windows around after they exit
|
||||
set -g remain-on-exit on
|
||||
|
||||
# Turn on xterm-keys so that additional function keys get escape sequences
|
||||
set -g xterm-keys on
|
||||
|
||||
# Change the prefix key to C-a
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
bind C-a send-prefix
|
||||
|
||||
# Turn the mouse on, but without copy mode dragging
|
||||
set -g mouse on
|
||||
unbind -n MouseDrag1Pane
|
||||
unbind -temacs-copy MouseDrag1Pane
|
||||
|
||||
# Some extra key bindings to select higher numbered windows
|
||||
bind F1 selectw -t:10
|
||||
bind F2 selectw -t:11
|
||||
bind F3 selectw -t:12
|
||||
bind F4 selectw -t:13
|
||||
bind F5 selectw -t:14
|
||||
bind F6 selectw -t:15
|
||||
bind F7 selectw -t:16
|
||||
bind F8 selectw -t:17
|
||||
bind F9 selectw -t:18
|
||||
bind F10 selectw -t:19
|
||||
bind F11 selectw -t:20
|
||||
bind F12 selectw -t:21
|
||||
|
||||
# Keys to toggle monitoring activity in a window, and synchronize-panes
|
||||
bind m set monitor-activity
|
||||
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
|
||||
|
||||
# Keys to hide and show a window name from the status line
|
||||
bind '-' set window-status-format '#I'\; set window-status-current-format '#I'
|
||||
bind '+' set window-status-format '#I:#W#F'\; set window-status-current-format '#I:#W#F'
|
||||
|
||||
# Create a single default session
|
||||
new -d -s0 -nirssi 'exec irssi'
|
||||
set -t0:0 monitor-activity on
|
||||
set -t0:0 aggressive-resize on
|
||||
neww -d -ntodo 'exec emacs ~/TODO'
|
||||
setw -t0:1 aggressive-resize on
|
||||
neww -d -nmutt 'exec mutt'
|
||||
setw -t0:2 aggressive-resize on
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
# START tmux completion
|
||||
# This file is in the public domain
|
||||
# See: http://www.debian-administration.org/articles/317 for how to write more.
|
||||
# Usage: Put "source bash_completion_tmux.sh" into your .bashrc
|
||||
_tmux()
|
||||
{
|
||||
local cur prev opts
|
||||
COMPREPLY=()
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
|
||||
opts=" \
|
||||
attach-session \
|
||||
bind-key \
|
||||
break-pane \
|
||||
capture-pane \
|
||||
choose-client \
|
||||
choose-session \
|
||||
choose-window \
|
||||
clear-history \
|
||||
clock-mode \
|
||||
command-prompt \
|
||||
confirm-before \
|
||||
copy-buffer \
|
||||
copy-mode \
|
||||
delete-buffer \
|
||||
detach-client \
|
||||
display-message \
|
||||
display-panes \
|
||||
down-pane \
|
||||
find-window \
|
||||
has-session \
|
||||
if-shell \
|
||||
join-pane \
|
||||
kill-pane \
|
||||
kill-server \
|
||||
kill-session \
|
||||
kill-window \
|
||||
last-window \
|
||||
link-window \
|
||||
list-buffers \
|
||||
list-clients \
|
||||
list-commands \
|
||||
list-keys \
|
||||
list-panes \
|
||||
list-sessions \
|
||||
list-windows \
|
||||
load-buffer \
|
||||
lock-client \
|
||||
lock-server \
|
||||
lock-session \
|
||||
move-window \
|
||||
new-session \
|
||||
new-window \
|
||||
next-layout \
|
||||
next-window \
|
||||
paste-buffer \
|
||||
pipe-pane \
|
||||
previous-layout \
|
||||
previous-window \
|
||||
refresh-client \
|
||||
rename-session \
|
||||
rename-window \
|
||||
resize-pane \
|
||||
respawn-window \
|
||||
rotate-window \
|
||||
run-shell \
|
||||
save-buffer \
|
||||
select-layout \
|
||||
select-pane \
|
||||
select-prompt \
|
||||
select-window \
|
||||
send-keys \
|
||||
send-prefix \
|
||||
server-info \
|
||||
set-buffer \
|
||||
set-environment \
|
||||
set-option \
|
||||
set-window-option \
|
||||
show-buffer \
|
||||
show-environment \
|
||||
show-messages \
|
||||
show-options \
|
||||
show-window-options \
|
||||
source-file \
|
||||
split-window \
|
||||
start-server \
|
||||
suspend-client \
|
||||
swap-pane \
|
||||
swap-window \
|
||||
switch-client \
|
||||
unbind-key \
|
||||
unlink-window \
|
||||
up-pane"
|
||||
|
||||
COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
|
||||
return 0
|
||||
|
||||
}
|
||||
complete -F _tmux tmux
|
||||
|
||||
# END tmux completion
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
# $Id: h-boetes.conf,v 1.2 2009-10-25 21:45:26 nicm Exp $
|
||||
#
|
||||
# From Han Boetes.
|
||||
|
||||
set -g default-command zsh
|
||||
set -g status-right "#(uptime|awk '{print $11}') #(date)"
|
||||
|
||||
# Statusbar properties.
|
||||
set -g display-time 3000
|
||||
set -g status-bg black
|
||||
set -g status-fg cyan
|
||||
set-window-option -g window-status-current-attr bright,reverse
|
||||
set-window-option -g window-status-current-bg cyan
|
||||
set-window-option -g window-status-current-fg black
|
||||
|
||||
# Use c-t instead of c-b as the prefix
|
||||
unbind C-b
|
||||
set -g prefix C-t
|
||||
bind C-t send-prefix
|
||||
bind t send-prefix
|
||||
|
||||
# Bind function keys.
|
||||
bind -n F1 select-window -t 1
|
||||
bind -n F2 select-window -t 2
|
||||
bind -n F3 select-window -t 3
|
||||
bind -n F4 select-window -t 4
|
||||
bind -n F5 select-window -t 5
|
||||
bind -n F6 select-window -t 6
|
||||
bind -n F7 select-window -t 7
|
||||
bind -n F8 select-window -t 8
|
||||
|
||||
# All new windows started at startup.
|
||||
new emacs
|
||||
neww irssi
|
||||
neww mutt
|
||||
neww
|
||||
neww
|
||||
neww
|
||||
neww
|
||||
neww
|
||||
|
||||
select-window -t 1
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
# $Id: n-marriott.conf,v 1.11 2009-11-24 19:03:59 nicm Exp $
|
||||
#
|
||||
# By Nicholas Marriott. Public domain.
|
||||
|
||||
# Default global options.
|
||||
set -g status-bg green
|
||||
set -g status-right "%H:%M" # %d-%b-%y
|
||||
set -g bell-action none
|
||||
set -g lock-after-time 1800
|
||||
|
||||
# Default global window options.
|
||||
setw -g remain-on-exit on
|
||||
setw -g window-status-current-attr "underscore"
|
||||
#setw -g xterm-keys on
|
||||
|
||||
# Prefix key.
|
||||
set -g prefix C-a
|
||||
unbind C-b
|
||||
bind C-a send-prefix
|
||||
|
||||
# Keys to switch session.
|
||||
bind Q switchc -t0
|
||||
bind W switchc -t1
|
||||
bind E switchc -t2
|
||||
|
||||
# Other key bindings.
|
||||
bind F1 selectw -t:10
|
||||
bind F2 selectw -t:11
|
||||
bind F3 selectw -t:12
|
||||
bind F4 selectw -t:13
|
||||
bind F5 selectw -t:14
|
||||
bind F6 selectw -t:15
|
||||
bind F7 selectw -t:16
|
||||
bind F8 selectw -t:17
|
||||
bind F9 selectw -t:18
|
||||
bind F10 selectw -t:19
|
||||
bind F11 selectw -t:20
|
||||
bind F12 selectw -t:21
|
||||
|
||||
bind m setw monitor-activity
|
||||
|
||||
bind y setw force-width 81
|
||||
bind u setw force-width 0
|
||||
|
||||
bind -n F1 run-shell 'mpc toggle >/dev/null 2>&1'
|
||||
bind -n F2 run-shell 'mpc'
|
||||
bind -n F3 run-shell 'mpc prev >/dev/null 2>&1'
|
||||
bind -n F4 run-shell 'mpc next >/dev/null 2>&1'
|
||||
bind -n F5 run-shell 'mpc volume -5 >/dev/null 2>&1'
|
||||
bind -n F6 run-shell 'mpc volume +5 >/dev/null 2>&1'
|
||||
|
||||
# Hide and show window name from status line
|
||||
bind '-' setw window-status-format '#I'\; setw window-status-current-format '#I'
|
||||
bind '+' setw window-status-format '#I:#W#F'\; setw window-status-current-format '#I:#W#F'
|
||||
|
||||
# First session.
|
||||
new -d -s0 -nirssi 'exec ssh -t natalya exec sh ~/bin/tmux-start'
|
||||
setw -t0:0 monitor-activity on
|
||||
setw -t0:0 aggressive-resize on
|
||||
set -t0 status-bg green
|
||||
neww -d -ntodo 'exec emacs ~/TODO'
|
||||
setw -t0:1 aggressive-resize on
|
||||
neww -d -ntodo2 'exec emacs ~/TODO2'
|
||||
setw -t0:2 aggressive-resize on
|
||||
neww -d -nncmpc 'exec ncmpc -f ~/.ncmpc.conf'
|
||||
setw -t0:3 aggressive-resize on
|
||||
neww -d -nmutt 'exec mutt'
|
||||
setw -t0:4 aggressive-resize on
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
|
||||
# Second session.
|
||||
new -d -s1
|
||||
set -t1 status-bg cyan
|
||||
linkw -dk -t0 -s0:0
|
||||
linkw -dk -t1 -s0:1
|
||||
linkw -dk -t2 -s0:2
|
||||
linkw -dk -t3 -s0:3
|
||||
linkw -dk -t4 -s0:4
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
|
||||
# Third session.
|
||||
new -d -s2
|
||||
set -t2 status-bg yellow
|
||||
linkw -dk -t0 -s0:0
|
||||
linkw -dk -t1 -s0:1
|
||||
linkw -dk -t2 -s0:2
|
||||
linkw -dk -t3 -s0:3
|
||||
linkw -dk -t4 -s0:4
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
neww -d
|
||||
|
|
@ -1,102 +0,0 @@
|
|||
# $Id: screen-keys.conf,v 1.7 2010-07-31 11:39:13 nicm Exp $
|
||||
#
|
||||
# By Nicholas Marriott. Public domain.
|
||||
#
|
||||
# This configuration file binds many of the common GNU screen key bindings to
|
||||
# appropriate tmux key bindings. Note that for some key bindings there is no
|
||||
# tmux analogue and also that this set omits binding some commands available in
|
||||
# tmux but not in screen.
|
||||
#
|
||||
# Note this is only a selection of key bindings and they are in addition to the
|
||||
# normal tmux key bindings. This is intended as an example not as to be used
|
||||
# as-is.
|
||||
|
||||
# Set the prefix to ^A.
|
||||
unbind C-b
|
||||
set -g prefix ^A
|
||||
bind a send-prefix
|
||||
|
||||
# Bind appropriate commands similar to screen.
|
||||
# lockscreen ^X x
|
||||
unbind ^X
|
||||
bind ^X lock-server
|
||||
unbind x
|
||||
bind x lock-server
|
||||
|
||||
# screen ^C c
|
||||
unbind ^C
|
||||
bind ^C new-window
|
||||
unbind c
|
||||
bind c new-window
|
||||
|
||||
# detach ^D d
|
||||
unbind ^D
|
||||
bind ^D detach
|
||||
|
||||
# displays *
|
||||
unbind *
|
||||
bind * list-clients
|
||||
|
||||
# next ^@ ^N sp n
|
||||
unbind ^@
|
||||
bind ^@ next-window
|
||||
unbind ^N
|
||||
bind ^N next-window
|
||||
unbind " "
|
||||
bind " " next-window
|
||||
unbind n
|
||||
bind n next-window
|
||||
|
||||
# title A
|
||||
unbind A
|
||||
bind A command-prompt "rename-window %%"
|
||||
|
||||
# other ^A
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
# prev ^H ^P p ^?
|
||||
unbind ^H
|
||||
bind ^H previous-window
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
unbind p
|
||||
bind p previous-window
|
||||
unbind BSpace
|
||||
bind BSpace previous-window
|
||||
|
||||
# windows ^W w
|
||||
unbind ^W
|
||||
bind ^W list-windows
|
||||
unbind w
|
||||
bind w list-windows
|
||||
|
||||
# quit \
|
||||
unbind '\'
|
||||
bind '\' confirm-before "kill-server"
|
||||
|
||||
# kill K k
|
||||
unbind K
|
||||
bind K confirm-before "kill-window"
|
||||
unbind k
|
||||
bind k confirm-before "kill-window"
|
||||
|
||||
# redisplay ^L l
|
||||
unbind ^L
|
||||
bind ^L refresh-client
|
||||
unbind l
|
||||
bind l refresh-client
|
||||
|
||||
# split -v |
|
||||
unbind |
|
||||
bind | split-window
|
||||
|
||||
# :kB: focus up
|
||||
unbind Tab
|
||||
bind Tab select-pane -t:.+
|
||||
unbind BTab
|
||||
bind BTab select-pane -t:.-
|
||||
|
||||
# " windowlist -b
|
||||
unbind '"'
|
||||
bind '"' choose-window
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
# $Id: t-williams.conf,v 1.1 2009-11-02 18:59:28 nicm Exp $
|
||||
#
|
||||
# ~/.tmux.conf - tmux terminal multiplexer config
|
||||
# Thayer Williams (http://cinderwick.ca)
|
||||
# "Feel free to do whatever you like with it."
|
||||
|
||||
# I typically start tmux from ~/.xinitrc with the following:
|
||||
#
|
||||
# urxvt -e bash -c "tmux attach -d -t mysession" &
|
||||
#
|
||||
# and recall it any time thereafter with xbindkeys (Mod4+s):
|
||||
#
|
||||
# "urxvt -e bash -c 'tmux attach -d -t mysession'"
|
||||
# m:0x50 + c:39
|
||||
|
||||
|
||||
# set prefix key to ctrl+a until I have time to adapt
|
||||
unbind C-b
|
||||
set -g prefix C-a
|
||||
|
||||
# send the prefix to client inside window (ala nested sessions)
|
||||
bind-key a send-prefix
|
||||
|
||||
# toggle last window like screen
|
||||
bind-key C-a last-window
|
||||
|
||||
# confirm before killing a window or the server
|
||||
bind-key k confirm kill-window
|
||||
bind-key K confirm kill-server
|
||||
|
||||
# toggle statusbar
|
||||
bind-key b set-option status
|
||||
|
||||
# ctrl+left/right cycles thru windows
|
||||
bind-key -n C-right next
|
||||
bind-key -n C-left prev
|
||||
|
||||
# open a man page in new window
|
||||
bind / command-prompt "split-window 'exec man %%'"
|
||||
|
||||
# quick view of processes
|
||||
bind '~' split-window "exec htop"
|
||||
|
||||
# scrollback buffer n lines
|
||||
set -g history-limit 5000
|
||||
|
||||
# listen for activity on all windows
|
||||
set -g bell-action any
|
||||
|
||||
# on-screen time for display-panes in ms
|
||||
set -g display-panes-time 2000
|
||||
|
||||
# start window indexing at one instead of zero
|
||||
set -g base-index 1
|
||||
|
||||
# enable wm window titles
|
||||
set -g set-titles on
|
||||
|
||||
# wm window title string (uses statusbar variables)
|
||||
set -g set-titles-string "tmux.#I.#W"
|
||||
|
||||
# session initialization
|
||||
new -s mysession mutt
|
||||
neww -t 2
|
||||
neww -d -t 3
|
||||
neww -d -t 5 mocp
|
||||
neww -d -t 6 rtorrent
|
||||
selectw -t 1
|
||||
|
||||
# statusbar --------------------------------------------------------------
|
||||
|
||||
set -g display-time 2000
|
||||
|
||||
# default statusbar colors
|
||||
set -g status-fg white
|
||||
set -g status-bg default
|
||||
set -g status-attr default
|
||||
|
||||
# default window title colors
|
||||
set-window-option -g window-status-fg cyan
|
||||
set-window-option -g window-status-bg default
|
||||
set-window-option -g window-status-attr dim
|
||||
|
||||
# active window title colors
|
||||
set-window-option -g window-status-current-fg white
|
||||
set-window-option -g window-status-current-bg default
|
||||
set-window-option -g window-status-current-attr bright
|
||||
|
||||
# command/message line colors
|
||||
set -g message-fg white
|
||||
set -g message-bg black
|
||||
set -g message-attr bright
|
||||
|
||||
# center align the window list
|
||||
set -g status-justify centre
|
||||
|
||||
# show some useful stats but only when tmux is started
|
||||
# outside of Xorg, otherwise dwm statusbar shows these already
|
||||
set -g status-right ""
|
||||
set -g status-left ""
|
||||
if '[ -z "$DISPLAY" ]' 'set -g status-left "[#[fg=green] #H #[default]]"'
|
||||
if '[ -z "$DISPLAY" ]' 'set -g status-right "[ #[fg=magenta]#(cat /proc/loadavg | cut -d \" \" -f 1,2,3)#[default] ][ #[fg=cyan,bright]%a %Y-%m-%d %H:%M #[default]]"'
|
||||
if '[ -z "$DISPLAY" ]' 'set -g status-right-length 50'
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue