Windows Terminalのプルダウンメニューに出るアイコン、 気付いてみたらLinux系が全部同じだった。よく見るとペンギンだった。
色々いじってるからなあ。最初はそれぞれのアイコンだったような気がした。でも確認してみたらPreview版の時は確実に今と同じLinux系は全部ペンギン。
shigeo-t.hatenablog.com
shigeo-t.hatenablog.com
起動するとUbuntuなのかAmazon Linux 2なのかわからない。一番左タブのPowerShellはアイコンがPowerShellのものなので問題ないが、真ん中タブのAmazon Linux2と右タブのUbuntuは同じアイコン。開いても同じようなLinuxの画面なので、あれこれやってるうちに訳わかんなくなる。
調べてみると、いつものsettings.jsonだった。
docs.microsoft.com
[アイコン]
これにより、タブとドロップダウン メニュー内に表示されるアイコンが設定されます。
プロパティ名: icon
必須かどうか: オプション
受け入れ可能: ファイルの場所を表す文字列
変更前のsettings.json。
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{6e9fa4d2-a4aa-562d-b1fa-0789dc1f83d7}",
"hidden": false,
"name": "Legacy",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"hidden": false,
"name": "Ubuntu-18.04",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
// "commandline": "Powershell Start-Process pwsh.exe -Verb runas",
"source": "Windows.Terminal.PowershellCore"
},
{
"guid": "{807c26af-2a40-5da1-9332-e6b858b98287}",
"hidden": false,
"name": "ubuntu1804a",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{be7eb5f0-da57-59cf-a159-176a785c38c7}",
"hidden": false,
"name": "amzn",
"source": "Windows.Terminal.Wsl"
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
それぞれのアイコンが表示された。Ubuntuは複数あるので別のアイコンを持ってきた。
起動済のWindows Terminalにも反映されてた。これで、どのタブがどのOSか分かる。
設定後のsettings.json。
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"profiles":
{
"defaults":
{
// Put settings here that you want to apply to all profiles
},
"list":
[
{
// Make changes here to the powershell.exe profile
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"name": "Windows PowerShell",
"commandline": "powershell.exe",
"hidden": false
},
{
// Make changes here to the cmd.exe profile
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"name": "cmd",
"commandline": "cmd.exe",
"hidden": false
},
{
"guid": "{6e9fa4d2-a4aa-562d-b1fa-0789dc1f83d7}",
"hidden": false,
"name": "Legacy",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"hidden": false,
"name": "Ubuntu-18.04",
"icon": "C:\\Users\\shigeo-t\\Pictures\\icon\\MetroUI-Folder-OS-Ubuntu-Alt-icon.png",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}",
"hidden": false,
"name": "Azure Cloud Shell",
"source": "Windows.Terminal.Azure"
},
{
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"name": "PowerShell",
// "commandline": "Powershell Start-Process pwsh.exe -Verb runas",
"source": "Windows.Terminal.PowershellCore"
},
{
"guid": "{807c26af-2a40-5da1-9332-e6b858b98287}",
"hidden": false,
"name": "ubuntu1804a",
"icon": "C:\\Users\\shigeo-t\\Pictures\\icon\\Folders-OS-Ubuntu-Metro-icon.png",
"source": "Windows.Terminal.Wsl"
},
{
"guid": "{be7eb5f0-da57-59cf-a159-176a785c38c7}",
"hidden": false,
"name": "amzn",
"icon": "C:\\Users\\shigeo-t\\Pictures\\icon\\AWS-icon.png",
"source": "Windows.Terminal.Wsl"
}
]
},
// Add custom color schemes to this array
"schemes": [],
// Add any keybinding overrides to this array.
// To unbind a default keybinding, set the command to "unbound"
"keybindings": []
}
参照したのはこのブログ。
soundartifacts.com
ところが、この通りに書くとエラーになる。これも起動済のWindows Terminalにも表示される。新たに起動したWindows Terminalにももちろん表示される。
で、「Bad escape sequence in string」について考えてみた。VS Codeで当該部分はこのように\マークの後ろの文字が赤い。それで気付いた。
これだ。
www.ipentec.com
ということで、"\"を"\\"にした。これでエラーは出なくなりアイコンも表示された。
{
"guid": "{be7eb5f0-da57-59cf-a159-176a785c38c7}",
"hidden": false,
"name": "amzn",
"icon": "C:\\Users\\shigeo-t\\Pictures\\icon\\AWS-icon.png",
}
アイコンファイルだが最初PC内にあるだろうと思って探したが、見つからない。上記ブログを見ると下記のように書いてある。
1.最初に行う必要があるのは、設定するアイコンを見つけることです。アイコンは、透明な背景と32x32サイズのPNG形式である必要があります。
オレが探していたのはicoファイルだったので、そもそもNG。そこで上記ブログに書かれていたアイコンサイトを使った。
www.iconarchive.com
ということですぐに終わるかと思ったアイコン設定、意外と大変だった。これならOSごとにターミナルの色を変えたほうが楽だったかも。