1
0
Fork 0
mirror of synced 2024-11-18 07:25:34 -05:00
Commit graph

309 commits

Author SHA1 Message Date
Gregory Pakosz
5f54ee9852 implemented poor man's pkill (2)
disabled SC2009

SC2009 (info): Consider using pgrep instead of grepping ps output
2023-03-05 17:26:21 +01:00
Gregory Pakosz
0f6b28e1e9 fixed SC2268 violation
SC2268 (style): Avoid x-prefix in comparisons as it no longer serves a purpose
2023-03-05 17:26:21 +01:00
Gregory Pakosz
1f5a064820 updated _username() in when the ssh client doesn't support %r in ProxyCommand (2)
disabled SC2086 violation

SC2086 (info): Double quote to prevent globbing and word splitting
2023-03-05 17:26:21 +01:00
Gregory Pakosz
3994ce38d8 fixed shellcheck SC2059 violation
SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo"
2023-03-05 17:26:21 +01:00
Gregory Pakosz
adf2e0caec fixed shellcheck SC2015 violation
SC2015 (info): Note that A && B || C is not if-then-else. C may run when A is true
2023-03-05 17:26:21 +01:00
Gregory Pakosz
28d6670bb9 reworked pane / tty introspection (3)
fixed SC2154 violation

SC2154 (warning): pane_id is referenced but not assigned
2023-03-05 17:26:21 +01:00
Gregory Pakosz
f930dbe12a updated _maximize_pane() that stopped working with tmux 3.2 (2)
fixed SC2014 violation

SC2034 (warning): current_pane_height appears unused. Verify use (or export if used externally)
2023-03-05 17:26:21 +01:00
Gregory Pakosz
f27641c846 turn off history substitution in case it's been enabled (3)
disabled SC3041 violation and fixed SC2015 violation

SC3041 (warning): In POSIX sh, set flag -H is undefined

SC2015 (info): Note that A && B || C is not if-then-else. C may run when A is true
2023-03-05 17:26:21 +01:00
Gregory Pakosz
b17d57f325 added support for configuration files in the following locations:
- ~/.tmux.conf and ~/.tmux.conf.local
- $XDG_CONFIG_HOME/tmux/tmux.conf and $XDG_CONFIG_HOME/tmux/tmux.conf.local
- ~/.config/tmux/tmux.conf and ~/.config/tmux/tmux.conf.local

location of configuration files is determined by the following environment variables:
- TMUX_CONF
- TMUX_CONF_LOCAL

the TMUX_PROGRAM environment variable contains the path to the tmux executable

resolves #200, resolves #221, resolves #439, resolves #586, resolves #624
2023-03-05 17:26:21 +01:00
Gregory Pakosz
c5f598ea86 added tmux_conf_theme that controls whether theming is enabled or disabled (2), fixes #629 2023-03-05 17:26:21 +01:00
Gregory Pakosz
f242584ba3 updated _ssh_or_mosh_args() (2), fixes #627
do not try to ignore the command if supplied

parsing the ssh command line is brittle and people sometimes pass
options after user@hostname, e.g.

ssh -p 222 user@hostname -I /usr/lib/x86_64-linux-gnu/pkcs11/opensc-pkcs11.so
2023-02-23 08:43:20 +01:00
Gregory Pakosz
537b276d74 make sure to use /usr/bin/infocmp to probe if tmux-256color is available system wide (5), fixes #626
bail out if default-terminal is already globally set to tmux-256color or tmux-direct
2023-02-22 16:26:15 +01:00
Gregory Pakosz
12f96dac7c make sure to use /usr/bin/infocmp to probe if tmux-256color is available system wide (4), fixes #619
fixed $uname_s typo
2023-01-25 09:14:47 +01:00
Gregory Pakosz
de1031a7d4 make sure to use /usr/bin/infocmp to probe if tmux-256color is available system wide (3), fixes #618
infocmp may not exist or may return a non 0 exit status which would abort _apply_configuration()
because of set -e
2023-01-23 16:19:58 +01:00
Gregory Pakosz
044d6336e8 make sure to use /usr/bin/infocmp to probe if tmux-256color is available system wide (2), fixes #617
some operating systems like NixOS don't have /usr/bin/infocmp
2023-01-22 09:55:38 +01:00
Gregory Pakosz
2cf4d9a104 make sure to use /usr/bin/infocmp to probe if tmux-256color is available system wide
on macOS, here are the steps to install tmux-256color system wide
$ $(brew --prefix ncurses)/bin/infocmp tmux-256color > /tmp/tmux-256color.info
$ /usr/bin/tic -x /tmp/tmux-256color.info

