mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
updated naming conventions and format based on comments
This commit is contained in:
8
plugins/tmux-autoattach/README.md
Normal file
8
plugins/tmux-autoattach/README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# tmux plugin
|
||||
|
||||
The tmux plugin will either attach or create a new tmux session for each bash session. If a session already exists, it will simply attach.
|
||||
|
||||
## OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR
|
||||
|
||||
| exit | This will completely close out your shell session, including your terminal, but keep your tmux sessions intact. This will also close your session if you detach. |
|
||||
| detach | This will allow you to detach from the tmux screen without closing the terminal or shell session. |
|
29
plugins/tmux-autoattach/tmux-autoattach.plugin.sh
Normal file
29
plugins/tmux-autoattach/tmux-autoattach.plugin.sh
Normal file
@ -0,0 +1,29 @@
|
||||
# @chopnico 2021
|
||||
#
|
||||
# tmux-autoattach.plugin.sh
|
||||
#
|
||||
# A tmux plugin that will automatically attach itself to a bash session.
|
||||
|
||||
[ -z "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" ] && export OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR="detach"
|
||||
|
||||
_osh_plugin_tmux_autoattach_exit() {
|
||||
[ -z "$TMUX" ] && tmux -2u new -A && exit
|
||||
}
|
||||
|
||||
_osh_plugin_tmux_autoattach_detach() {
|
||||
[ -z "$TMUX" ] && tmux -2u new -A
|
||||
}
|
||||
|
||||
if [ "$DISPLAY" ] || [ "$WAYLAND_DISPLAY" ]; then
|
||||
case "$OSH_PLUGIN_TMUX_AUTOATTACH_BEHAVIOR" in
|
||||
"exit")
|
||||
_osh_plugin_tmux_autoattach_exit
|
||||
;;
|
||||
"detach")
|
||||
_osh_plugin_tmux_autoattach_detach
|
||||
;;
|
||||
*)
|
||||
_osh_plugin_tmux_autoattach_detach
|
||||
;;
|
||||
esac
|
||||
fi
|
Reference in New Issue
Block a user