aboutsummaryrefslogtreecommitdiff
path: root/wscreen
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-01-13 15:37:49 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-01-13 15:37:49 -0200
commit454c6e3c77b3db507ee81875219089047fc2d5a3 (patch)
tree34ea351902ddd6094bc0a96a65b4bc07e9ee83d8 /wscreen
downloadscripts-454c6e3c77b3db507ee81875219089047fc2d5a3.tar.gz
scripts-454c6e3c77b3db507ee81875219089047fc2d5a3.tar.bz2
Initial import
Diffstat (limited to 'wscreen')
-rwxr-xr-xwscreen30
1 files changed, 30 insertions, 0 deletions
diff --git a/wscreen b/wscreen
new file mode 100755
index 0000000..77afa03
--- /dev/null
+++ b/wscreen
@@ -0,0 +1,30 @@
+#
+# Workscreen: screen session wrapper.
+#
+
+# 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 [ -f "$HOME/.screen/$1" ]; then
+ opts="-c $HOME/.screen/$1"
+ fi
+fi
+
+# Start session.
+screen $opts $session