which will install tmux-256color in ~/.terminfo/74/tmux-256color

resolves #530, resolves #592, resolves #601
2023-01-09 10:39:40 +01:00
Gregory Pakosz
72f09fae75 added tmux_conf_theme that controles whether theming is enabled or disabled, resolves #536 2023-01-04 11:26:39 +01:00
Gregory Pakosz
cca37fb84e split _battery() into _battery_status() and _battery_bar() to refresh #{battery_status} more quickly (2) 2023-01-04 11:26:39 +01:00
Gregory Pakosz
5c41188a31 removed support for tmux < 2.4 2023-01-04 11:26:39 +01:00
Gregory Pakosz
5641d3b3f5 fixed custom variables detection, fixes #613 2022-11-05 19:14:00 -07:00
Gregory Pakosz
fa601ed607 bind p to paste-buffer -p to match tmux defaults, closes #610
see https://github.com/tmux/tmux/issues/2248#issuecomment-638329932
2022-10-26 09:16:42 +02:00
sarumont
ccbfdf2091 added support for wl-clipboard, closes #589, closes #606
see https://github.com/bugaevc/wl-clipboard
2022-10-22 13:44:55 +02:00
Luis Davim
562f9c128e fixed <prefix>+e not working when EDITOR is set to 'emacsclient -t' and the default shell is zsh (2), fixes #593
${EDITOR//gvim/vim} and ${EDITOR//mvim/vim} have been introduced to fix #416,
however the replace all substitution is not POSIX and is not supported by termux
or dash

the proper fix for #416 is to set EDITOR to 'gvim -f' or 'mvim -f'
2022-08-20 02:23:05 +02:00
Gregory Pakosz
5fa30deb20 fixed <prefix>+e not working when EDITOR is set to 'emacsclient -t' and the default shell is zsh, fixes #591 2022-08-18 17:21:47 +02:00
Gregory Pakosz
b620a4f0fb turn off history substitution in case it's been enabled (2), fixes #583
dash considers "set +H" is a syntax error and doesn't even evaluate the " || true" part
the workaround consists in trying "set +H" in a subshell first
2022-08-01 17:19:47 +02:00
Gregory Pakosz
68a909d4ca turn off history substitution in case it's been enabled, closes #582 2022-08-01 01:39:12 +02:00
Gregory Pakosz
18a111ff93 added a way to mark set/bind/unbind commands as important in ~/.tmux.conf.local, closes #571
inspired by css, any set/bind/unbind command ending with #!important will be
executed honored, e.g.:

bind-key -T copy-mode-vi Escape send-keys -X clear-selection #!important
2022-07-20 21:11:24 +02:00
Gregory Pakosz
e865a8a1c1 added a way to selectively disable binding manipulation, closes #514
you can set the following variables to 'disabled':
  - tmux_conf_new_window_retain_current_path
  - tmux_conf_new_pane_retain_current_path
  - tmux_conf_new_pane_reconnect_ssh
  - tmux_conf_new_session_prompt
  - tmux_conf_copy_to_os_clipboard
2022-07-14 16:50:58 +02:00
Gregory Pakosz
b69ae7c1a4 reworked pane / tty introspection (5), fixes #573 2022-06-20 22:02:25 +02:00
Gregory Pakosz
f1cc46812b added RGB 24-bit colour support automatic detection 2022-05-23 08:08:33 +02:00
Alan Oliveira
6242e4974f pass #{pane_current_path} to _fpp() and then to split-window 2022-05-23 08:08:14 +02:00
Gregory Pakosz
9a2387c0c7 added support for arguments to custom variables defined in ~/.tmux.conf.local (2), fixes #547 2022-01-14 09:11:33 +01:00
Gregory Pakosz
b3915221f8 added the '<prefix> + Shift + Tab' binding to move to the last session 2022-01-11 18:21:48 +01:00
Gregory Pakosz
05d73a54ed made tpm integration and patching more robust, fixes #540 2021-12-13 08:40:09 +01:00
Gregory Pakosz
96d085eaa7 made _apply_bindings() work with tmux 3.4 stock bindings, fixes #541 2021-12-10 16:22:28 +01:00
Gregory Pakosz
985d64c82e Revert "use send-keys -R to clear terminal and remove the sleep call", fixes #538
Instead, increase the sleep delay
2021-11-30 07:28:16 +01:00
Gregory Pakosz
a453b7fe60 use send-keys -R to clear terminal and remove the sleep call 2021-11-29 22:24:48 +01:00
Gregory Pakosz
0fe760fa6d reworked pane / tty introspection (4), fixes #535
fixed _split_window_ssh()
2021-11-19 14:07:26 +01:00
Gregory Pakosz
d471ccc068 updated _username() in when the ssh client doesn't support %r in ProxyCommand
in such a case, we use -o IdentityFile='%%username%%/%r' and parse the output of ssh -v
2021-11-16 23:33:01 +01:00
Gregory Pakosz
c6bab99f05 updated _ssh_or_mosh_args()
relaxed the regex to accommodate for renamed ssh clients and to ignore the command if supplied
2021-11-16 14:59:03 +01:00
Gregory Pakosz
1ef9b68d80 improved _pane_info() accuracy by excluding ssh proxy connections, tee, and only
considering the first child of a process

ps output is sorted by controlling terminal then pid

in case of a cmd1 | cmd2 | cmd3 pipe chain, we only consider the first child of
the parent process, which is cmd1 in the majority of cases

the rare situation when pids wrap around isn't worth additional work

on Linux
  - we sort ps output by lstart in hope precision is enough to make cmd1 always
    appear first even when pids wrap around
  - the more complex solution involves inspecting /proc/<pid>/fd/0 to filter out
    processes being piped to

finally, while lsof was promising, it won't list processes owned by other users
unless run as root
2021-11-16 14:59:03 +01:00
Gregory Pakosz
69f744117a updated tpm integration to display a message when one or more plugin(s) fails to run, closes #533 2021-11-16 14:58:30 +01:00
Gregory Pakosz
24f1222307 made background sleep process exit immediately when exiting tmux (2)
tmux < 2.8 doesn't support #{l:...}
2021-11-09 19:47:01 +01:00
Gregory Pakosz
c4220639ff worked around Falcon.app agent slowing everything down (3)
tmux < 2.8 doesn't support regex substitutions so we use basename substitution instead
2021-11-09 19:07:49 +01:00
Gregory Pakosz
2751c215a1 do not unset @tpm-install, @tpm-update, @tpm-clean and @plugin variables after tpm has launched, fixes #531 2021-11-09 19:07:19 +01:00
Gregory Pakosz
ee1547cb6c reworked pane / tty introspection (3)
fixed _pane_info() when running under Cygwin
2021-11-09 19:03:08 +01:00
Gregory Pakosz
0ad7f141dc added word boundaries when replacing uptime_xxx variables (2)
use perl instead of sead as on macOS sed doesn't support \b to match word boundaries
2021-10-31 20:55:47 +01:00
Gregory Pakosz
0da7d5c3db reworked pane / tty introspection (2)
fixed implementation and calls to _root()
2021-10-31 18:15:24 +01:00
Gregory Pakosz
1cd8ed93d3 added support for arguments to custom variables defined in ~/.tmux.conf.local 2021-10-31 18:01:15 +01:00
Gregory Pakosz
14bd87c7b2 added word boundaries when replacing uptime_xxx variables 2021-10-31 18:01:15 +01:00
Gregory Pakosz
90cdbbc32f check connectivity to github.com before installing and/or updating tpm and plugins (2) 2021-10-22 15:32:19 +02:00
Gregory Pakosz
e8032e3ffb set default-terminal to tmux-256color when available, fixes #205, fixes #382, closes #386
see https://github.com/tmux/tmux/wiki/FAQ#i-dont-see-italics-or-italics-and-reverse-are-the-wrong-way-round
2021-10-20 19:07:23 +02:00
Gregory Pakosz
a71d0d9f8d made background sleep process exit immediately when exiting tmux, fixes #509 2021-10-19 08:25:13 +02:00
Gregory Pakosz
18775e12a4 reworked pane / tty introspection, fixes #403, fixes #458
- renamed _tty_info() to _pane_info()
- pass both #{pane_pid} and #{pane_tty} to _pane_info()
- when inspecting ps output, walk down from #{pane_pid} to the child-most pid
2021-10-15 20:07:36 +02:00
Gregory Pakosz
a976b17bed worked around Falcon.app agent slowing everything down (2), fixes #522 2021-10-06 16:28:39 +02:00
Gregory Pakosz
f8a5a08868 worked around Falcon.app agent slowing everything down, fixes #492
it appears the Falcon anti-malware product for end-points slows down ps -t /dev/ttysXXX
commands 🤷

the workaround consists in passing ttysXXX instead of /dev/ttysXXX and is achieved
by removing the /dev/ prefix in #{pane_tty} expansion with the help of formats
substitutions
2021-10-03 09:43:19 +02:00
Gregory Pakosz
df46ab2ba9 fixed tpm plugins not installing on CentOS 7, fixes #520
- drop git clone --shallow-submodules as it requires git >= 2.9.0
- display a message when one of the tpm script fails
2021-10-03 09:40:48 +02:00
Gregory Pakosz
a97e3021cc updated tpm integration
- automatically delete tpm when not used
- automatically delete unused plugins
- install plugins when subsequently enabling then in ~/.tmux.conf.local
- use <prefix> + u to update plugins as <prefix> + U is bound to Urlview, fixes #507
2021-09-18 16:35:48 +02:00
Gregory Pakosz
4f332e6b17 fixed _battery_info() when pmset doesn't report a charge percentage, fixes #512 2021-08-31 11:02:45 +02:00
Gregory Pakosz
a63dc5c6a9 check connectivity to github.com before installing and/or updating tpm and plugins, fixes #513 2021-08-30 22:23:07 +02:00
Gregory Pakosz
4ef0626b6d revert "mitigate tmux displaying its "<... not ready>" message, closes #496"
this reverts commit 67b1d38a87.

the proposed mitigation causes flickering for some, see followups in #496
2021-08-19 11:51:49 +02:00
Gregory Pakosz
67b1d38a87 mitigate tmux displaying its "<... not ready>" message, closes #496
the "flickering" perceived when the "<... not ready>" message is long won't be
totally eliminated until tmux 3.3 though (commit 38c5788232e0e3abdd08ade55a9d4fbcda637df1)
2021-07-20 10:42:21 +02:00
Gregory Pakosz
1f91646af1 replaced printf '\n' calls by echo calls, fixes #479
TPM plugins further editing status-left or status-right may alter the content
in such a way that the line feed character becomes a space
2021-05-11 09:49:33 +02:00
Gregory Pakosz
760bf4fabd made _apply_bindings() work with tmux 3.2 stock bindings, fixes #472 2021-04-25 14:42:00 +02:00
Gregory Pakosz
3bfec1a25a made version detection more robust in case tmux executable is renamed (3), fixes #462
fixed a regression introduced by commit 8aefa1e798 that breaks
version detection for tmux HEAD for which 'tmux -V' prints e.g. tmux next-3.3
2021-03-18 11:54:48 +01:00
Gregory Pakosz
8aefa1e798 made version detection more robust in case tmux executable is renamed (2), fixes #457 2021-03-12 09:57:38 +01:00
Gregory Pakosz
4868ac4bd9 worked around broken /sys/class/power_supply/<supply_name>/capacity > 100, resolves #460 2021-03-07 10:13:16 +01:00
Gregory Pakosz
a752c41bca fixed copy to os clipboard on macOS when xclip or xsel is installed, fixes #459 2021-03-04 17:55:21 +01:00
Gregory Pakosz
4bf9263fbd fixed variable replacement in tmux_conf_theme_status_right and tmux_conf_theme_status_left (2), fixes #442 2021-01-11 07:54:05 +01:00
Neil Mahoney
d2b5758bdd fix left status prefix rendering 2021-01-11 07:29:24 +01:00
Gregory Pakosz
788ffd8e6f fixed variable replacement in tmux_conf_theme_status_right and tmux_conf_theme_status_left, fixes #356 2021-01-10 16:53:12 +01:00
Frederick Zhang
41af713ff7 fixed BusyBox's tr command compatibility, fixes #441 2021-01-10 09:53:23 +01:00
Gregory Pakosz
d950ee3c8c added support for tpm, resolves #61 2021-01-09 21:04:48 +01:00
Gregory Pakosz
53d7ce8311 fixed indentation in _apply_overrides() 2020-12-13 20:50:04 +01:00
Gregory Pakosz
8df1666ddc improved status line rendering, fixes #419 (3)
fixed spacers
2020-12-12 19:35:46 +01:00
Gregory Pakosz
249f0be096 fixed use of invalid 'print' command 2020-12-12 18:38:27 +01:00
Gregory Pakosz
8a4dabb196 added support for #{hostname_full} and #{hostname_full_ssh}, closes #361 2020-12-08 22:10:36 +01:00
Gregory Pakosz
e74dc67a7d improved status line rendering, fixes #419 (2)
- do not apply attr to spacers
- fixed attr for last window, window with activity and window with bell
2020-12-05 10:33:13 +01:00
Matthew Broomfield
e3960e5347 added icon for mouse mode, fixes #295
mouse icon is to the left of the battery by default.

_toggle_mouse no longer prints a status message as the status icon
should give enough information.
2020-11-24 17:33:23 +01:00
Gregory Pakosz
8c342edc6f fixed 'tmux_conf_theme_status_right' default value, fixes #422 2020-11-04 11:31:20 +01:00
Gregory Pakosz
88a10631c0 improved status line rendering, fixes #419
- non current windows now use separators when they're enabled
- fixed style for last window, window with activity and window with bell
2020-10-31 21:21:19 +01:00
Gregory Pakosz
efee3bb4ac made version detection more robust in case tmux executable is renamed 2020-10-27 22:03:08 +01:00
Gregory Pakosz
918c0f252c fixed status line that doesn't work with tmux 2.4 2020-10-27 19:34:00 +01:00
Gregory Pakosz
a43ac95e5f fixed status line that doesn't work with tmux 2.3, fixes #418 2020-10-16 11:21:11 +02:00
Gregory Pakosz
d0e073dd08 added 'tmux_conf_theme_colour_XX' variables to ease theming
closes #189, closes #224, closes #255
2020-10-10 15:54:49 +02:00
Gregory Pakosz
e03d73df73 added support for custom variables defined in ~/.tmux.conf.local (2), fixes #417 2020-10-08 09:22:41 +02:00
Gregory Pakosz
8ffeb1d809 fixed '<prefix> + e' binding when EDITOR is set to 'gvim' or 'mvim', fixes #416 2020-10-06 08:29:52 +02:00
Gregory Pakosz
13689839d4 updated _maximize_pane() that stopped working with tmux 3.2 (2), fixes #415 2020-10-03 08:29:28 +02:00
Gregory Pakosz
8e2502abb3 added support for custom variables defined in ~/.tmux.conf.local
closes #96, closes #394
2020-10-02 23:04:33 +02:00
Gregory Pakosz
bcb071152b updated _maximize_pane() that stopped working with tmux 3.2, fixes #381 2020-09-29 22:49:41 +02:00
Gregory Pakosz
a439667d65 worked around tmux not killing jobs launched with run-shell -b, fixes #407
upon exiting, tmux < 3.2 waits for jobs ran with run-shell, even those
launched with -b

the workaround consists in still launching "heavy" jobs from the status
line with #() even though it means e.g. battery information will get
updated once per attached client
2020-09-26 23:28:28 +02:00
Gregory Pakosz
fbe2eb311d fixed window-status-current-format, fixes #390, closes #333 2020-09-18 22:09:27 +02:00
Gregory Pakosz
3c09b78aa6 replaced awk by perl in _ssh_or_mosh_args() to benefit from word boundary anchors, closes #363 2020-09-18 13:36:11 +02:00
Gregory Pakosz
8976729f4f added support for explicit 'split-window' with ssh reconnect, closes #164
tmux only allows binding to existing commands, so when the command given to
'split-window' is 'ssh' and only 'ssh', the binding is converted to a call to
_split_window_ssh()
2020-09-18 13:34:10 +02:00
Joachim Werner
39cc430268 made #{uptime_xxx} work under FreeBSD 2020-09-13 14:17:09 +02:00
Joachim Werner
b4a5d06740 made #{loadavg} work under FreeBSD 2020-09-13 14:15:58 +02:00
Gregory Pakosz
3522721c69 fixed status-left and status-right theming, fixes #397 2020-09-10 12:46:52 +02:00
Gregory Pakosz
5d895f94b7 fixed _battery_info() not accommodating for empty lines, fixes #377 2020-09-02 11:20:23 +02:00
Gregory Pakosz
d357ae54ee removed useless tests in _battery_info() 2020-09-02 11:20:23 +02:00
Gregory Pakosz
a8081d87be fixed tmux_conf_new_window_retain_current_path and tmux_conf_new_pane_retain_current_path not working under Cygwin and MSYS2 2020-09-02 11:20:23 +02:00