I need to have a couple of bashes open pointing to different repos.
I'd like to have them with different background colours so it's less confusing to see.
I assume that the colour options aren't specific to the Git Bash as the Windows Command Prompt has the same options in the properties window.
I know that the OS or whatever must be storing these somewhere, as they are persisted between sessions.
Does anyone know how to achieve this?
press alt+spacebar or click on the git bash window's icon on top left, select "properties" then choose the tab "colors" and select the desired color
I'm not sure that there's a way to pass this on to the shell instance's host cmd window when you start, but you can definitely wrap your existing call in a customized window: make a shortcut to cmd and then pass it the color option as well as a command - in this case, to start the shell process.
Would look like this in the shortcut's Target properties: %windir%\system32\cmd.exe /T:24 c:\path\to\msysgit\sh.exe (or path to your current shortcut, since there will maybe be flags or options used there).
On Windows environment you can use color command. It changes font and background color simultaneously.
What you need to is to run color command before running sh.exe. Start cmd.exe and type:
color EA
"c:\Program Files\Git\bin\sh.exe"
This example makes windows terminal green-yellow.
Run color /? and sh.exe --help for more.
Related
I am rocking a Ubuntu 22.04 laptop, so I am stuck to SageMath v9.5, instead of the current version as of today. The font is currently blue, which is not the best match at all with the default purple terminal background. How could I change the color to, let's say, green?
I've tried something in this link, but the approach is so old, it doesn't apply to this version anymore. I can type %colors Linux at the Sage shell itself, but it resets whenever I log off.
You can change the font colour of the terminal by modifying the Sage Terminal profile in the terminal's preferences.
Open the terminal in SageMath.
Go to Edit > Profile Preferences.
In the Profile Preferences window, select the Colours tab.
4.Under Text colour, you can use the colour picker to select a new font colour for the terminal.
5.Click Close to apply the changes and close the window.
I've tried something in this link, but the approach is so old, it
doesn't apply to this version anymore. I can type %colors Linux at the
Sage shell itself, but it resets whenever I log off.
You have to save the command %colors Linux into init.sage file which will be save at location ~/.sage/init.sage you can flow the below steps to achieve this
Open the Terminal by pressing keys Ctrl+Alt+T or from all programs
Go to ~/.sage directory by using cd ~/.sage command
Enter touch init.sage to create a file by the name init.sage
Open the file with an editor like vim/nano etc
Now write the command %colors Linux and save the file and close it
New font color will not change after restarting sage
So, now I have many open apps, often 3-4 powershell consoles. I'm able to order the powershell windows to watch them together (top left, top right, bottom left, bottom right).
So this means that if I switch to another app, when I switch back I have to restore all multiple powershell windows to see them all again.
What I want is, to create only one 'shared window' for many powershell, because when I need one, I need all of them to see.
Is there a way to do this?
Just to add more details about Windows Terminal approach:
Open a Windows Terminal
Type Alt+Shift+= or Alt+Shift+- to open a new Pane in the same tab
Type Shift+Ctrl+W to close the current Pane
If you need more details or modify the settings, go to next page Panes in Windows Terminal
ConEmu has this option.
You can also configure it to open as much consoles as you want when it starts.
ConEmu website
Enjoy!
VSCode can have Multiple Terminals which is the closest to this I've seen, quoted from documentaion:
You can create multiple terminals open to different locations and easily navigate between them. Terminal instances can be added by hitting the plus icon on the top-right of the TERMINAL panel or by triggering the Ctrl+Shift+` command. This creates another entry in the dropdown list that can be used to switch between them.
You can also split the terminal by triggering the Ctrl+\ command or via the right click context menu
Windows now provides the Windows Terminal.
Windows Terminal can split the terminal into panes and can also run different shells (i.e. cmd, powershell, and bash through the wsl)
You can install Windows Terminal directly from the Windows Store.
Create a virtual machine where you can run your PowerShell sessions uninterrupted. The PowerShell windows are always where I placed them when I come back.
It could be an expensive solution depending on your needs, but I have been doing this a long time. It's a robust solution since the only user processes on the VM are my PowerShell sessions.
I would like to set the background color of my whole terminal. google didn't help.
The idea is to have it set to red when working in a prod context and black when in dev context.
Ideally would like to do it using the .bash_profile file where I have code to switch environment context.
Console colors are stored in the registry under HKCU/Console/[window name]/ColorTable00-15.
[window name] is either "Git Bash" for the start menu entry or something like "C:_Program Files (x86)_Git_git-cheetah_.._bin_sh.exe" for the Windows Explorer context menu entry (supplied by Git-Cheetah).
Alternatively, the registry settings can be overridden by storing an NT_CONSOLE_PROPS structure with appropriate ColorTable settings in the "Git Bash.lnk" shortcut via IShellLinkDataList::AddDataBlock. This happens e.g. if you edit the properties of a console window started via shortcut, or if you edit the shortcut properties directly.
If you want the values from the registry instead, create a new "Git Bash.lnk" shortcut from scratch and leave the Options/Font/Layout/Colors tabs alone.
It seems the only way I can see so far is to manually edit the boxes from the properties window, but this is buggy and tedious - you can't use hex strings, and selecting the color to inspect it sometimes alters the color wildly.
enter image description here
I have Windows 7, Windows 8 and Windows 10 systems and they all behave similarly.
When I type command prompt into the start menu and press enter, a window titled Command Prompt appears. I gave it a blue background and a green text. When I type start, cmd, or the name of a bat file into the command line, it opens up a window titled cmd, which I gave a background of black and a green text. It seems the colors get stored but... hmm...
When I type cmd into the start menu of Windows 10, a Window titled "cmd" appears, but it recalls the blue background and green text from the Command Prompt window, but typing cmd from that window opens a new one styled black and green. When I double click a batch file, it opens up a window titled command prompt with a different font face and a black background with white text. When I type command it just prints the DOS and copyright headers, but start command opens up a window titled COMMAND.COM with the different font face and the black background with white text.
When type cmd /? into a list of parameters appears in on the screen. One of them is /Q. It says it turns echo off in the new instance. When I type cmd /Q in either command prompt or cmd, it replaces the window with another using the same title but the black and green color scheme, and does NOT turn off echo. When I type start cmd /q, exactly the same thing occurs, but 'start cmd.exe /q' actually produces an error stating that /Q isn't a valid switch.
This really is only a fraction of the problem I'm facing here, and I can't even begin to start sorting it out. If some veteran out there who knows all the subtle differences between the apparent grove of command prompts, and ways of calling them, I'd appreciate that person sorting that mess out for me.
I will try to clear up some of the confusion, but I cannot do a perfect job, because Microsoft has made sure to make the mess impossible to completely untangle, and they change the mess with every version of windows. So, for example, some of the information I am about to provide might not apply to Windows 8 and Windows 10. But it did apply up until and including Windows 7.
"Command Prompt" is the formal name of the console application under windows. "cmd.exe" (or just "cmd") is the name of the executable binary file of that same application.
Windows stores the default settings for the command prompt in the registry, under HKEY_CURRENT_USER\Console. When a new command prompt opens, windows takes the window title of that command prompt, and tries to see whether there is a subkey under HKEY_CURRENT_USER\Console\ with that name. If it finds a subkey, it reads the values from it. If it does not find a subkey, it reads the default values it finds in HKEY_CURRENT_USER\Console.
For example, on my system, there exists a HKEY_CURRENT_USER\Console\MySQL 5.6 Command Line Client - Unicode key, most probably because the MySQL installer created this key so that their command prompt looks different from other instances of the command prompt. Of course, in order for this to work, the shortcut which starts their command prompt must specify "MySQL 5.6 Command Line Client - Unicode" as the window title of the command prompt.
So, if you are seeing command prompts with different styling, that's probably because you have entries under HKEY_CURRENT_USER\Console\. And the fact that it does not appear to make any sense is due to the fact that the subkey selected depends on the title of the command prompt window, which may differ depending on how you start it.
Command Prompt is simply a shortcut to cmd.exe named "Command Prompt":
The styling is just a result of the shortcut having its own properties. You could also have other shortcuts to cmd.exe and each of those could have their own style options as well.
As for the window title, cmd just sets the window title to the file name that launched cmd. If you create a shortcut to cmd.exe and call it "my_shell". You will get a cmd window titled "my_shell".
The system beep/bell happens frequently (ie, when I type a few letters then type tab to autocomplete when there are a few options).
How can I turn this off?
I googled it and tried:
set bell-style none (the command went through but nothing changed)
and
setterm -blength 0 (got a bash command not found)
Thanks!
Add set bell-style none to .inputrc in your home directory. You need to start a new shell for this to take effect; that may be why your test didn't work.
The default terminal mintty has built-in options to control the terminal bell.
Right-click on the background and click "Options..."
Select the "Terminal" section.
Change the "Bell" dropdown to "none"
Note: Here you can also enable or disable the visible bell (terminal flashing) and to highlight the taskbar icon on a bell ring.
Cut the wire to your speaker. :-)
An alternative solution that doesn't seem to be mentioned here is:
Right click on the header of the Cygwin window and chose Options...:
In the options menu, under the Terminal tab, choose "no beep":
This should take effect immediately without having to restart Cygwin.
I experienced a series of beeps when I would cat a particular file. The above tips did not silence the bell. In my case, the beeps were due to bullet points that had been copy/pasted into the file. Replacing the bullets with dashes stopped the beeping.
Use mintty. Among many other advantages over the usual console, the bell is off by default.
Path to '.inputrc:
'C:\cygwin64\home\<username>\.inputrc