Use alternative tool icons for Windows Terminal

This commit is contained in:
Isaiah Odhner 2023-07-20 21:01:25 -04:00
parent bc3dba29fc
commit a44d5b7695
2 changed files with 30 additions and 5 deletions

View File

@ -232,7 +232,7 @@ The default Terminal has missing characters, causing misalignment of everything
### Windows
Textual Paint works with the new [Windows Terminal](https://learn.microsoft.com/windows/terminal/install), however, the Fill With Color tool icon is missing (shows as tofu), and the Pencil emoji causes misalignment of everything to the right of it, including the canvas.
Textual Paint works with the new [Windows Terminal](https://learn.microsoft.com/windows/terminal/install).
Ctrl+V does not work to paste, but **Edit > Paste** does work.
It may be possible to unbind Ctrl+V to fix this, see [this issue](https://github.com/microsoft/terminal/issues/11267).
@ -364,8 +364,8 @@ These are the symbols I've found so far:
- Pick Color: 🎨💉💅💧📌📍⤤𝀃🝯🍶
- Magnifier: 🔍🔎👀🔬🔭🧐🕵️‍♂️🕵️‍♀️
- Pencil: ✏️✎✍️🖎🖊️🖋️✒️🖆📝🖍️
- Brush: 🖌️🖌👨‍🎨🧑‍🎨💅
- Airbrush: 💨ᖜ╔🧴🥤🫠
- Brush: 🖌👨‍🎨🧑‍🎨💅🧹🪮🪥🪒🪠ⵄ⑃ሐ⋔⋲ ▭/𝈸/⊏/⸦/⊂+⋹
- Airbrush: 💨дᖜ╔🧴🥤🫠
- Text: 🆎📝📄📃🔤📜A
- Line: 📏📉📈⟍𝈏╲⧹\
- Curve: ↪️🪝🌙〰️◡◠~∼≈∽∿〜〰﹋﹏≈≋~⁓

View File

@ -212,8 +212,8 @@ class Tool(Enum):
# - Pick Color: 🎨💉💅💧📌📍⤤𝀃🝯🍶
# - Magnifier: 🔍🔎👀🔬🔭🧐🕵️‍♂️🕵️‍♀️
# - Pencil: ✏️✎✍️🖎🖊️🖋️✒️🖆📝🖍️
# - Brush: 🖌️🖌👨‍🎨🧑‍🎨💅
# - Airbrush: 💨ᖜ╔🧴🥤🫠
# - Brush: 🖌👨‍🎨🧑‍🎨💅🧹🪮🪥🪒🪠ⵄ⑃ሐ⋔⋲ ▭/𝈸/⊏/⸦/⊂+⋹
# - Airbrush: 💨дᖜ╔🧴🥤🫠
# - Text: 🆎📝📄📃🔤📜A
# - Line: 📏📉📈⟍𝈏╲⧹\
# - Curve: ↪️🪝🌙〰️◡◠~∼≈∽∿〜〰﹋﹏≈≋~⁓
@ -221,6 +221,7 @@ class Tool(Enum):
# - Polygon: ▙𝗟𝙇﹄』𓊋⬣⬟🔶🔷🔸🔹🔺🔻△▲
# - Ellipse: ⬭⭕🔴🟠🟡🟢🔵🟣🟤⚫⚪🫧
# - Rounded Rectangle: ▢⬜⬛
if ascii_only_icons:
enum_to_icon = {
Tool.free_form_select: "<[u]^[/]7", # "*" "<^>" "<[u]^[/]7"
@ -261,6 +262,30 @@ class Tool(Enum):
return "🌊"
if self == Tool.free_form_select:
return "⢼⠮"
elif os.environ.get("WT_SESSION"):
# The new Windows Terminal app sets WT_SESSION to a GUID.
# Caveats:
# - If you run `cmd` inside WT, this env var will be inherited.
# - If you run a GUI program that launches another terminal emulator, this env var will be inherited.
# - If you run via ssh, using Microsoft's official openssh server, WT_SESSION will not be set.
# - If you hold alt and right click in Windows Explorer, and say Open Powershell Here, WT_SESSION will not be set,
# because powershell.exe is launched outside of the Terminal app, then later attached to it.
# Source: https://github.com/microsoft/terminal/issues/11057
# Windows Terminal has alignment problems with the default Pencil symbol "✏️"
# as well as alternatives "🖍️", "🖊️", "🖋️", "✍️", "✒️"
# "🖎" and "🖆" don't cause alignment issues, but don't show in color and are illegibly small.
if self == Tool.pencil:
# This looks more like it would represent the Text tool than the Pencil,
# so it's far from ideal, especially when there IS an actual pencil emoji...
return "📝"
# "🖌️" is causes misalignment (and is hard to distinguish from "✏️" at a glance)
# "🪮" shows as tofu
if self == Tool.brush:
return "🧹"
# "🪣" shows as tofu
if self == Tool.fill:
return "🌊"
return {
Tool.free_form_select: "",
Tool.select: "",