-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename the dump helper and add functions to dump windows
- Loading branch information
1 parent
b4bc7a5
commit a4f046c
Showing
4 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
# Dump the list of tmux windows using the following | ||
# three components separated by a tab character `\t`: | ||
# - Session name | ||
# - Window name | ||
# - Window working directory path | ||
# | ||
# Caveat: Window panes are ignored. | ||
function __tsm::helpers::dump() { | ||
# FIXME: Fail if tmux is not running | ||
# TODO: Find a way to dump all panes including enough info to be able to restore them | ||
# Dump the list of tmux panes | ||
function __tsm::helpers::dump_panes() { | ||
command tmux list-panes -a -F "${__tsm_tmux_formats[pane]}" | ||
} | ||
|
||
# Dump the list of tmux panes prefixed with the list type (pane) | ||
function __tsm::helpers::dump_panes::annotated() { | ||
command tmux list-panes -a -F "pane${__tsm_tmux_delimiter}${__tsm_tmux_formats[pane]}" | ||
} | ||
|
||
# Dump the list of tmux windows | ||
function __tsm::helpers::dump_windows() { | ||
command tmux list-windows -a -F "${__tsm_tmux_formats[window]}" | ||
} | ||
|
||
# Dump the list of tmux windows prefixed with the list type (window) | ||
function __tsm::helpers::dump_windows::annotated() { | ||
command tmux list-windows -a -F "window${__tsm_tmux_delimiter}${__tsm_tmux_formats[window]}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
function __tsm::helpers::get_active_window_index() { | ||
command tmux list-windows -t "$1" -F "#{window_flags} #{window_index}" \ | ||
| command awk '$1 ~ /\*/ { print $2; }' | ||
} | ||
|
||
function __tsm::helpers::get_alternate_window_index() { | ||
command tmux list-windows -t "$1" -F "#{window_flags} #{window_index}" \ | ||
| command awk '$1 ~ /-/ { print $2; }' | ||
} |