Compare commits

...

7 commits

53 changed files with 1416 additions and 480167 deletions

View file

@ -1,25 +0,0 @@
<details>
<summary>
:pencil2: Contributor please read this
</summary>
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
:warning: The command is written for posix shells. You can copy the contents of each `perl` command excluding the outer `'` marks and dropping any `'"`/`"'` quotation mark pairs into a file and then run `perl file.pl` from the root of the repository to run the code. Alternatively, you can manually insert the items...
If the listed items are:
* ... **misspelled**, then please *correct* them instead of using the command.
* ... *names*, please add them to `.github/actions/spell-check/dictionary/names.txt`.
* ... APIs, you can add them to a file in `.github/actions/spell-check/dictionary/`.
* ... just things you're using, please add them to an appropriate file in `.github/actions/spell-check/expect/`.
* ... tokens you only need in one place and shouldn't *generally be used*, you can add an item in an appropriate file in `.github/actions/spell-check/patterns/`.
See the `README.md` in each directory for more information.
:microscope: You can test your commits **without** *appending* to a PR by creating a new branch with that extra change and pushing it to your fork. The [:check-spelling](https://github.com/marketplace/actions/check-spelling) action will run in response to your **push** -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
</details>
#### :warning: Reviewers
At present, the action that triggered this message will not show its :x: in this PR unless the branch is within this repository.
Thus, you **should** make sure that this comment has been addressed before encouraging the merge bot to merge this PR.

View file

@ -1,45 +0,0 @@
ACCEPTFILES
ACCESSDENIED
alignof
bitfield
bitfields
CLASSNOTAVAILABLE
EXPCMDFLAGS
EXPCMDSTATE
fullkbd
futex
href
IAsync
IBind
IBox
IClass
IComparable
ICustom
IDialog
IDirect
IExplorer
IMap
IObject
IStorage
llabs
LCID
LSHIFT
NCHITTEST
NCLBUTTONDBLCLK
NCRBUTTONDBLCLK
NOAGGREGATION
NOREDIRECTIONBITMAP
oaidl
ocidl
PAGESCROLL
RETURNCMD
rfind
roundf
RSHIFT
rx
SIZENS
spsc
STDCPP
syscall
tmp
tx

File diff suppressed because it is too large Load diff

View file

@ -1,3 +0,0 @@
powf
sqrtf
isnan

View file

@ -1,18 +0,0 @@
ACLs
altform
backplating
DACL
DACLs
LKG
mfcribbon
microsoft
microsoftonline
osgvsowi
powerrename
powershell
pscustomobject
SACLs
tdbuildteamid
vcruntime
visualstudio
wslpath

50
.github/actions/spelling/advice.md vendored Normal file
View file

@ -0,0 +1,50 @@
<!-- markdownlint-disable MD033 MD041 -->
<details>
<summary>
:pencil2: Contributor please read this
</summary>
By default the command suggestion will generate a file named based on your commit. That's generally ok as long as you add the file to your commit. Someone can reorganize it later.
:warning: The command is written for posix shells. You can copy the contents of each `perl` command excluding the outer `'` marks and dropping any `'"`/`"'` quotation mark pairs into a file and then run `perl file.pl` from the root of the repository to run the code. Alternatively, you can manually insert the items...
If the listed items are:
* ... **misspelled**, then please *correct* them instead of using the command.
* ... *names*, please add them to `.github/actions/spelling/allow/names.txt`.
* ... APIs, you can add them to a file in `.github/actions/spelling/allow/`.
* ... just things you're using, please add them to an appropriate file in `.github/actions/spelling/expect/`.
* ... tokens you only need in one place and shouldn't *generally be used*, you can add an item in an appropriate file in `.github/actions/spelling/patterns/`.
See the `README.md` in each directory for more information.
:microscope: You can test your commits **without** *appending* to a PR by creating a new branch with that extra change and pushing it to your fork. The [check-spelling](https://github.com/marketplace/actions/check-spelling) action will run in response to your **push** -- it doesn't require an open pull request. By using such a branch, you can limit the number of typos your peers see you make. :wink:
<details><summary>:clamp: If you see a bunch of garbage</summary>
If it relates to a ...
<details><summary>well-formed pattern</summary>
See if there's a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it.
If not, try writing one and adding it to a `patterns/{file}.txt`.
Patterns are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
</details>
<details><summary>binary-ish string</summary>
Please add a file path to the `excludes.txt` file instead of just accepting the garbage.
File paths are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md](
../tree/HEAD/README.md) (on whichever branch you're using).
</details>
</details>
</details>

View file

@ -1,6 +1,6 @@
# Dictionaries are lists of words to accept unconditionally
# Allow files are lists of words to accept unconditionally
While check spelling will complain about a whitelisted word
While check spelling will complain about an expected word
which is no longer present, you can include things here even if
they are not otherwise present in the repository.
@ -8,13 +8,14 @@ E.g., you could include a list of system APIs here, or potential
contributors (so that if a future commit includes their name,
it'll be accepted).
### Files
## Files
| File | Description |
| ---- | ----------- |
| [Dictionary](dictionary.txt) | Primary US English dictionary |
| [Allow](allow.txt) | Supplements to the dictionary |
| [Chinese](chinese.txt) | Chinese words |
| [Japanese](japanese.txt) | Japanese words |
| [Microsoft](microsoft.txt) | Microsoft brand items |
| [Fonts](fonts.txt) | Font names |
| [Names](names.txt) | Names of people |
| [Colors](colors.txt) | Names of color |

View file

@ -0,0 +1,77 @@
apc
calt
ccmp
changelog
cybersecurity
Apc
clickable
clig
copyable
dalet
dcs
Dcs
dialytika
dje
downside
downsides
dze
dzhe
Enum'd
Fitt
formattings
ftp
fvar
geeksforgeeks
ghe
gje
hostname
hostnames
hyperlink
hyperlinking
hyperlinks
img
It'd
kje
liga
lje
locl
lorem
Llast
Lmid
Lorigin
maxed
mkmk
mru
noreply
nje
ogonek
ok'd
overlined
postmodern
ptys
qof
qps
rclt
reimplementation
reserialization
reserialize
reserializes
rlig
runtimes
shcha
slnt
Sos
timestamped
TLDR
tokenizes
tonos
tshe
uiatextrange
UIs
und
unregister
versioned
We'd
wildcards
yeru
zhe

194
.github/actions/spelling/allow/apis.txt vendored Normal file
View file

@ -0,0 +1,194 @@
ACCEPTFILES
ACCESSDENIED
alignas
alignof
APPLYTOSUBMENUS
bitfield
bitfields
BUILDBRANCH
BUILDMSG
BUILDNUMBER
BYPOSITION
charconv
CLASSNOTAVAILABLE
cmdletbinding
COLORPROPERTY
colspan
COMDLG
comparand
cstdint
CXICON
CYICON
dataobject
dcomp
DERR
dlldata
DONTADDTORECENT
DWORDLONG
enumset
environstrings
EXPCMDFLAGS
EXPCMDSTATE
filetime
FILTERSPEC
FORCEFILESYSTEM
FORCEMINIMIZE
frac
fullkbd
futex
GETDESKWALLPAPER
GETHIGHCONTRAST
Hashtable
HIGHCONTRASTON
HIGHCONTRASTW
hotkeys
href
hrgn
IActivation
IApp
IAppearance
IAsync
IBind
IBox
IClass
IComparable
IComparer
IConnection
ICustom
IDialog
IDirect
IExplorer
IFACEMETHOD
IFile
IInheritable
IMap
IObject
iosfwd
IPackage
IPeasant
isspace
ISetup
IStorage
istream
IStringable
ITab
ITaskbar
IUri
IVirtual
KEYSELECT
LCID
llabs
llu
localtime
lround
LSHIFT
MENUCOMMAND
MENUDATA
MENUINFO
memicmp
mptt
mov
msappx
MULTIPLEUSE
NCHITTEST
NCLBUTTONDBLCLK
NCRBUTTONDBLCLK
NIF
NIN
NOAGGREGATION
NOASYNC
NOCHANGEDIR
NOPROGRESS
NOREDIRECTIONBITMAP
NOREPEAT
NOTIFYBYPOS
NOTIFYICON
NOTIFYICONDATA
ntprivapi
oaidl
ocidl
ODR
offsetof
osver
OSVERSIONINFOEXW
otms
OUTLINETEXTMETRICW
overridable
PAGESCROLL
PICKFOLDERS
pmr
rcx
REGCLS
RETURNCMD
rfind
roundf
RSHIFT
schandle
semver
serializer
SETVERSION
SHELLEXECUTEINFOW
shobjidl
SHOWMINIMIZED
SHOWTIP
SINGLEUSE
SIZENS
smoothstep
snprintf
spsc
sregex
SRWLOC
SRWLOCK
STDCPP
STDMETHOD
strchr
strcpy
streambuf
strtoul
Stubless
Subheader
Subpage
syscall
TASKBARCREATED
TBPF
THEMECHANGED
tlg
tmp
tolower
toupper
TTask
TVal
UChar
UPDATEINIFILE
userenv
wcsstr
wcstoui
winmain
wmemcmp
wpc
wsregex
wwinmain
xchg
XDocument
XElement
xfacet
xhash
XIcon
xiosbase
xlocale
xlocbuf
xlocinfo
xlocmes
xlocmon
xlocnum
xloctime
XMax
xmemory
XParse
xpath
xstddef
xstring
xtree
xutility
YIcon
YMax

View file

@ -0,0 +1,117 @@
alice
aliceblue
antiquewhite
blanchedalmond
blueviolet
burlywood
cadetblue
cornflowerblue
cornsilk
cyan
darkblue
darkcyan
darkgoldenrod
darkgray
darkgreen
darkgrey
darkkhaki
darkmagenta
darkolivegreen
darkorange
darkorchid
darkred
darksalmon
darkseagreen
darkslateblue
darkslategray
darkslategrey
darkturquoise
darkviolet
deeppink
deepskyblue
dimgray
dimgrey
dodgerblue
firebrick
floralwhite
forestgreen
gainsboro
ghostwhite
greenyellow
hotpink
indian
indianred
lavenderblush
lawngreen
lemonchiffon
lightblue
lightcoral
lightcyan
lightgoldenrod
lightgoldenrodyellow
lightgray
lightgreen
lightgrey
lightpink
lightsalmon
lightseagreen
lightskyblue
lightslateblue
lightslategray
lightslategrey
lightsteelblue
lightyellow
limegreen
mediumaquamarine
mediumblue
mediumorchid
mediumpurple
mediumseagreen
mediumslateblue
mediumspringgreen
mediumturquoise
mediumvioletred
midnightblue
mintcream
mistyrose
navajo
navajowhite
navyblue
oldlace
olivedrab
orangered
palegoldenrod
palegreen
paleturquoise
palevioletred
papayawhip
peachpuff
peru
powderblue
rebecca
rebeccapurple
rosybrown
royalblue
saddlebrown
sandybrown
seagreen
sienna
skyblue
slateblue
slategray
slategrey
springgreen
steelblue
violetred
webgray
webgreen
webgrey
webmaroon
webpurple
whitesmoke
xaroon
xray
xreen
xrey
xurple
yellowgreen

View file

@ -1,8 +1,10 @@
Consolas
emoji
emojis
Extralight
Gabriola
Iosevka
MDL
Monofur
Segoe
wght

11
.github/actions/spelling/allow/math.txt vendored Normal file
View file

@ -0,0 +1,11 @@
atan
CPrime
HBar
HPrime
isnan
LPrime
LStep
powf
RSub
sqrtf
ULP

View file

@ -0,0 +1,78 @@
ACLs
ADMINS
advapi
altform
altforms
appendwttlogging
appx
appxbundle
appxerror
appxmanifest
ATL
backplating
bitmaps
BOMs
CPLs
cpptools
cppvsdbg
CPRs
cryptbase
DACL
DACLs
diffs
disposables
dotnetfeed
DTDs
DWINRT
enablewttlogging
Intelli
IVisual
LKG
LOCKFILE
Lxss
mfcribbon
microsoft
microsoftonline
MSAA
msixbundle
MSVC
muxc
netcore
osgvsowi
PFILETIME
pgc
pgo
pgosweep
powerrename
powershell
propkey
pscustomobject
QWORD
regedit
robocopy
SACLs
sdkddkver
Shobjidl
Skype
SRW
sxs
Sysinternals
sysnative
systemroot
taskkill
tasklist
tdbuildteamid
unvirtualized
VCRT
vcruntime
Virtualization
visualstudio
vscode
VSTHRD
winsdkver
wlk
wslpath
wtl
wtt
wttlog
Xamarin

View file

@ -8,36 +8,52 @@ dhowett
Diviness
dsafa
duhowett
ekg
ethanschoonover
Firefox
Gatta
glsl
Gravell
Grie
Griese
Hernan
Howett
Illhardt
iquilezles
jantari
jerrysh
Kaiyu
kimwalisch
KMehrain
KODELIFE
Kodelife
Kourosh
kowalczyk
leonmsft
Lepilleur
lhecker
lukesampson
Manandhar
mbadolato
Mehrain
menger
mgravell
michaelniksa
michkap
migrie
mikegr
mikemaccana
miloush
miniksa
niksa
nvaccess
nvda
oising
oldnewthing
opengl
osgwiki
pabhojwa
panos
paulcam
pauldotknopf
PGP
@ -45,11 +61,14 @@ Pham
Rincewind
rprichard
Schoonover
shadertoy
Somuah
sonph
sonpham
stakx
thereses
Walisch
Wellons
Wirt
Wojciech
zadjii

View file

@ -1,3 +1,4 @@
(?:(?i)\.png$)
(?:^|/)dirs$
(?:^|/)go\.mod$
(?:^|/)go\.sum$
@ -35,7 +36,6 @@ SUMS$
\.pbxproj$
\.pdf$
\.pem$
\.png$
\.psd$
\.runsettings$
\.sig$
@ -45,6 +45,7 @@ SUMS$
\.tar$
\.tgz$
\.ttf$
\.vsdx$
\.woff
\.xcf$
\.xls
@ -53,11 +54,26 @@ SUMS$
\.zip$
^consolegit2gitfilters\.json$
^dep/
^oss/
^doc/reference/master-sequence-list.csv$
^doc/reference/UTF8-torture-test\.txt$
^oss/
^src/host/ft_uia/run\.bat$
^src/host/runft\.bat$
^src/host/runut\.bat$
^src/interactivity/onecore/BgfxEngine\.
^src/renderer/wddmcon/WddmConRenderer\.
^src/terminal/adapter/ut_adapter/run\.bat$
^src/terminal/parser/delfuzzpayload\.bat$
^src/terminal/parser/ft_fuzzer/run\.bat$
^src/terminal/parser/ft_fuzzer/VTCommandFuzzer\.cpp$
^src/terminal/parser/ft_fuzzwrapper/run\.bat$
^src/terminal/parser/ut_parser/run\.bat$
^src/tools/integrity/packageuwp/ConsoleUWP\.appxSources$
^src/tools/lnkd/lnkd\.bat$
^src/tools/pixels/pixels\.bat$
^src/tools/texttests/fira\.txt$
^src/tools/U8U16Test/(?:fr|ru|zh)\.txt$
^\.github/actions/spell-check/
^src/types/ut_types/UtilsTests.cpp$
^\.github/actions/spelling/
^\.gitignore$
^\XamlStyler.json$

View file

@ -1,15 +1,32 @@
AAAa
AAAAA
AAAAAAAAAAAAA
AAAAAABBBBBBCCC
AAAAABBBBBBCCC
abcd
abcd
abcde
abcdef
ABCDEFG
ABCDEFGH
ABCDEFGHIJ
abcdefghijk
ABCDEFGHIJKLMNO
abcdefghijklmnop
ABCDEFGHIJKLMNOPQRST
abcdefghijklmnopqrstuvwxyz
ABCG
ABE
BBGGRR
abf
BBBBB
BBBBBBBB
BBBBBBBBBBBBBBDDDD
BBBBBCCC
BBBBCCCCC
BBGGRR
CCE
EFG
EFGh
QQQQQQQQQQABCDEFGHIJ
QQQQQQQQQQABCDEFGHIJKLMNOPQRSTQQQQQQQQQ
QQQQQQQQQQABCDEFGHIJKLMNOPQRSTQQQQQQQQQQ
@ -28,3 +45,4 @@ ZYXWVUT
ZZBBZ
ZZZBB
ZZZBZ
ZZZZZ

View file

@ -1,6 +1,7 @@
http
td
www
easyrgb
php
ecma
rapidtables
WCAG
@ -10,6 +11,9 @@ robertelder
kovidgoyal
leonerd
fixterms
uk
winui
appshellintegration
mdtauk
cppreference
gfycat
Guake

View file

@ -4,7 +4,8 @@ https://www\.itscj\.ipsj\.or\.jp/iso-ir/[-0-9]+\.pdf
https://www\.vt100\.net/docs/[-a-zA-Z0-9#_\/.]*
https://www.w3.org/[-a-zA-Z0-9?&=\/_#]*
https://(?:(?:www\.|)youtube\.com|youtu.be)/[-a-zA-Z0-9?&=]*
https://[a-z-]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]*
https://(?:[a-z-]+\.|)github(?:usercontent|)\.com/[-a-zA-Z0-9?%&=_\/.]*
https://www.xfree86.org/[-a-zA-Z0-9?&=\/_#]*
[Pp]ublicKeyToken="?[0-9a-fA-F]{16}"?
(?:[{"]|UniqueIdentifier>)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}(?:[}"]|</UniqueIdentifier)
(?:0[Xx]|\\x|U\+|#)[a-f0-9A-FGgRr]{2,}[Uu]?[Ll]{0,2}\b
@ -15,8 +16,12 @@ Scro\&ll
:\\windows\\syste\b
TestUtils::VerifyExpectedString\(tb, L"[^"]+"
(?:hostSm|mach)\.ProcessString\(L"[^"]+"
\b([A-Za-z])\1{3,}\b
\b([A-Za-z])\g{-1}{3,}\b
0x[0-9A-Za-z]+
Base64::s_(?:En|De)code\(L"[^"]+"
VERIFY_ARE_EQUAL\(L"[^"]+"
L"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+/"
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\+/"
std::memory_order_[\w]+
D2DERR_SHADER_COMPILE_FAILED
TIL_FEATURE_[0-9A-Z_]+
vcvars\w*

22
.github/actions/spelling/reject.txt vendored Normal file
View file

@ -0,0 +1,22 @@
^attache$
^attacher$
^attachers$
^spae$
^spaebook$
^spaecraft$
^spaed$
^spaedom$
^spaeing$
^spaeings$
^spae-man$
^spaeman$
^spaer$
^Spaerobee$
^spaes$
^spaewife$
^spaewoman$
^spaework$
^spaewright$
^wether$
^wethers$
^wetherteg$

View file

@ -1,20 +0,0 @@
name: Spell checking
on:
push:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '15 * * * *'
jobs:
build:
name: Spell checking
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.0.0
with:
fetch-depth: 5
- uses: check-spelling/check-spelling@0.0.16-alpha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
bucket: .github/actions
project: spell-check

20
.github/workflows/spelling2.yml vendored Normal file
View file

@ -0,0 +1,20 @@
# spelling.yml is blocked per https://github.com/check-spelling/check-spelling/security/advisories/GHSA-g86g-chm8-7r2p
name: Spell checking
on:
pull_request_target:
push:
jobs:
spelling:
name: Spell checking
runs-on: ubuntu-latest
steps:
- name: checkout-merge
if: "contains(github.event_name, 'pull_request')"
uses: actions/checkout@v2
with:
ref: refs/pull/${{github.event.pull_request.number}}/merge
- name: checkout
if: "!contains(github.event_name, 'pull_request')"
uses: actions/checkout@v2
- uses: check-spelling/check-spelling@v0.0.19

View file

@ -256,7 +256,7 @@ namespace winrt::TerminalApp::implementation
});
_root->Create();
_ApplyTheme(_settings->GlobalSettings().Theme());
_ApplyTheme(_settings->GlobalSettings().Theme()->ApplicationTheme());
_ApplyStartupTaskStateChange();
TraceLoggingWrite(
@ -310,7 +310,7 @@ namespace winrt::TerminalApp::implementation
// details here, but it does have the desired effect.
// It's not enough to set the theme on the dialog alone.
auto themingLambda{ [this](const Windows::Foundation::IInspectable& sender, const RoutedEventArgs&) {
auto theme{ _settings->GlobalSettings().Theme() };
auto theme{ _settings->GlobalSettings().Theme()->ApplicationTheme() };
auto element{ sender.try_as<winrt::Windows::UI::Xaml::FrameworkElement>() };
while (element)
{
@ -586,7 +586,7 @@ namespace winrt::TerminalApp::implementation
LoadSettings();
}
return _settings->GlobalSettings().Theme();
return _settings->GlobalSettings().Theme()->ApplicationTheme();
}
bool AppLogic::GetShowTabsInTitlebar()
@ -767,7 +767,7 @@ namespace winrt::TerminalApp::implementation
co_await winrt::resume_foreground(_root->Dispatcher());
// Refresh the UI theme
_ApplyTheme(_settings->GlobalSettings().Theme());
_ApplyTheme(_settings->GlobalSettings().Theme()->ApplicationTheme());
}
fire_and_forget AppLogic::_ApplyStartupTaskStateChange()
@ -1089,6 +1089,11 @@ namespace winrt::TerminalApp::implementation
return _root ? _root->AlwaysOnTop() : false;
}
Windows::UI::Color AppLogic::TitlebarColor()
{
return _root->TitlebarColor();
}
// -------------------------------- WinRT Events ---------------------------------
// Winrt events need a method for adding a callback to the event and removing the callback.
// These macros will define them both for you.

View file

@ -37,6 +37,8 @@ namespace winrt::TerminalApp::implementation
bool Fullscreen() const;
bool AlwaysOnTop() const;
Windows::UI::Color TitlebarColor();
Windows::Foundation::Size GetLaunchDimensions(uint32_t dpi);
winrt::Windows::Foundation::Point GetLaunchInitialPositions(int32_t defaultInitialX, int32_t defaultInitialY);
winrt::Windows::UI::Xaml::ElementTheme GetRequestedTheme();
@ -110,6 +112,7 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(FocusModeChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FocusModeChanged);
FORWARDED_TYPED_EVENT(FullscreenChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, FullscreenChanged);
FORWARDED_TYPED_EVENT(AlwaysOnTopChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, AlwaysOnTopChanged);
FORWARDED_TYPED_EVENT(TitlebarColorChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::RoutedEventArgs, _root, TitlebarColorChanged);
};
}

View file

@ -45,6 +45,8 @@ namespace TerminalApp
Boolean Fullscreen { get; };
Boolean AlwaysOnTop { get; };
Windows.UI.Color TitlebarColor { get; };
Windows.Foundation.Size GetLaunchDimensions(UInt32 dpi);
Windows.Foundation.Point GetLaunchInitialPositions(Int32 defaultInitialX, Int32 defaultInitialY);
@ -66,5 +68,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> FocusModeChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> FullscreenChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> AlwaysOnTopChanged;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.RoutedEventArgs> TitlebarColorChanged;
}
}

