--- scripts/mytop.sh.orig	2019-02-21 02:17:39 UTC
+++ scripts/mytop.sh
@@ -114,16 +114,6 @@
 my $RM_RESET   = 0;
 my $RM_NOBLKRD = 3; ## using 4 traps Ctrl-C :-(
 
-# Add options from .my.cnf first
-
-my $my_print_defaults;
-if (!defined($my_print_defaults=my_which("my_print_defaults")))
-{
-  print "Warning: Can't find my_print_defaults. Please add it to your PATH!\n";
-  exit(1);
-}
-
-unshift @ARGV, split "\n", `$my_print_defaults client mytop`;
 
 ## Read the user's config file, if it exists.
 
@@ -142,13 +132,33 @@
 
 	    if (/(\S+)\s*=\s*(.*\S)/)
             {
-                $config{lc $1} = $2 if exists $config{lc $1};
+                my $mytop_key = $1;
+                my $mytop_val = $2;
+                if ($mytop_key =~ /batch|batchmode|color|header|idle/)
+                {
+                    unshift @ARGV, "--$mytop_key" if ($mytop_val == 1);
+                }
+                else
+                {
+                    unshift @ARGV, "--$mytop_key=$mytop_val";
+                }
             }
         }
         close CFG;
     }
 }
 
+# Add options from .my.cnf before options from ~/.mytop
+
+my $my_print_defaults;
+if (!defined($my_print_defaults=my_which("my_print_defaults")))
+{
+  print "Warning: Can't find my_print_defaults. Please add it to your PATH!\n";
+  exit(1);
+}
+
+unshift @ARGV, split "\n", `$my_print_defaults client mytop`;
+
 ## Command-line args.
 
 use vars qw($opt_foo);
