mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 03:14:55 +02:00
scripts/tmuxs/list-sessions.sh: improve command with sorting and showing session id
This commit is contained in:
parent
75fbfbc6e0
commit
5b67d85598
1 changed files with 6 additions and 5 deletions
|
|
@ -1,11 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
OPTS="list-sessions -F #{session_name}"
|
||||
# include session_activity to use for sorting
|
||||
OPTS="list-sessions -F #{session_activity},#{session_id},#{session_name}"
|
||||
|
||||
## If we are inside tmux already, don't list active sessions
|
||||
if [[ ! -z $TMUX ]]; then
|
||||
OPTS="${OPTS} -f #{==:#{session_attached},0}"
|
||||
fi
|
||||
# if [[ ! -z $TMUX ]]; then
|
||||
# OPTS="${OPTS} -f #{==:#{session_attached},0}"
|
||||
# fi
|
||||
|
||||
tmux ${OPTS}
|
||||
tmux ${OPTS} | sort -nr | cut -d, -f2,3 | sed -r 's/^\$([[:digit:]]+),/\1: /'
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue