mirror of
https://github.com/jimeh/tmuxifier.git
synced 2026-02-19 01:46:40 +00:00
Initial commit
This commit is contained in:
13
libexec/tmuxifier-commands
Executable file
13
libexec/tmuxifier-commands
Executable file
@@ -0,0 +1,13 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
shopt -s nullglob
|
||||
|
||||
{ for path in ${PATH//:/$'\n'}; do
|
||||
for command in "${path}/tmuxifier-"*; do
|
||||
command="${command##*tmuxifier-}"
|
||||
echo ${command##sh-}
|
||||
done
|
||||
done
|
||||
} | sort | uniq
|
||||
15
libexec/tmuxifier-completions
Executable file
15
libexec/tmuxifier-completions
Executable file
@@ -0,0 +1,15 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
command="$1"
|
||||
if [ -z "$command" ]; then
|
||||
echo "Usage: tmuxifier completions COMMAND [arg1 arg2...]" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command_path="$(command -v "tmuxifier-$command")"
|
||||
if grep -i "^# provide tmuxifier completions" "$command_path" >/dev/null; then
|
||||
shift
|
||||
exec "$command_path" --complete "$@"
|
||||
fi
|
||||
14
libexec/tmuxifier-current-session
Executable file
14
libexec/tmuxifier-current-session
Executable file
@@ -0,0 +1,14 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
if [ ! -z $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
|
||||
done
|
||||
fi
|
||||
|
||||
exit 1
|
||||
11
libexec/tmuxifier-list
Executable file
11
libexec/tmuxifier-list
Executable file
@@ -0,0 +1,11 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
echo ""
|
||||
echo "Sessions:"
|
||||
tmuxifier-list-sessions
|
||||
echo ""
|
||||
echo "Windows:"
|
||||
tmuxifier-list-windows
|
||||
echo ""
|
||||
9
libexec/tmuxifier-list-sessions
Executable file
9
libexec/tmuxifier-list-sessions
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
list=$(find "$TMUXIFIER_LAYOUT_PATH" -name "*.session.sh")
|
||||
for file in $list; do
|
||||
file=${file/$TMUXIFIER_LAYOUT_PATH\//}
|
||||
echo " ${file/.session.sh/}"
|
||||
done
|
||||
9
libexec/tmuxifier-list-windows
Executable file
9
libexec/tmuxifier-list-windows
Executable file
@@ -0,0 +1,9 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
list=$(find "$TMUXIFIER_LAYOUT_PATH" -name "*.window.sh")
|
||||
for file in $list; do
|
||||
file=${file/$TMUXIFIER_LAYOUT_PATH\//}
|
||||
echo " ${file/.window.sh/}"
|
||||
done
|
||||
16
libexec/tmuxifier-session
Executable file
16
libexec/tmuxifier-session
Executable file
@@ -0,0 +1,16 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
# Provide tmuxifier completions
|
||||
if [ "$1" == "--complete" ]; then
|
||||
for item in $(tmuxifier-list-sessions); do
|
||||
echo "$item"
|
||||
done
|
||||
exit
|
||||
fi
|
||||
|
||||
# Load runtime functions.
|
||||
source "$TMUXIFIER/runtime.sh"
|
||||
|
||||
load_session "$1"
|
||||
22
libexec/tmuxifier-window
Executable file
22
libexec/tmuxifier-window
Executable file
@@ -0,0 +1,22 @@
|
||||
#! /usr/bin/env bash
|
||||
set -e
|
||||
[ -n "$TMUXIFIER_DEBUG" ] && set -x
|
||||
|
||||
# Provide tmuxifier completions
|
||||
if [ "$1" == "--complete" ]; then
|
||||
for item in $(tmuxifier-list-windows); do
|
||||
echo "$item"
|
||||
done
|
||||
exit
|
||||
fi
|
||||
|
||||
# Load runtime functions.
|
||||
source "$TMUXIFIER/runtime.sh"
|
||||
|
||||
if [ ! -z $TMUX ]; then
|
||||
session="$(tmuxifier-current-session)"
|
||||
load_window "$1"
|
||||
else
|
||||
echo "ERROR: 'window' command can only be used from within Tmux."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user