View file

@ -89,7 +89,9 @@ private:
void _LayerOrCreateProfile(const Json::Value& profileJson);
Profile* _FindMatchingProfile(const Json::Value& profileJson);
void _LayerOrCreateColorScheme(const Json::Value& schemeJson);
void _LayerOrCreateTheme(const Json::Value& themeJson);
ColorScheme* _FindMatchingColorScheme(const Json::Value& schemeJson);
Theme* _FindMatchingTheme(const Json::Value& themeJson);
void _ParseJsonString(std::string_view fileData, const bool isDefaultSettings);
static const Json::Value& _GetProfilesJsonObject(const Json::Value& json);
static const Json::Value& _GetDisabledProfileSourcesJsonObject(const Json::Value& json);

View file

@ -35,6 +35,7 @@ static constexpr std::string_view DefaultSettingsKey{ "defaults" };
static constexpr std::string_view ProfilesListKey{ "list" };
static constexpr std::string_view KeybindingsKey{ "keybindings" };
static constexpr std::string_view SchemesKey{ "schemes" };
static constexpr std::string_view ThemesKey{ "themes" };
static constexpr std::string_view DisabledProfileSourcesKey{ "disabledProfileSources" };
@ -517,6 +518,17 @@ void CascadiaSettings::LayerJson(const Json::Value& json)
}
}
if (auto themes{ json[ThemesKey.data()] })
{
for (auto themeJson : themes)
{
if (themeJson.isObject())
{
_LayerOrCreateTheme(themeJson);
}
}
}
for (auto profileJson : _GetProfilesJsonObject(json))
{
if (profileJson.isObject())
@ -658,6 +670,20 @@ void CascadiaSettings::_LayerOrCreateColorScheme(const Json::Value& schemeJson)
}
}
void CascadiaSettings::_LayerOrCreateTheme(const Json::Value& themeJson)
{
// Layer the json on top of an existing profile, if we have one:
auto pTheme = _FindMatchingTheme(themeJson);
if (pTheme)
{
pTheme->LayerJson(themeJson);
}
else
{
_globals.AddTheme(Theme::FromJson(themeJson));
}
}
// Method Description:
// - Finds a color scheme from our list of color schemes that matches the given
// json object. Uses ColorScheme::GetNameFromJson to find the name and then
@ -687,6 +713,25 @@ ColorScheme* CascadiaSettings::_FindMatchingColorScheme(const Json::Value& schem
return nullptr;
}
Theme* CascadiaSettings::_FindMatchingTheme(const Json::Value& themeJson)
{
if (auto nameOpt = Theme::GetNameFromJson(themeJson))
{
winrt::hstring name {nameOpt.value()};
auto& themes = _globals.GetThemes();
auto iterator = themes.find(name);
if (iterator != themes.end())
{
// HERE BE DRAGONS: Returning a pointer to a type in the vector is
// maybe not the _safest_ thing, but we have a mind to make Profile
// and ColorScheme winrt types in the future, so this will be safer
// then.
return &iterator->second;
}
}
return nullptr;
}
// Function Description:
// - Returns true if we're running in a packaged context.
// If we are, we want to change our settings path slightly.

