aboutsummaryrefslogtreecommitdiff
path: root/uleft
diff options
context:
space:
mode:
Diffstat (limited to 'uleft')
-rwxr-xr-xuleft41
1 files changed, 41 insertions, 0 deletions
diff --git a/uleft b/uleft
new file mode 100755
index 0000000..0efe972
--- /dev/null
+++ b/uleft
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+# uleft, uright, ukill, ufull, unext - start & kill urxvt with
+# preferred geometry. the terminals persist when their shells exit
+# (they just start a new one).
+
+# any arguments passed to this script are passed thru to urxvt.
+
+GLEFT="96x53+0+0"
+GRIGHT="88x53+968+0"
+GFULL="185x53+0+0"
+
+murder_shell() {
+ # kill the shell that called the shell that's running this script
+ kill $( ps -o ppid --no-headers $( ps -o ppid --no-headers $$ ) )
+ exit 0
+}
+
+get_next_geom() {
+ # lets this script alternate between starting left and right terminals
+ if [ ! -e ~/.uleftright ] || grep -q right ~/.uleftright; then
+ G=$GLEFT
+ echo left > ~/.uleftright
+ else
+ G=$GRIGHT
+ echo right > ~/.uleftright
+ fi
+
+ echo "$G"
+}
+
+case "$0" in
+ *kill*) murder_shell ;;
+ *left*) G=$GLEFT ;;
+ *full*) G=$GFULL ;;
+ *next*) G=$( get_next_geom ) ;;
+ *) G=$GRIGHT ;;
+esac
+
+urxvt -g "$G" "$@" -e sh -c "while true; do bash -login; done" &>/dev/null &
+disown