From 94ea7a8cd41b5b0cebf2606f4319ca5050e80520 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 5 Jul 2020 21:03:38 -0400 Subject: Add some new stuff --- uleft | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 uleft (limited to 'uleft') 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 -- cgit v1.2.3