]> gitweb.michael.orlitzky.com - mutt.git/commitdiff
mutt-launcher: new launcher to fix terminal size issues.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 1 Jul 2020 22:17:26 +0000 (18:17 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 1 Jul 2020 22:17:26 +0000 (18:17 -0400)
mutt-launcher [new file with mode: 0755]

diff --git a/mutt-launcher b/mutt-launcher
new file mode 100755 (executable)
index 0000000..761595a
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# This is a wrapper around the "mutt" executable that takes the number
+# of columns and lines present in the terminal as its first and second
+# arguments. This works around an issue where launching "mutt" right
+# away in a brand-new terminal launches it before the COLUMNS and
+# LINES variables are set, and thus before "tput" knows how wide the
+# terminal is.
+#
+# You will have to manually compute the right number of columns/rows
+# by launching a terminal of your preferred size/font and then using
+# "tput cols" and "tput lines" to figure out how many columns/lines
+# it has.
+#
+if [ $# -lt 2 ]; then
+    echo "Usage: mutt-launcher <ncols> <nrows> [other-args]"
+    exit 1
+fi
+export COLUMNS="${1}"
+shift
+export LINES="${1}"
+shift
+exec mutt "${@}"