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

Add support for the newWindow action #9208

Merged
105 commits merged into from
Feb 19, 2021
Merged
Show file tree
Hide file tree
Changes from 100 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
3bef7bb
Get all the projects created and hooked up to the sln
zadjii-msft Dec 16, 2020
1f52d35
Yank all the M/P files, this builds?!
zadjii-msft Dec 16, 2020
5a9cdc8
Shockingly, this works, it works elevated, and it works unpackaged
zadjii-msft Dec 16, 2020
36539cf
This won't work, but I'm committing this becaus I finally got it to c…
zadjii-msft Dec 16, 2020
27ace16
whoop, we pass the commandline from the peasant, to the monarch, and …
zadjii-msft Dec 16, 2020
9a41647
HOLY SHIT I GOT THE COMANDLINE TO EXECUTE IN THE CURRENT WINDOW!!!!!!…
zadjii-msft Dec 17, 2020
5cabcfb
add a note to future me
zadjii-msft Dec 17, 2020
03bfc6e
This works as a unittest, but not a local test. That's batty
zadjii-msft Dec 17, 2020
590b9ff
this macro makes me feel dirty
zadjii-msft Dec 17, 2020
0579b24
LocalTests_Remoting -> UnitTests_Remoting
zadjii-msft Dec 17, 2020
a3faed6
finish renaming this test
zadjii-msft Dec 17, 2020
9c6eac4
Clean up a lot for review
zadjii-msft Dec 17, 2020
0103331
cleanup Peasant for review
zadjii-msft Dec 17, 2020
b4fe1bf
Final cleanup for review
zadjii-msft Dec 17, 2020
d08e65c
_final_ final cleanup for review
zadjii-msft Dec 17, 2020
e101efd
pr nits
zadjii-msft Dec 18, 2020
e1402d8
This seems to work to create a thread listening for the monarch, and …
zadjii-msft Dec 18, 2020
f978a9c
it's hard to believe he's gone / were it so easy
zadjii-msft Dec 18, 2020
5939636
Oh yea actually remove the thing
zadjii-msft Dec 18, 2020
c088895
last commit before the holidays
zadjii-msft Dec 18, 2020
fa2df47
Merge remote-tracking branch 'origin/main' into dev/migrie/f/remoting…
zadjii-msft Jan 5, 2021
0f5c24f
Enable audit mode
zadjii-msft Jan 5, 2021
921d915
nits
zadjii-msft Jan 5, 2021
00184e7
Merge branch 'dev/migrie/f/remoting.dll' into dev/migrie/f/the-first-…
zadjii-msft Jan 5, 2021
658db6b
Ask the TerminalApp to parse the commandline, and tell us what the wi…
zadjii-msft Jan 6, 2021
977db46
Holy bajesus, this works like a charm
zadjii-msft Jan 6, 2021
bcbef34
Add a note about commiting suicide
zadjii-msft Jan 6, 2021
813dbc6
notes, comments, cleanup
zadjii-msft Jan 6, 2021
0f0df5e
activate windows
zadjii-msft Jan 6, 2021
9fc2f0e
add some tracelogging
zadjii-msft Jan 6, 2021
6537686
The peasant will now correctly inform the monarch when it re-connects
zadjii-msft Jan 7, 2021
a75da0a
mostly just notes
zadjii-msft Jan 7, 2021
c02f25a
peasants now switch to the cwd that was requested
zadjii-msft Jan 7, 2021
3e39ab9
more comments
zadjii-msft Jan 7, 2021
52b2cb6
Allow the user to provide ids on the commandline
zadjii-msft Jan 7, 2021
bc492f1
Code cleanup
zadjii-msft Jan 7, 2021
88ffc6f
Merge remote-tracking branch 'origin/main' into dev/migrie/f/remoting…
zadjii-msft Jan 7, 2021
be74b2e
putting var in headers is bad, mkay?
zadjii-msft Jan 7, 2021
2a7bc94
branding
zadjii-msft Jan 7, 2021
81c09d9
Merge branch 'dev/migrie/f/remoting.dll' into dev/migrie/f/the-first-…
zadjii-msft Jan 8, 2021
c34e4ce
Merge remote-tracking branch 'origin/main' into dev/migrie/f/the-firs…
zadjii-msft Jan 8, 2021
5b8ace2
A bunch of tests for Monarch::ProposeCommandline
zadjii-msft Jan 8, 2021
689c385
sure yea that's a doc comment
zadjii-msft Jan 8, 2021
59deca1
Merge branch 'main' into dev/migrie/f/the-first-galactic-empire
zadjii-msft Jan 26, 2021
f02969b
More tests, more redundancy
zadjii-msft Jan 26, 2021
b2db317
man I can't spel
zadjii-msft Jan 26, 2021
d2a3438
Add try/catch's throughout Monarch.cpp
zadjii-msft Jan 27, 2021
a65f341
trycatch the window manager. A lot more going on there.
zadjii-msft Jan 27, 2021
faf4544
add some abstracts
zadjii-msft Jan 29, 2021
19765b1
Apply suggestions from code review
zadjii-msft Jan 29, 2021
4e007ae
a ton of PR feedback
zadjii-msft Jan 29, 2021
c493607
bunch of PR feedback
zadjii-msft Feb 2, 2021
8de368a
Merge remote-tracking branch 'origin/main' into dev/migrie/f/the-firs…
zadjii-msft Feb 2, 2021
e6bd315
!!! THIS NEEDS TO BE MOVED TO THE PARENT BRANCH !!!
zadjii-msft Jan 28, 2021
a62d53f
!!! THIS NEEDS TO BE MOVED TO THE PARENT BRANCH !!!
zadjii-msft Jan 28, 2021
147b187
!!! THIS NEEDS TO BE MOVED TO THE PARENT BRANCH !!!
zadjii-msft Jan 28, 2021
a102f44
bad merge
zadjii-msft Feb 2, 2021
7097274
Thats right, did it in one commit suckas
zadjii-msft Feb 2, 2021
67b525b
barf I hate the stl
zadjii-msft Feb 2, 2021
e4357c5
I'm not happy with this code, but i'm VERY HAPPY with how well it works
zadjii-msft Feb 2, 2021
e0d5a84
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 2, 2021
32ebf4e
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 3, 2021
9ab951c
Start working on tests
zadjii-msft Feb 3, 2021
6dc0feb
What? No yea I always run the tests
zadjii-msft Feb 2, 2021
9e94b36
I guess the tests weren't too bad
zadjii-msft Feb 3, 2021
39c4e44
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 9, 2021
031139b
!!! This needs to go to the parent branch !!!
zadjii-msft Feb 9, 2021
26437b0
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 10, 2021
683c146
Fix a weird bug in windowingBehavior:useExisting
zadjii-msft Feb 10, 2021
8072efa
Add a test for this weird case from the last commit
zadjii-msft Feb 10, 2021
5edfe28
revert this file
zadjii-msft Feb 10, 2021
ccf8d63
Some spellcheck fixes
zadjii-msft Feb 10, 2021
5abb55a
it'd be a shame if I wrote unittests for a data structure that I need…
zadjii-msft Feb 10, 2021
8537a2d
this is a disaster
zadjii-msft Feb 10, 2021
5315779
well, this bug is fixed, let's clean it up now
zadjii-msft Feb 11, 2021
f9445d7
fix the tests
zadjii-msft Feb 11, 2021
5df4c16
Remove a bunch of dead code, add comments
zadjii-msft Feb 11, 2021
8aefb6c
Somehow, this breaks the world? I'm just going to revert all of it
zadjii-msft Feb 11, 2021
8d05c5d
Revert "Somehow, this breaks the world? I'm just going to revert all …
zadjii-msft Feb 11, 2021
36bb19b
ho boy am I daft
zadjii-msft Feb 11, 2021
f96dad4
Ready for the prime time
zadjii-msft Feb 11, 2021
4860066
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 12, 2021
3cbaa26
HA this finally works
zadjii-msft Feb 12, 2021
ccda434
A bunch of test fixes
zadjii-msft Feb 17, 2021
994a6a3
More test fixes I missed
zadjii-msft Feb 17, 2021
bdcb6fd
Minor polish - I started working on tests and realized those were SUP…
zadjii-msft Feb 17, 2021
00a4093
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 17, 2021
e15c345
Rename the setting
zadjii-msft Feb 17, 2021
570375d
Add windowingBehavior to the SUI
zadjii-msft Feb 17, 2021
8c524e4
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 18, 2021
257d92b
most of the PR feedback
zadjii-msft Feb 18, 2021
1bf6754
Move the header to make Dustin happy
zadjii-msft Feb 18, 2021
b1c6d5a
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1051-new…
zadjii-msft Feb 18, 2021
0e5c7d9
fix the shell ext ; add real tests
zadjii-msft Feb 18, 2021
6e0441f
minor comments updates
zadjii-msft Feb 18, 2021
5867325
dead code removal
zadjii-msft Feb 18, 2021
cb311d8
some PR nits
zadjii-msft Feb 18, 2021
5eff079
Merge remote-tracking branch 'origin/main' into dev/migrie/f/2227-win…
zadjii-msft Feb 18, 2021
d18827a
Merge branch 'dev/migrie/f/2227-windowingBehavior' into dev/migrie/f/…
zadjii-msft Feb 18, 2021
c62a86c
spellbot
zadjii-msft Feb 18, 2021
fa96b5d
words r hard
zadjii-msft Feb 19, 2021
eca3125
Merge branch 'dev/migrie/f/2227-windowingBehavior' into dev/migrie/f/…
zadjii-msft Feb 19, 2021
14f027c
Add to the schema too
zadjii-msft Feb 19, 2021
a34f6be
Merge remote-tracking branch 'origin/main' into dev/migrie/f/1051-new…
DHowett Feb 19, 2021
34e0d0c
This was the only thing Dustin was blocking on
zadjii-msft Feb 19, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/spelling/dictionary/apis.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ IPeasant
IStorage
ITab
ITaskbar
IVirtual
LCID
llabs
llu
Expand All @@ -56,6 +57,7 @@ NCHITTEST
NCLBUTTONDBLCLK
NCRBUTTONDBLCLK
NOAGGREGATION
NOASYNC
NOPROGRESS
NOREDIRECTIONBITMAP
ntprivapi
Expand All @@ -80,6 +82,7 @@ shobjidl
SIZENS
smoothstep
GETDESKWALLPAPER
SHELLEXECUTEINFOW
snprintf
spsc
sregex
Expand Down
10 changes: 10 additions & 0 deletions doc/cascadia/profiles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,16 @@
"type": "string"
}
]
},
"windowingBehavior": {
"default": "useNew",
"description": "Controls how new terminal instances attach to existing windows. \"useNew\" will always create a new window. \"useExisting\" will create new tabs in the most recently used window on this virtual desktop, and \"useAnyExisting\" will create tabs in the most recent window on any desktop.",
"enum": [
"useNew",
"useExisting",
"useAnyExisting"
],
"type": "string"
}
},
"required": [
Expand Down
143 changes: 143 additions & 0 deletions src/cascadia/LocalTests_SettingsModel/CommandTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ namespace SettingsModelLocalTests
TEST_METHOD(TestAutogeneratedName);
TEST_METHOD(TestLayerOnAutogeneratedName);

TEST_METHOD(TestGenerateCommandline);

TEST_CLASS_SETUP(ClassSetup)
{
InitializeJsonReader();
Expand Down Expand Up @@ -361,4 +363,145 @@ namespace SettingsModelLocalTests
VERIFY_ARE_EQUAL(SplitState::Vertical, realArgs.SplitStyle());
}
}

void CommandTests::TestGenerateCommandline()
{
const WEX::TestExecution::DisableVerifyExceptions disableExceptionsScope;

const std::string commands0String{ R"([
{
"name":"action0",
"command": { "action": "newWindow" }
},
{
"name":"action1",
"command": { "action": "newTab", "profile": "foo" }
},
{
"name":"action2",
"command": { "action": "newWindow", "profile": "foo" }
},
{
"name":"action3",
"command": { "action": "newWindow", "commandline": "bar.exe" }
},
{
"name":"action4",
"command": { "action": "newWindow", "commandline": "pop.exe ya ha ha" }
},
{
"name":"action5",
"command": { "action": "newWindow", "commandline": "pop.exe \"ya ha ha\"" }
},
{
"name":"action6",
"command": { "action": "newWindow", "startingDirectory":"C:\\foo", "commandline": "bar.exe" }
},
])" };

const auto commands0Json = VerifyParseSucceeded(commands0String);

IMap<winrt::hstring, Command> commands = winrt::single_threaded_map<winrt::hstring, Command>();
VERIFY_ARE_EQUAL(0u, commands.Size());
auto warnings = implementation::Command::LayerJson(commands, commands0Json);
VERIFY_ARE_EQUAL(0u, warnings.size());
VERIFY_ARE_EQUAL(7u, commands.Size());

{
auto command = commands.Lookup(L"action0");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
VERIFY_ARE_EQUAL(L"", cmdline);
}

{
auto command = commands.Lookup(L"action1");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewTab, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewTabArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
VERIFY_ARE_EQUAL(L"--profile \"foo\"", cmdline);
}

{
auto command = commands.Lookup(L"action2");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
VERIFY_ARE_EQUAL(L"--profile \"foo\"", cmdline);
}

{
auto command = commands.Lookup(L"action3");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
VERIFY_ARE_EQUAL(L"-- \"bar.exe\"", cmdline);
}

{
auto command = commands.Lookup(L"action4");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
Log::Comment(NoThrowString().Format(
L"cmdline: \"%s\"", cmdline.c_str()));
VERIFY_ARE_EQUAL(L"-- \"pop.exe ya ha ha\"", terminalArgs.ToCommandline());
}

{
auto command = commands.Lookup(L"action5");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
Log::Comment(NoThrowString().Format(
L"cmdline: \"%s\"", cmdline.c_str()));
VERIFY_ARE_EQUAL(L"-- \"pop.exe \"ya ha ha\"\"", terminalArgs.ToCommandline());
}

{
auto command = commands.Lookup(L"action6");
VERIFY_IS_NOT_NULL(command);
VERIFY_IS_NOT_NULL(command.Action());
VERIFY_ARE_EQUAL(ShortcutAction::NewWindow, command.Action().Action());
const auto& realArgs = command.Action().Args().try_as<NewWindowArgs>();
VERIFY_IS_NOT_NULL(realArgs);
const auto& terminalArgs = realArgs.TerminalArgs();
VERIFY_IS_NOT_NULL(terminalArgs);
auto cmdline = terminalArgs.ToCommandline();
Log::Comment(NoThrowString().Format(
L"cmdline: \"%s\"", cmdline.c_str()));
VERIFY_ARE_EQUAL(L"--startingDirectory \"C:\\foo\" -- \"bar.exe\"", terminalArgs.ToCommandline());
}
}
}
Loading