Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't figure out how to appy that to windows10 ubuntu bash #20

Open
KwanWaiChung opened this issue Apr 8, 2017 · 22 comments
Open

Can't figure out how to appy that to windows10 ubuntu bash #20

KwanWaiChung opened this issue Apr 8, 2017 · 22 comments

Comments

@KwanWaiChung
Copy link

I don't know how to apply

" Copy the Set-Solarized*ColorDefaults.ps1 files to your profile directory, likely ~\Documents\WindowsPowerShell. Then add the following line of code to the end of your Microsoft.PowerShell_profile.ps1 or profile.ps1:"

to the windows 10 ubuntu bash, i tried to add that to the .bash_profile and .bashrc, but it can't recognize the line..

@kshitijdeota
Copy link

Can't figure out to apply over anything on Windows 10 Build 15063.13

@andyleejordan
Copy link

andyleejordan commented Apr 13, 2017

Same. I have it all installed, I verified the script is being sourced (I also tried sourcing it directly). No colors are changing.

Edit: maybe some colors are changing. Kind of looks like the text background changed to black. But the theme is definitely not applying.

Windows build 15063.rs2_release.170317-1834.

@andy-liu-9711
Copy link

The theme cannot be applied to Windows 10 build 15063.138

@andy-liu-9711
Copy link

Finally figured out how to make it work. The registry key should be set as HKEY_CURRENT_USER\Console%SystemRoot%_System32_bash.exe or HKEY_CURRENT_USER\Console%SystemRoot%_system32_cmd.exe instead of HKEY_CURRENT_USER\Console in the *.reg files. Also the command prompt or bash should be started via win + r instead of win + s, and then the theme configuration could be loaded successfully.

@mxtopher
Copy link

Thanks @andy-liu-9711 . As you said, it only works if I spawn bash with win-r. Why does it matter if I run it from win-r, win-s or win?

@OliverMartini
Copy link

OliverMartini commented Apr 20, 2017

@mxtopher when you run win-s it will use the shortcut to open the application. with win-r you run the command.

To get Bash on Ubuntu on Windows to use the correct color scheme you have to re-create the Shortcut. A shortcut seems to save the color setting in the shortcut. It does not respect the settings from the registry.

  • Target: C:\Windows\System32\bash.exe ~
  • Icon Location: %USERPROFILE%\AppData\Local\lxss\bash.ico

Besides of recreating the shortcuts you also have to add the registry key suggested by @andy-liu-9711
[HKEY_CURRENT_USER\Console%SystemRoot%_System32_bash.exe]

@spiedeman
Copy link

@OliverMartini may I ask how to create a shortcut with the color setting in it?

@OliverMartini
Copy link

@spiedeman; At the time a Windows Shortcut is created, the then current color settings are used.
Therefore the shortcuts for Windows PowerShell, Bash on Ubuntu on Windows, etc. which were created at install time, still use the "old" color settings.

After you applied the new color settings, simply remove/delete the shortcuts form the Windows Start Menu and recreated them.

e.g. Replace Windows PowerShell shortcut

  1. Open Windows Explorer
  2. Navigate to %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Windows PowerShell
  3. Delete Windows PowerShell shortcut
  4. Right click and choose "New > Shortcut" from context menu
  5. Use "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", and click Next
  6. Name it "Windows PowerShell" and click Finish.

These are the steps to recreate the shortcuts to use the new color profiles. Do the same for Ubuntu Bash, Cmd Prompt, etc. shortcuts.

@ajb3ck
Copy link

ajb3ck commented May 10, 2017

@andy-liu-9711 it looks like github markdown may be causing the registry key location to not render correctly.. what is shown is missing a backslash. The full locations I found to work are:

HKEY_CURRENT_USER\Console\%SystemRoot%_system32_bash.exe
HKEY_CURRENT_USER\Console\%SystemRoot%_system32_cmd.exe

@rbeesley
Copy link
Collaborator

If we take the change with #19, it should resolve this. The shortcut link is what dictates the color scheme and the change provides a way to easily apply different color schemes to a .lnk file.

neilpa added a commit that referenced this issue Jun 27, 2017
Update-Link mega PR: Update to PR #22, closes issues #18, #19, #20
@StephaneKazmierczak
Copy link

StephaneKazmierczak commented Jun 28, 2017

Thank you for the theme it is so much nicer, currently on bash with the dark theme; the folders are highlight with a gray box, is there a way to remove the highlight box and just use a different color font instead ?
Also it seems to apply to the default user and not root under bash

@rbeesley
Copy link
Collaborator

@StephaneKazmierczak, you will still probably want to apply the Solarized .dir_colors to match. Right now I'm using dircolors.256dark from seebi/dircolors-solarized. Clone the dircolors-solarized project then link ~/.dir_colors to the appropriate dircolors theme. Then in your ~/.bashrc run this: eval "$(dircolors -b ~/.dir_colors)". This will give you a Solarized bash instance.

Each user needs to apply this though, so if you su root, you will get the same thing you see now.

The dircolors.256dark theme takes advantage of the increased color capability of the improved console. So it is what I recommend. I also then created my own prompt based off some .bash_prompt which was "Heavily inspired by @necolas's prompt".

I just source this at the end of my ~/.bashrc by executing: . ~/.bash_prompt.

@StephaneKazmierczak
Copy link

I remember having done that successfully while i was still using a full linux os,
Now I just follow the configuration you gave on my windows10/ubuntu hybrid and there was no effect, is there an additional step ?

@rbeesley
Copy link
Collaborator

No, I can't think of anything. Do you see 256 colors when you run this script?

@StephaneKazmierczak
Copy link

the script failed :-en \e[38;5;{0..256}m {0..256} \e[0m
script_color.sh: 14: script_color.sh: arithmetic expression: expecting primary: "({0..256} + 1) % 10"

@Thynix
Copy link

Thynix commented Jul 27, 2017

@StephaneKazmierczak How are you launching Bash? If you're using the Bash shortcut that existed before you applied the registry file, try launching "bash" directly from Run / Windows + R.

What shell are you using? I can't reproduce that script failing.

@StephaneKazmierczak
Copy link

StephaneKazmierczak commented Jul 28, 2017

@Thynix I found that the {} in the for loop is not working in the windows bash
bash version is 4.3.48(1)

@StephaneKazmierczak
Copy link

I used sh command that was my problem, now I can see the colors and numbers

@spiedeman
Copy link

does anyone know how to save the font setting for bash on windows 10?

@StephaneKazmierczak
Copy link

StephaneKazmierczak commented Aug 10, 2017

Also I found that coloring of the folder work on remote machine without any config
when I ssh on my server the shell get the right color for folder and not highlight
also using shortcut or from the run> bash.exe get me the same results

@persep
Copy link

persep commented Feb 18, 2018

@StephaneKazmierczak Did you manage to fix the highlighting of the folder names?

I'll answer myself.: @rbeesley solution above fixes the folder names color.

@ajostergaard
Copy link

C:\repos\cmd-colors-solarized>regedit solarized-dark.reg worked for me without any editing. Note sure it was required but I used an 'admin' command prompt. All versions latest general release as of today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests