aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2020-08-22 15:09:09 -0300
committerSilvio Rhatto <rhatto@riseup.net>2020-08-22 15:09:09 -0300
commit1079df752f29d1af0501c1b6fdd36cb477189c0c (patch)
tree81481df4bcf6c428ffa93db4b07599372ac6e6c9
parent17dd4d169708d0321c2dc70c39d21da257c50857 (diff)
downloadutils-x11-1079df752f29d1af0501c1b6fdd36cb477189c0c.tar.gz
utils-x11-1079df752f29d1af0501c1b6fdd36cb477189c0c.tar.bz2
Feat: support for selecting only some programs in a session
-rwxr-xr-xsession24
1 files changed, 20 insertions, 4 deletions
diff --git a/session b/session
index 3cca7a2..fdb4750 100755
--- a/session
+++ b/session
@@ -25,6 +25,14 @@ function __session_not_ignored {
return 1
fi
+ if [ ! -z "$UNIGNORE" ]; then
+ if [ "$UNIGNORE" == "$1" ]; then
+ return 0
+ else
+ return 1
+ fi
+ fi
+
return 0
}
@@ -143,11 +151,14 @@ function __session_chooser {
__session_list
read -rep "Choose session: " n
- if [ ! -z "$n" ]; then
- session="$(__session_list | grep -E "(^$n.| $n:)" | sed -e "s/^[0-9]*. //" | cut -d : -f 1)"
+ local name="`echo $n | awk '{ print $1 }'`"
+ local program="`echo $n | awk '{ print $2 }'`"
+
+ if [ ! -z "$name" ]; then
+ session="$(__session_list | grep -E "(^$name.| $name:)" | sed -e "s/^[0-9]*. //" | cut -d : -f 1)"
if [ ! -z "$session" ]; then
- __session_open $session
+ __session_open $session $program
fi
fi
}
@@ -169,6 +180,11 @@ function __session_exec {
# Open a session
function __session_open {
local session="$1"
+ local program="$2"
+
+ if [ ! -z "$program" ]; then
+ UNIGNORE="$program"
+ fi
# Custom
if __session_not_ignored custom && [ -e "$CUSTOM/$session" ]; then
@@ -239,7 +255,7 @@ elif [ ! -z "$1" ] && echo "$1" | grep -q -- '--list'; then
elif [ ! -z "$1" ] && echo "$1" | grep -q -- '--chooser'; then
__session_chooser
elif [ -z "$1" ]; then
- echo "usage: $BASENAME [--list|--chooser] <session>"
+ echo "usage: $BASENAME [--list|--chooser] <session> <program>"
echo "available sessions:"
echo ""
__session_list