aboutsummaryrefslogtreecommitdiff
path: root/uleft
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-07-05 21:03:38 -0400
committerB. Watson <yalhcru@gmail.com>2020-07-05 21:03:38 -0400
commit94ea7a8cd41b5b0cebf2606f4319ca5050e80520 (patch)
tree703f962eb3713871172e766565e4fa35b599b800 /uleft
parent135b6988a809f22a633d9a90273cd6447cfa85be (diff)
downloadmisc-scripts-94ea7a8cd41b5b0cebf2606f4319ca5050e80520.tar.gz
Add some new stuff
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