Closed Bilge closed 5 years ago
A Quick web search indicated that for other programmes this is a tricky thing.
One does need to distinguish between "Full Screen" (The F11 thing in Internet Explorer), and simply 'Maximised' to the current screen size.
The web search indicated that (at least for more recent Win versions) it is for the user to maximise the application, and then close it at that size. Then on next re-opening it should return to that size (maybe also needing the setting you indicated). The articles/threads indicated that Windows (or the app) will remember in the registry the last window (screen) size and start at that value. [By implication, it maybe that the control is from good old basic 32-bit Windows days, XP and before ;-)]
How you managed to find any indication of how to achieve what is expected that could be programmatically achieved?
The request is simply about configuring maximized mode initially, not further intelligence.
@Bilge, did you try to add an explicit -w max
parameter to git-bash?
Otherwise, the wrapper may detect shortcut properties, using the GetStartupInfo function, and maybe pass on the desired window state to mintty via command line parameter (or STARTUPINFO again...).
Passing -w max
to git-bash causes it to close immediately after it starts (the window flashes up for but a brief moment).
@Bilge you will need to edit the resources of git-bash.exe
, using the edit-git-bash.exe
that is included in the installer (but it is removed after installing).
Or you use ResEdit
.
@dscho That doesn't seem very intuitive or user-friendly.
@Bilge I agree. What I tried to give to you is a way to test this method. And once it works, I can help you turn it into an option in the Git for Windows installer (that will be remembered across upgrades). Are you up to the challenge?
No, I'm busy. And it shouldn't be an installer option, it should work as expected with zero configuration, by respecting the shortcut specification.
On Tue, 9 Oct 2018, 15:02 Johannes Schindelin, notifications@github.com wrote:
@Bilge https://github.com/Bilge I agree. What I tried to give to you is a way to test this method. And once it works, I can help you turn it into an option in the Git for Windows installer (that will be remembered across upgrades). Are you up to the challenge?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/git-for-windows/git/issues/1865#issuecomment-428203818, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcuYthn_LBb_vpgnPMf0Jlnf20kMrB2ks5ujKxtgaJpZM4XKRkm .
@Bilge, it still needs coding though, as the mintty
response indicated. It's the old itchy and scratchy problem ;-)
No, I'm busy.
Well, I tried to help. Let us know when your situation changes.
And it shouldn't be an installer option, it should work as expected with zero configuration, by respecting the shortcut specification.
Since you know much more about this than I do (obviously!), you are in a much better position to work on this than I am.
Besides, this is open source, baby ;-)
Maybe a little rusty on JavaScript or Java v's comd
On Wed, Oct 10, 2018, 4:28 AM Johannes Schindelin notifications@github.com wrote:
No, I'm busy.
Well, I tried to help. Let us know when your situation changes.
And it shouldn't be an installer option, it should work as expected with zero configuration, by respecting the shortcut specification.
Since you know much more about this than I do (obviously!), you are in a much better position to work on this than I am.
Besides, this is open source, baby ;-)
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/git-for-windows/git/issues/1865#issuecomment-428483860, or mute the thread https://github.com/notifications/unsubscribe-auth/Ao7Bv6E3CxetaZvDiVb44XjE6AmOZ0Bkks5uja-WgaJpZM4XKRkm .
I tried to find the source of the git-bash wrapper yesterday to check if I can help out but it's well hidden in the project dungeons...
It will be in the https://github.com/git-for-windows/build-extra repository, but I haven't had a delve to find the particular location. Maybe start at the Installer directory
I tried to find the source of the git-bash wrapper yesterday to check if I can help out but it's well hidden in the project dungeons...
@mintty It is built as part of the mingw-w64-git
package:
You may try the patch below. As I don't have a git-for-windows development environment, I cannot test it myself.
--- orig/git-wrapper.c 2018-10-23 11:37:06.425924800 +0000
+++ ./git-wrapper.c 2018-10-23 12:05:20.739796000 +0000
@@ -509,6 +509,22 @@ static void initialize_top_level_path(LP
int main(void)
{
+ // retrieve ShowWindow properties
+ STARTUPINFOW sui;
+ GetStartupInfoW(&sui);
+ WORD showWindow = sui.dwFlags & STARTF_USESHOWWINDOW
+ ? sui.wShowWindow
+ : SW_SHOW;
+ // retrieve further Startup properties that could be useful
+ int invoked_with_appid = sui.dwFlags & STARTF_TITLEISAPPID;
+ int invoked_from_shortcut = sui.dwFlags & STARTF_TITLEISLINKNAME;
+ if (invoked_from_shortcut) {
+ // icon could be retrieved from sui.lpTitle
+ }
+ // optionally manipulate showWindow otherwise, e.g. from cmd parameters
+ // if (max) showWindow = SW_SHOWMAXIMIZED;
+ // if (...) showWindow = ...;
+
int r = 1, wait = 1, prefix_args_len = -1, needs_env_setup = 1,
is_git_command = 1, full_path = 1, skip_arguments = 0,
allocate_console = 0, show_console = 0,
@@ -653,7 +669,7 @@ int main(void)
}
if (show_console) {
si.dwFlags |= STARTF_USESHOWWINDOW;
- si.wShowWindow = SW_SHOW;
+ si.wShowWindow = showWindow;
}
br = CreateProcess(/* module: null means use command line */
exep,
This feature will need somebody who wants it badly enough to actually put in some effort.
I was searching for a solution, when I found this. Top answer took 30 seconds and works for me. https://stackoverflow.com/questions/33991079/git-bash-mintty-how-to-open-maximized?answertab=votes#tab-top
If you make your own wrapper anyway, you could also try the patch I suggested above, so the "max" setting would not need to be fixed but could automatically depend on the shortcut configuration.
On the other hand, if adding some parameters is all the wrapper needs to do, you could as well invoke mintty directly in the shortcut, adding those parameters, and add -w max
as you like, dropping the wrapper altogether. And git.exe will be found implicitly if you copy it into usr/bin/; don't know why it's kept separately in bin/.
Top answer took 30 seconds and works for me. https://stackoverflow.com/questions/33991079/git-bash-mintty-how-to-open-maximized?answertab=votes#tab-top
For the record, this suggests to put
Window=max
into e.g. ~/.minttyrc
.
Which sounds like a pretty painless solution, in particular given the reluctance to work with @mintty to try any patches and give feedback.
Although the operating system provides a mechanism to specify the window mode when the application starts up (normal/minimized/maximized), git-bash ignores this user preference and always starts in windowed (normal) mode.
If the user wishes to start git-bash maximized, this setting should be respected.
N.B. @mintty has confirmed this is not a mintty limitation.