View file

@ -77,6 +77,16 @@ const std::unordered_map<std::wstring, ColorScheme>& GlobalAppSettings::GetColor
return _colorSchemes;
}
std::unordered_map<winrt::hstring, ::TerminalApp::Theme>& GlobalAppSettings::GetThemes() noexcept
{
return _themes;
}
const std::unordered_map<winrt::hstring, ::TerminalApp::Theme>& GlobalAppSettings::GetThemes() const noexcept
{
return _themes;
}
void GlobalAppSettings::DefaultProfile(const GUID defaultProfile) noexcept
{
_unparsedDefaultProfile.reset();
@ -162,7 +172,7 @@ void GlobalAppSettings::LayerJson(const Json::Value& json)
JsonUtils::GetValueForKey(json, LaunchModeKey, _LaunchMode);
JsonUtils::GetValueForKey(json, ThemeKey, _Theme);
JsonUtils::GetValueForKey(json, ThemeKey, _ThemeName);
JsonUtils::GetValueForKey(json, TabWidthModeKey, _TabWidthMode);
@ -217,6 +227,12 @@ void GlobalAppSettings::AddColorScheme(ColorScheme scheme)
_colorSchemes[name] = std::move(scheme);
}
void GlobalAppSettings::AddTheme(::TerminalApp::Theme theme)
{
auto name{ theme.Name() };
_themes[name] = std::move(theme);
}
// Method Description:
// - Return the warnings that we've collected during parsing the JSON for the
// keybindings. It's possible that the user provided keybindings have some
@ -235,3 +251,17 @@ const std::unordered_map<winrt::hstring, winrt::TerminalApp::Command>& GlobalApp
{
return _commands;
}
const ::TerminalApp::Theme* GlobalAppSettings::Theme() const
{
auto iterator = _themes.find(_ThemeName);
if (iterator != _themes.end())
{
// HERE BE DRAGONS: Returning a pointer to a type in the vector is
// maybe not the _safest_ thing, but we have a mind to make Profile
// and ColorScheme winrt types in the future, so this will be safer
// then.
return &iterator->second;
}
return nullptr;
}

View file

@ -16,6 +16,7 @@ Author(s):
#pragma once
#include "AppKeyBindings.h"
#include "ColorScheme.h"
#include "Theme.h"
#include "Command.h"
#include "SettingsTypes.h"
@ -41,6 +42,10 @@ public:
const std::unordered_map<std::wstring, ColorScheme>& GetColorSchemes() const noexcept;
void AddColorScheme(ColorScheme scheme);
std::unordered_map<winrt::hstring, Theme>& GetThemes() noexcept;
const std::unordered_map<winrt::hstring, Theme>& GetThemes() const noexcept;
void AddTheme(Theme theme);
winrt::TerminalApp::AppKeyBindings GetKeybindings() const noexcept;
static GlobalAppSettings FromJson(const Json::Value& json);
@ -58,12 +63,14 @@ public:
GUID DefaultProfile() const;
std::wstring UnparsedDefaultProfile() const;
const ::TerminalApp::Theme* Theme() const;
GETSET_PROPERTY(int32_t, InitialRows); // default value set in constructor
GETSET_PROPERTY(int32_t, InitialCols); // default value set in constructor
GETSET_PROPERTY(bool, AlwaysShowTabs, true);
GETSET_PROPERTY(bool, ShowTitleInTitlebar, true);
GETSET_PROPERTY(bool, ConfirmCloseAllTabs, true);
GETSET_PROPERTY(winrt::Windows::UI::Xaml::ElementTheme, Theme, winrt::Windows::UI::Xaml::ElementTheme::Default);
// GETSET_PROPERTY(winrt::Windows::UI::Xaml::ElementTheme, Theme, winrt::Windows::UI::Xaml::ElementTheme::Default);
GETSET_PROPERTY(winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode, TabWidthMode, winrt::Microsoft::UI::Xaml::Controls::TabViewWidthMode::Equal);
GETSET_PROPERTY(bool, ShowTabsInTitlebar, true);
GETSET_PROPERTY(std::wstring, WordDelimiters); // default value set in constructor
@ -80,6 +87,7 @@ public:
GETSET_PROPERTY(bool, DebugFeaturesEnabled); // default value set in constructor
GETSET_PROPERTY(bool, StartOnUserLogin, false);
GETSET_PROPERTY(bool, AlwaysOnTop, false);
GETSET_PROPERTY(winrt::hstring, ThemeName);
private:
std::optional<std::wstring> _unparsedDefaultProfile;
@ -89,6 +97,7 @@ private:
std::vector<::TerminalApp::SettingsLoadWarnings> _keybindingsWarnings;
std::unordered_map<std::wstring, ColorScheme> _colorSchemes;
std::unordered_map<winrt::hstring, ::TerminalApp::Theme> _themes;
std::unordered_map<winrt::hstring, winrt::TerminalApp::Command> _commands;
friend class TerminalAppLocalTests::SettingsTests;

View file

@ -25,4 +25,19 @@ namespace TerminalApp
std::optional<int> x;
std::optional<int> y;
};
enum class ColorType
{
Value = 0,
Accent,
TerminalBackground,
TerminalForeground,
ResourceKey
};
struct ThemeColor
{
ColorType type{ ColorType::Value };
std::optional<til::color> value{ std::nullopt };
};
};

View file

@ -632,6 +632,13 @@ namespace winrt::TerminalApp::implementation
auto newTabImpl = winrt::make_self<Tab>(profileGuid, term);
_tabs.Append(*newTabImpl);
auto themeTabBG = _settings->GlobalSettings().Theme()->TabBackground();
if (themeTabBG.has_value())
{
auto tabColor = _EvaluateThemeColor(*themeTabBG, 0x0);
newTabImpl->SetTabColor(tabColor);
}
// Hookup our event handlers to the new terminal
_RegisterTerminalEvents(term, *newTabImpl);
@ -1937,6 +1944,15 @@ namespace winrt::TerminalApp::implementation
// the alwaysOnTop setting will be lost.
_isAlwaysOnTop = _settings->GlobalSettings().AlwaysOnTop();
_alwaysOnTopChangedHandlers(*this, nullptr);
// THEME
auto themeTabRowBG = _settings->GlobalSettings().Theme()->TabRowBackground();
if (themeTabRowBG.has_value())
{
auto tabRowColor = _EvaluateThemeColor(*themeTabRowBG, 0x0);
Windows::UI::Color accentColor = ColorHelper::GetAccentColor(tabRowColor);
_SetTabRowColor(tabRowColor, accentColor);
}
}
// Method Description:
@ -2289,6 +2305,164 @@ namespace winrt::TerminalApp::implementation
return _isAlwaysOnTop;
}
// Method Description:
// - Sets the tab split button color when a new tab color is selected
// - Sets the tab row color when a new tab color is selected
// Arguments:
// - color: The color of the newly selected tab, used to properly calculate
// the foreground color of the split button (to match the font
// color of the tab)
// - accentColor: the actual color we are going to use to paint the tab row and
// split button, so that there is some contrast between the tab
// and the non-client are behind it
// Return Value:
// - <none>
void TerminalPage::_SetTabRowColor(const Windows::UI::Color& color, const Windows::UI::Color& accentColor)
{
bool IsBrightColor = ColorHelper::IsBrightColor(color);
bool isLightAccentColor = ColorHelper::IsBrightColor(accentColor);
winrt::Windows::UI::Color pressedColor{};
winrt::Windows::UI::Color hoverColor{};
winrt::Windows::UI::Color foregroundColor{};
const float hoverColorAdjustment = 5.f;
const float pressedColorAdjustment = 7.f;
if (IsBrightColor)
{
foregroundColor = winrt::Windows::UI::Colors::Black();
}
else
{
foregroundColor = winrt::Windows::UI::Colors::White();
}
if (isLightAccentColor)
{
hoverColor = ColorHelper::Darken(accentColor, hoverColorAdjustment);
pressedColor = ColorHelper::Darken(accentColor, pressedColorAdjustment);
}
else
{
hoverColor = ColorHelper::Lighten(accentColor, hoverColorAdjustment);
pressedColor = ColorHelper::Lighten(accentColor, pressedColorAdjustment);
}
Media::SolidColorBrush backgroundBrush{ accentColor };
Media::SolidColorBrush backgroundHoverBrush{ hoverColor };
Media::SolidColorBrush backgroundPressedBrush{ pressedColor };
Media::SolidColorBrush foregroundBrush{ foregroundColor };
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonBackground"), backgroundBrush);
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonBackgroundPointerOver"), backgroundHoverBrush);
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonBackgroundPressed"), backgroundPressedBrush);
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonForeground"), foregroundBrush);
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonForegroundPointerOver"), foregroundBrush);
_newTabButton.Resources().Insert(winrt::box_value(L"SplitButtonForegroundPressed"), foregroundBrush);
_newTabButton.Background(backgroundBrush);
_newTabButton.Foreground(foregroundBrush);
TabRow().TabView().Background(backgroundBrush);
_TitlebarColorChangedHandlers(*this, nullptr);
}
// Method Description:
// - Clears the tab split button color to a system color
// (or white if none is found) when the tab's color is cleared
// - Clears the tab row color to a system color
// (or white if none is found) when the tab's color is cleared
// Arguments:
// - <none>
// Return Value:
// - <none>
void TerminalPage::_ClearTabRowColor()
{
winrt::hstring keys[] = {
L"SplitButtonBackground",
L"SplitButtonBackgroundPointerOver",
L"SplitButtonBackgroundPressed",
L"SplitButtonForeground",
L"SplitButtonForegroundPointerOver",
L"SplitButtonForegroundPressed"
};
// simply clear any of the colors in the split button's dict
for (auto keyString : keys)
{
auto key = winrt::box_value(keyString);
if (_newTabButton.Resources().HasKey(key))
{
_newTabButton.Resources().Remove(key);
}
}
const auto res = Application::Current().Resources();
const auto defaultBackgroundKey = winrt::box_value(L"TabViewItemHeaderBackground");
const auto defaultForegroundKey = winrt::box_value(L"SystemControlForegroundBaseHighBrush");
winrt::Windows::UI::Xaml::Media::SolidColorBrush backgroundBrush;
winrt::Windows::UI::Xaml::Media::SolidColorBrush foregroundBrush;
if (res.HasKey(defaultBackgroundKey))
{
winrt::Windows::Foundation::IInspectable obj = res.Lookup(defaultBackgroundKey);
backgroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
}
else
{
backgroundBrush = winrt::Windows::UI::Xaml::Media::SolidColorBrush{ winrt::Windows::UI::Colors::Black() };
}
if (res.HasKey(defaultForegroundKey))
{
winrt::Windows::Foundation::IInspectable obj = res.Lookup(defaultForegroundKey);
foregroundBrush = obj.try_as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>();
}
else
{
foregroundBrush = winrt::Windows::UI::Xaml::Media::SolidColorBrush{ winrt::Windows::UI::Colors::White() };
}
_newTabButton.Background(backgroundBrush);
_newTabButton.Foreground(foregroundBrush);
TabRow().TabView().Background(backgroundBrush);
_TitlebarColorChangedHandlers(*this, nullptr);
}
Windows::UI::Color TerminalPage::TitlebarColor()
{
return TabRow().TabView().Background().as<Windows::UI::Xaml::Media::SolidColorBrush>().Color();
}
til::color TerminalPage::_EvaluateThemeColor(const ::TerminalApp::ThemeColor& themeColor,
const til::color& /*terminalBG*/)
{
if (themeColor.type == ::TerminalApp::ColorType::Value)
{
return themeColor.value.value();
}
else if (themeColor.type == ::TerminalApp::ColorType::Accent)
{
const auto res = winrt::Windows::UI::Xaml::Application::Current().Resources();
const auto accentColorKey = winrt::box_value(L"SystemAccentColor");
if (res.HasKey(accentColorKey))
{
const auto colorFromResources = res.Lookup(accentColorKey);
return winrt::unbox_value_or<winrt::Windows::UI::Color>(colorFromResources, winrt::Windows::UI::Colors::Black());
}
else
{
// DON'T use Transparent here - if it's "Transparent", then it won't
// be able to hittest for clicks.
return winrt::Windows::UI::Colors::Black();
}
}
return 0xff00ff;
}
// -------------------------------- WinRT Events ---------------------------------
// Winrt events need a method for adding a callback to the event and removing the callback.
// These macros will define them both for you.

View file

@ -56,6 +56,8 @@ namespace winrt::TerminalApp::implementation
bool Fullscreen() const;
bool AlwaysOnTop() const;
Windows::UI::Color TitlebarColor();
void SetStartupActions(std::vector<winrt::TerminalApp::ActionAndArgs>& actions);
static std::vector<winrt::TerminalApp::ActionAndArgs> ConvertExecuteCommandlineToActions(const TerminalApp::ExecuteCommandlineArgs& args);
@ -70,6 +72,7 @@ namespace winrt::TerminalApp::implementation
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(FullscreenChanged, _fullscreenChangedHandlers, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
DECLARE_EVENT_WITH_TYPED_EVENT_HANDLER(AlwaysOnTopChanged, _alwaysOnTopChangedHandlers, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable);
TYPED_EVENT(Initialized, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::RoutedEventArgs);
TYPED_EVENT(TitlebarColorChanged, winrt::Windows::Foundation::IInspectable, winrt::Windows::UI::Xaml::RoutedEventArgs);
private:
friend struct TerminalPageT<TerminalPage>; // for Xaml to bind events
@ -191,6 +194,10 @@ namespace winrt::TerminalApp::implementation
void _CommandPaletteClosed(const IInspectable& sender, const Windows::UI::Xaml::RoutedEventArgs& eventArgs);
void _SetTabRowColor(const Windows::UI::Color& color, const Windows::UI::Color& accentColor);
void _ClearTabRowColor();
til::color _EvaluateThemeColor(const ::TerminalApp::ThemeColor& themeColor, const til::color& terminalBG);
#pragma region ActionHandlers
// These are all defined in AppActionHandlers.cpp
void _HandleOpenNewTabDropdown(const IInspectable& sender, const TerminalApp::ActionEventArgs& args);

View file

@ -22,6 +22,8 @@ namespace TerminalApp
Boolean Fullscreen { get; };
Boolean AlwaysOnTop { get; };
Windows.UI.Color TitlebarColor { get; };
// We cannot use the default XAML APIs because we want to make sure
// that there's only one application-global dialog visible at a time,
// and because of GH#5224.
@ -34,5 +36,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> FullscreenChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> AlwaysOnTopChanged;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.RoutedEventArgs> Initialized;
event Windows.Foundation.TypedEventHandler<Object, Windows.UI.Xaml.RoutedEventArgs> TitlebarColorChanged;
}
}

View file

@ -270,3 +270,29 @@ JSON_ENUM_MAPPER(::winrt::TerminalApp::SettingsTarget)
pair_type{ "allFiles", ValueType::AllFiles },
};
};
template<>
struct ::TerminalApp::JsonUtils::ConversionTrait<::TerminalApp::ThemeColor>
{
::TerminalApp::ThemeColor FromJson(const Json::Value& json)
{
::TerminalApp::ThemeColor ret;
std::string str{ json.asString() };
if (str == "accent")
{
ret.type = ::TerminalApp::ColorType::Accent;
}
else
{
ret.type = ::TerminalApp::ColorType::Value;
const auto value{ JsonUtils::GetValue<til::color>(json) };
ret.value = value;
}
return ret;
}
bool CanConvert(const Json::Value& json)
{
return json.isString();
}
};

View file

@ -0,0 +1,104 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "Theme.h"
#include "DefaultSettings.h"
#include "../../types/inc/Utils.hpp"
#include "Utils.h"
#include "JsonUtils.h"
#include "TerminalSettingsSerializationHelpers.h"
using namespace ::Microsoft::Console;
using namespace TerminalApp;
using namespace winrt::Microsoft::Terminal::Settings;
static constexpr std::string_view NameKey{ "name" };
static constexpr std::string_view WindowApplicationThemeKey{ "window.applicationTheme" };
// static constexpr std::string_view BackgroundKey{ "background" };
static constexpr std::string_view TabRowBackgroundKey{ "tabRow.background" };
static constexpr std::string_view TabBackgroundKey{ "tab.background" };
Theme::Theme()
{
}
Theme::~Theme()
{
}
// Method Description:
// - Apply our values to the given TerminalSettings object. Sets the foreground,
// background, and color table of the settings object.
// Arguments:
// - terminalSettings: the object to apply our settings to.
// Return Value:
// - <none>
void Theme::ApplyTheme(TerminalSettings terminalSettings) const
{
}
// Method Description:
// - Create a new instance of this class from a serialized JsonObject.
// Arguments:
// - json: an object which should be a serialization of a Theme object.
// Return Value:
// - a new Theme instance created from the values in `json`
Theme Theme::FromJson(const Json::Value& json)
{
Theme result;
result.LayerJson(json);
return result;
}
// Method Description:
// - Returns true if we think the provided json object represents an instance of
// the same object as this object. If true, we should layer that json object
// on us, instead of creating a new object.
// Arguments:
// - json: The json object to query to see if it's the same
// Return Value:
// - true iff the json object has the same `name` as we do.
bool Theme::ShouldBeLayered(const Json::Value& json) const
{
std::wstring nameFromJson{};
if (JsonUtils::GetValueForKey(json, NameKey, nameFromJson))
{
return nameFromJson == _Name;
}
return false;
}
// Method Description:
// - Layer values from the given json object on top of the existing properties
// of this object. For any keys we're expecting to be able to parse in the
// given object, we'll parse them and replace our settings with values from
// the new json object. Properties that _aren't_ in the json object will _not_
// be replaced.
// Arguments:
// - json: an object which should be a partial serialization of a Theme object.
// Return Value:
// <none>
void Theme::LayerJson(const Json::Value& json)
{
JsonUtils::GetValueForKey(json, NameKey, _Name);
JsonUtils::GetValueForKey(json, WindowApplicationThemeKey, _ApplicationTheme);
// JsonUtils::GetValueForKey(json, ForegroundKey, _defaultForeground);
JsonUtils::GetValueForKey(json, TabRowBackgroundKey, _TabRowBackground);
JsonUtils::GetValueForKey(json, TabBackgroundKey, _TabBackground);
}
// Method Description:
// - Parse the name from the JSON representation of a Theme.
// Arguments:
// - json: an object which should be a serialization of a Theme object.
// Return Value:
// - the name of the color scheme represented by `json` as a std::wstring optional
// i.e. the value of the `name` property.
// - returns std::nullopt if `json` doesn't have the `name` property
std::optional<std::wstring> Theme::GetNameFromJson(const Json::Value& json)
{
return JsonUtils::GetValueForKey<std::optional<std::wstring>>(json, NameKey);
}

View file

