aboutsummaryrefslogtreecommitdiff
path: root/uleft
blob: eac38563b80aadab6c158f3d54d19d4e93cb6ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/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.

# Deja Vu Sans Mono with intel or nouveau:
#GLEFT="96x53+0+0"
#GRIGHT="88x53+968+0"
#GFULL="185x53+0+0"

# Deja Vu Sans Mono with nvidia:
#GLEFT="87x54+0+0"
#GRIGHT="80x54+968+0"
#GFULL="167x54+0+0"

# JetBrains Mono NL with nvidia:
#GLEFT="104x49+0+0"
#GRIGHT="80x49+1050+0"
#GFULL="185x49+0+0"

# JetBrains Mono NL with nvidia, multihead
#GLEFT="104x51+1280+0"
#GRIGHT="101x51+2222+0"
#GFULL="205x51-71+0"
GLEFT="101x49+1280+0"
GRIGHT="90x49+2295+0"
GFULL="191x49+1280+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