mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3563c3d975 | |||
| 3bfbc50918 | |||
|
|
3a8a43ccdc | ||
|
|
a9a87992df | ||
| 5f4dd92d7f | |||
|
|
bdaa272ca5 | ||
| dce4fb3ad2 | |||
|
|
6f8773133d |
@@ -216,7 +216,7 @@ example:
|
|||||||
- Setting the `TMUXIFIER_TMUX_ITERM_ATTACH` environment variable to `-CC`
|
- Setting the `TMUXIFIER_TMUX_ITERM_ATTACH` environment variable to `-CC`
|
||||||
before calling the `load-session` command.
|
before calling the `load-session` command.
|
||||||
|
|
||||||
[tmux integration]: https://code.google.com/p/iterm2/wiki/TmuxIntegration
|
[tmux integration]: https://gitlab.com/gnachman/iterm2/wikis/TmuxIntegration
|
||||||
|
|
||||||
## Inspiration
|
## Inspiration
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ new_window() {
|
|||||||
if [ -n "$2" ]; then local command=("$2"); fi
|
if [ -n "$2" ]; then local command=("$2"); fi
|
||||||
|
|
||||||
tmuxifier-tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
tmuxifier-tmux new-window -t "$session:" "${winarg[@]}" "${command[@]}"
|
||||||
|
|
||||||
|
# Disable renaming if a window name was given.
|
||||||
|
if [ -n "$1" ]; then tmuxifier-tmux set-option -t "$1" allow-rename off; fi
|
||||||
|
|
||||||
window="$(__get_current_window_index)"
|
window="$(__get_current_window_index)"
|
||||||
__go_to_window_or_session_path
|
__go_to_window_or_session_path
|
||||||
}
|
}
|
||||||
@@ -185,31 +189,39 @@ load_window() {
|
|||||||
# - $2: (optional) Override default window name.
|
# - $2: (optional) Override default window name.
|
||||||
#
|
#
|
||||||
load_session() {
|
load_session() {
|
||||||
local file="$1"
|
local file
|
||||||
if [ ! -f "$file" ]; then
|
if [ "${1#*/}" = "$1" ]; then
|
||||||
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
# There's no slash in the path.
|
||||||
fi
|
if [ -f "$TMUXIFIER_LAYOUT_PATH/$1.session.sh" ] || [ ! -f "$1" ]; then
|
||||||
|
file="$TMUXIFIER_LAYOUT_PATH/$1.session.sh"
|
||||||
if [ -f "$file" ]; then
|
|
||||||
if [ $# -gt 1 ]; then
|
|
||||||
session="$2"
|
|
||||||
else
|
else
|
||||||
session="${1/%.session.sh}"
|
# bash's 'source' requires an slash in the filename to not use $PATH.
|
||||||
session="${session/%.sh}"
|
file="./$1"
|
||||||
fi
|
|
||||||
|
|
||||||
set_default_path=true
|
|
||||||
source "$file"
|
|
||||||
session=
|
|
||||||
|
|
||||||
# Reset `$session_root`.
|
|
||||||
if [[ "$session_root" != "$HOME" ]]; then
|
|
||||||
session_root="$HOME"
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
file="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -f "$file" ]; then
|
||||||
echo "\"$1\" session layout not found." >&2
|
echo "\"$1\" session layout not found." >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $# -gt 1 ]; then
|
||||||
|
session="$2"
|
||||||
|
else
|
||||||
|
session="${1/%.session.sh}"
|
||||||
|
session="${session/%.sh}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
set_default_path=true
|
||||||
|
source "$file"
|
||||||
|
session=
|
||||||
|
|
||||||
|
# Reset `$session_root`.
|
||||||
|
if [[ "$session_root" != "$HOME" ]]; then
|
||||||
|
session_root="$HOME"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a new session, returning 0 on success, 1 on failure.
|
# Create a new session, returning 0 on success, 1 on failure.
|
||||||
|
|||||||
@@ -13,4 +13,4 @@ Outputs Tmuxifier version."
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "0.12.1"
|
echo "0.12.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user