aboutsummaryrefslogtreecommitdiff
path: root/wscreen
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-09-18 16:36:52 -0300
committerSilvio Rhatto <user@example.org>2014-09-18 16:36:52 -0300
commit6acb9754f95be9713f09bbac00dc08d31c465a21 (patch)
tree70b1448cbe5f193e49d6754cf89e9bf5c46e48be /wscreen
downloadtermplex-6acb9754f95be9713f09bbac00dc08d31c465a21.tar.gz
termplex-6acb9754f95be9713f09bbac00dc08d31c465a21.tar.bz2
Initial import
Diffstat (limited to 'wscreen')
-rwxr-xr-xwscreen39
1 files changed, 39 insertions, 0 deletions
diff --git a/wscreen b/wscreen
new file mode 100755
index 0000000..f4a1f4c
--- /dev/null
+++ b/wscreen
@@ -0,0 +1,39 @@
+#
+# Workscreen: screen session wrapper
+#
+# Alternative:
+# http://byobu.co
+# http://packages.debian.org/stable/byobu
+#
+
+# Default options.
+opts="-c /etc/screenrc"
+
+# Remove dead screens.
+screen -wipe &> /dev/null
+
+# Session selection.
+if [ ! -z "$1" ]; then
+ if screen -ls $1 | grep -q "There is a screen on"; then
+ #echo "There's already a screen called $1"
+ #exit 1
+ screen -x $1
+ exit $?
+ else
+ session="-S $1"
+ fi
+
+ if [ "$1" == "main" ]; then
+ opts=""
+ elif [ "$1" == "root" ]; then
+ sudo screen -x
+ exit
+ elif [ -f "$HOME/.screen/$1" ]; then
+ opts="-c $HOME/.screen/$1"
+ elif [ -f "$HOME/.screen/base" ]; then
+ opts="-c $HOME/.screen/base"
+ fi
+fi
+
+# Start session.
+screen $opts $session