mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 09:56:39 +00:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a5bf32991 | |||
| 1f81e98e73 | |||
| 5989b1f516 | |||
| 012526656e | |||
| b2857b7df9 | |||
|
|
75ae3ba142 | ||
| c862df2d82 | |||
|
|
c06df475be | ||
| 10104b7412 | |||
| 3fa749dbf3 |
@@ -33,9 +33,10 @@ looks like:
|
||||
```bash
|
||||
window_root "~/Desktop"
|
||||
new_window "Example Window"
|
||||
tmux split-window -t "$session:$window.0" -v -p 20 "watch -t date"
|
||||
tmux split-window -t "$session:$window.1" -h -p 60
|
||||
tmux select-pane -t "$session:$window.0"
|
||||
split_v 20
|
||||
run_cmd "watch -t date"
|
||||
split_h 60
|
||||
select_pane 0
|
||||
```
|
||||
|
||||
You can then load that window layout into a new window in the
|
||||
|
||||
@@ -7,8 +7,9 @@ window_root "~/Desktop"
|
||||
new_window "Example Window"
|
||||
|
||||
# Split window into panes.
|
||||
tmux split-window -t "$session:$window.0" -v -p 20 "watch -t date"
|
||||
tmux split-window -t "$session:$window.1" -h -p 60
|
||||
split_v 20
|
||||
run_cmd "watch -t date"
|
||||
split_h 60
|
||||
|
||||
# Set active pane.
|
||||
tmux select-pane -t "$session:$window.0"
|
||||
select_pane 0
|
||||
|
||||
@@ -61,6 +61,16 @@ select_pane() {
|
||||
tmux select-pane -t "$session:$window.$1"
|
||||
}
|
||||
|
||||
# Send/paste keys to the currently active pane/window.
|
||||
#
|
||||
# Arguments:
|
||||
# - $1: String to paste.
|
||||
# - $2: (optional) Target pane ID to send input to.
|
||||
#
|
||||
send_keys() {
|
||||
tmux send-keys -t "$session:$window.$2" "$1"
|
||||
}
|
||||
|
||||
# Runs a shell command in the currently active pane/window.
|
||||
#
|
||||
# Arguments:
|
||||
@@ -68,8 +78,8 @@ select_pane() {
|
||||
# - $2: (optional) Target pane ID to run command in.
|
||||
#
|
||||
run_cmd() {
|
||||
tmux send-keys -t "$session:$window.$2" -l "$1"
|
||||
tmux send-keys -t "$session:$window.$2" "C-m"
|
||||
send_keys "$1" "$2"
|
||||
send_keys "C-m" "$2"
|
||||
}
|
||||
|
||||
# Cusomize session root path. Default is `$HOME`.
|
||||
|
||||
@@ -3,11 +3,9 @@ set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
if [ -n "$TMUX" ]; then
|
||||
for item in $(tmux list-sessions -F "#{?session_attached,1,0}:#S"); do
|
||||
if [[ "$item" == "1:"* ]]; then
|
||||
echo ${item/1:/}
|
||||
exit 0
|
||||
fi
|
||||
for item in $(tmux list-pane -F "#{session_name}");do
|
||||
echo $item
|
||||
exit 0
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
echo "0.2.1"
|
||||
echo "0.3.0"
|
||||
|
||||
@@ -14,5 +14,9 @@ new_window "{{WINDOW_NAME}}"
|
||||
#run_cmd "top" # runs in active pane
|
||||
#run_cmd "date" 1 # runs in pane 1
|
||||
|
||||
# Paste text
|
||||
#send_keys "top" # paste into active pane
|
||||
#send_keys "date" 1 # paste into active pane
|
||||
|
||||
# Set active pane.
|
||||
#select_pane 0
|
||||
|
||||
Reference in New Issue
Block a user