@ -0,0 +1,55 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- Theme.h
Abstract:
- TODO
Author(s):
- Mike Griese - July 2020
--*/
#pragma once
#include <winrt/Microsoft.Terminal.Settings.h>
#include "../../inc/conattrs.hpp"
#include "../inc/cppwinrt_utils.h"
#include "SettingsTypes.h"
// fwdecl unittest classes
namespace TerminalAppLocalTests
{
class SettingsTests;
class ColorSchemeTests;
};
namespace TerminalApp
{
class Theme;
};
class TerminalApp::Theme final
{
public:
Theme();
~Theme();
void ApplyTheme(winrt::Microsoft::Terminal::Settings::TerminalSettings terminalSettings) const;
static Theme FromJson(const Json::Value& json);
bool ShouldBeLayered(const Json::Value& json) const;
void LayerJson(const Json::Value& json);
static std::optional<std::wstring> GetNameFromJson(const Json::Value& json);
GETSET_PROPERTY(winrt::hstring, Name);
GETSET_PROPERTY(winrt::Windows::UI::Xaml::ElementTheme, ApplicationTheme, winrt::Windows::UI::Xaml::ElementTheme::Default);
GETSET_PROPERTY(std::optional<::TerminalApp::ThemeColor>, TabRowBackground);
GETSET_PROPERTY(std::optional<::TerminalApp::ThemeColor>, TabBackground);
private:
friend class TerminalAppLocalTests::SettingsTests;
friend class TerminalAppLocalTests::ColorSchemeTests;
};

View file

@ -271,6 +271,21 @@
"brightWhite": "#EEEEEC"
}
],
"themes":
[
{
"name": "system",
"window.applicationTheme": "system",
},
{
"name": "dark",
"window.applicationTheme": "dark",
},
{
"name": "light",
"window.applicationTheme": "light",
}
],
"bindings":
[
// Application-level Keys

View file

@ -102,6 +102,7 @@
</ClInclude>
<ClInclude Include="../Pane.h" />
<ClInclude Include="../ColorScheme.h" />
<ClInclude Include="../Theme.h" />
<ClInclude Include="../GlobalAppSettings.h" />
<ClInclude Include="../Profile.h" />
<ClInclude Include="../CascadiaSettings.h" />
@ -173,6 +174,7 @@
</ClCompile>
<ClCompile Include="../Pane.cpp" />
<ClCompile Include="../ColorScheme.cpp" />
<ClCompile Include="../Theme.cpp" />
<ClCompile Include="../GlobalAppSettings.cpp" />
<ClCompile Include="../Profile.cpp" />
<ClCompile Include="../CascadiaSettings.cpp" />

View file

@ -59,7 +59,7 @@
<ClCompile Include="../Commandline.cpp" />
<ClCompile Include="../ColorHelper.cpp" />
<ClCompile Include="../DebugTapConnection.cpp" />
<ClCompile Include="../CommandSerialization.cpp">
<ClCompile Include="../Theme.cpp">
<Filter>settings</Filter>
</ClCompile>
</ItemGroup>
@ -119,7 +119,7 @@
<ClInclude Include="../TelnetGenerator.h">
<Filter>profileGeneration</Filter>
</ClInclude>
<ClInclude Include="../CommandSerialization.h">
<ClInclude Include="../Theme.h">
<Filter>settings</Filter>
</ClInclude>
</ItemGroup>
@ -139,10 +139,11 @@
<Midl Include="../Tab.idl">
<Filter>tab</Filter>
</Midl>
<Midl Include="../IF7Listener.idl" />
<Midl Include="../Command.idl">
<Filter>commandPalette</Filter>
</Midl>
<Midl Include="../IDirectKeyListener.idl" />
<Midl Include="../CommandKeyChordVisibilityConverter.idl" />
</ItemGroup>
<ItemGroup>
<None Include="../packages.config" />
@ -198,4 +199,4 @@
<Filter>app</Filter>
</ApplicationDefinition>
</ItemGroup>
</Project>
</Project>

View file

@ -160,6 +160,7 @@ void AppHost::Initialize()
_logic.FullscreenChanged({ this, &AppHost::_FullscreenChanged });
_logic.FocusModeChanged({ this, &AppHost::_FocusModeChanged });
_logic.AlwaysOnTopChanged({ this, &AppHost::_AlwaysOnTopChanged });
_logic.TitlebarColorChanged({ this, &AppHost::_TitlebarColorChanged });
_logic.Create();
@ -373,6 +374,12 @@ void AppHost::_AlwaysOnTopChanged(const winrt::Windows::Foundation::IInspectable
_window->SetAlwaysOnTop(_logic.AlwaysOnTop());
}
void AppHost::_TitlebarColorChanged(const winrt::Windows::Foundation::IInspectable&,
const winrt::Windows::Foundation::IInspectable&)
{
_window->SetTitlebarColor(_logic.TitlebarColor());
}
// Method Description:
// - Called when the IslandWindow has received a WM_MOUSEWHEEL message. This can
// happen on some laptops, where their trackpads won't scroll inactive windows

View file

@ -39,5 +39,7 @@ private:
const winrt::Windows::Foundation::IInspectable& arg);
void _AlwaysOnTopChanged(const winrt::Windows::Foundation::IInspectable& sender,
const winrt::Windows::Foundation::IInspectable& arg);
void _TitlebarColorChanged(const winrt::Windows::Foundation::IInspectable& sender,
const winrt::Windows::Foundation::IInspectable& arg);
void _WindowMouseWheeled(const til::point coord, const int32_t delta);
};

View file

@ -701,5 +701,9 @@ void IslandWindow::_ApplyWindowSize()
SWP_FRAMECHANGED));
}
void IslandWindow::SetTitlebarColor(const winrt::Windows::UI::Color /*color*/)
{
}
DEFINE_EVENT(IslandWindow, DragRegionClicked, _DragRegionClickedHandlers, winrt::delegate<>);
DEFINE_EVENT(IslandWindow, WindowCloseButtonClicked, _windowCloseButtonClickedHandler, winrt::delegate<>);

View file

@ -36,6 +36,8 @@ public:
void FullscreenChanged(const bool fullscreen);
void SetAlwaysOnTop(const bool alwaysOnTop);
virtual void SetTitlebarColor(const winrt::Windows::UI::Color color);
#pragma endregion
DECLARE_EVENT(DragRegionClicked, _DragRegionClickedHandlers, winrt::delegate<>);

View file

@ -929,3 +929,8 @@ void NonClientIslandWindow::_OpenSystemMenu(const int cursorX, const int cursorY
PostMessage(_window.get(), WM_SYSCOMMAND, ret, 0);
}
}
void NonClientIslandWindow::SetTitlebarColor(const winrt::Windows::UI::Color color)
{
_titlebar.Background().as<winrt::Windows::UI::Xaml::Media::SolidColorBrush>().Color(color);
}

View file

@ -46,6 +46,8 @@ public:
void SetTitlebarContent(winrt::Windows::UI::Xaml::UIElement content);
void OnApplicationThemeChanged(const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme) override;
void SetTitlebarColor(const winrt::Windows::UI::Color color) override;
private:
std::optional<COORD> _oldIslandPos;