]> gitweb.fluxo.info Git - wrappers.git/commitdiff
Adds mc wrapper
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 16 Jun 2018 11:57:11 +0000 (08:57 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 16 Jun 2018 11:57:11 +0000 (08:57 -0300)
mc [new file with mode: 0755]

diff --git a/mc b/mc
new file mode 100755 (executable)
index 0000000..9079704
--- /dev/null
+++ b/mc
@@ -0,0 +1,28 @@
+#!/bin/bash
+#
+# Wrapper for Midnight Commander
+#
+
+# Parameters
+BASENAME="`basename $0`"
+MC="/usr/bin/mc"
+INI="$HOME/.config/mc/ini"
+CONF="`readlink $INI || echo $INI`"
+
+# Dispatch
+if [ ! -z "$DISPLAY" ]; then
+  TERM=xterm-256color $MC $*
+else
+  $MC $*
+fi
+
+# Fix configuration
+#
+# These settings vary from screen size to screen size and
+# might change mc's dotfiles whenever it's run on a different
+# screen configuration.
+#
+# If $INI is a link, $CONF will be the link destination.
+# That's important because `sed -i` usually breaks the linking.
+sed -i '/^left_panel_size=.*$/d' $CONF
+sed -i '/^top_panel_size=.*$/d'  $CONF