Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git bash (mintty). How to open maximized

Tags:

git

git-bash

I updated git for windows and found that it now has mintty as the command prompt for git bash. It is much better than previous windows command prompt based git bash.

It would be great if I could open the git bash initially maximized. There is a command line argument for mintty to open maximized.

-w, --window normal|min|max|full

But, I don't know how I can pass this argument to mintty when I open git bash from 'Open git bash here' context menu.

Does anyone know how to get this done?

like image 839
Lahiru Chandima Avatar asked Nov 30 '15 03:11

Lahiru Chandima


People also ask

How to open mintty?

Once you've finished installing it, you should be able to go to Start > All Programs > Cygwin > mintty to launch it.

What is mintty shell?

Mintty is a terminal emulator for Cygwin with a native Windows user interface and minimalist design. Its terminal emulation is largely compatible with xterm, but it does not require an X server.

Where is Mintty config file?

config/mintty folder is the XDG default base directory. The $APPDATA/mintty folder is especially useful to share common configuration for various installations of mintty (e.g. cygwin 32/64 Bit, MSYS, Git Bash).


2 Answers

You may put an minttyrc file into etc folder of Git install (like C:\Program Files\Git\etc), with the following config:

Window=max

If you change your mind and want to set a specific window size you can alternatively put the number of columns and rows into minttyrc, for example:

Columns=132
Rows=60

btw, based on https://github.com/mintty/mintty/blob/7d70b3cb9776de288375ffe438d35e648650c98f/wiki/Tips.md, we may have several locations:

For its configuration file, it reads /etc/minttyrc, $APPDATA/mintty/config, ~/.config/mintty/config, ~/.minttyrc, in this order.

like image 175
socrates Avatar answered Oct 03 '22 04:10

socrates


This is kind of a hack, but I got it working by replacing git-bash.exe with my own one which gives -w max additional argument.

Here is the code for git-bash.exe.

#include "stdafx.h"
#include <stdlib.h>

int _tmain(int argc, _TCHAR* argv[])
{
    system("START /B D:\\program_files\\git\\Git\\usr\\bin\\mintty.exe -w max -o AppID=GitForWindows.Bash -o RelaunchCommand=\"D:\\program_files\\git\\Git\\git-bash.exe\" -o RelaunchDisplayName=\"Git Bash\" -i /mingw64/share/git/git-for-windows.ico /usr/bin/bash --login -i");
    return 0;
}

You have to change paths in above code to your own values if you need to build your own git-bash.exe from above code.

EDIT: If mintty is started with above code, it does not know the location of git binary. So I had to add the git bin directory to PATH variable.

like image 23
Lahiru Chandima Avatar answered Oct 03 '22 04:10

Lahiru Chandima