-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for multiple Edge profiles
- Loading branch information
1 parent
76171c7
commit 77e41c9
Showing
15 changed files
with
426 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Community.PowerToys.Run.Plugin.EdgeFavorite.Tests/Mocks/MultiProfileManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Davide Giacometti. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Community.PowerToys.Run.Plugin.EdgeFavorite.Helpers; | ||
|
||
namespace Community.PowerToys.Run.Plugin.EdgeFavorite.Tests.Mocks | ||
{ | ||
public class MultiProfileManager : IProfileManager | ||
{ | ||
public ReadOnlyCollection<IFavoriteProvider> FavoriteProviders => (new IFavoriteProvider[] { new DefaultFavoriteProvider(), new WorkFavoriteProvider() }).AsReadOnly(); | ||
|
||
public void ReloadProfiles(bool all) | ||
{ | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Community.PowerToys.Run.Plugin.EdgeFavorite.Tests/Mocks/SingleProfileManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) Davide Giacometti. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Community.PowerToys.Run.Plugin.EdgeFavorite.Helpers; | ||
|
||
namespace Community.PowerToys.Run.Plugin.EdgeFavorite.Tests.Mocks | ||
{ | ||
public class SingleProfileManager : IProfileManager | ||
{ | ||
public ReadOnlyCollection<IFavoriteProvider> FavoriteProviders => (new IFavoriteProvider[] { new DefaultFavoriteProvider() }).AsReadOnly(); | ||
|
||
public void ReloadProfiles(bool all) | ||
{ | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Community.PowerToys.Run.Plugin.EdgeFavorite.Tests/Mocks/WorkFavoriteProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Davide Giacometti. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Community.PowerToys.Run.Plugin.EdgeFavorite.Helpers; | ||
using Community.PowerToys.Run.Plugin.EdgeFavorite.Models; | ||
|
||
namespace Community.PowerToys.Run.Plugin.EdgeFavorite.Tests.Mocks | ||
{ | ||
public class WorkFavoriteProvider : IFavoriteProvider | ||
{ | ||
private readonly ProfileInfo _profileInfo = new("Work", "Profile 1"); | ||
private readonly FavoriteItem _root; | ||
|
||
public FavoriteItem Root => _root; | ||
|
||
public WorkFavoriteProvider() | ||
{ | ||
var coding = new FavoriteItem("Coding", "Coding"); | ||
coding.AddChildren(new FavoriteItem("AWS", "https://aws.amazon.com/", "Coding/AWS", _profileInfo)); | ||
coding.AddChildren(new FavoriteItem("Bitbucket", "https://bitbucket.org/", "Coding/Bitbucket", _profileInfo)); | ||
coding.AddChildren(new FavoriteItem("Microsoft Azure", "https://portal.azure.com/", "Coding/Microsoft Azure", _profileInfo)); | ||
|
||
_root = new FavoriteItem("Favorites bar", string.Empty); | ||
_root.AddChildren(new FavoriteItem("Gmail", "https://mail.google.com/", "Gmail", _profileInfo)); | ||
_root.AddChildren(coding); | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Community.PowerToys.Run.Plugin.EdgeFavorite/Helpers/EdgeHelpers.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) Davide Giacometti. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using System; | ||
using Community.PowerToys.Run.Plugin.EdgeFavorite.Models; | ||
using Wox.Infrastructure; | ||
using Wox.Plugin.Logger; | ||
|
||
namespace Community.PowerToys.Run.Plugin.EdgeFavorite.Helpers | ||
{ | ||
public static class EdgeHelpers | ||
{ | ||
public static void OpenInEdge(FavoriteItem favorite, bool inPrivate) | ||
{ | ||
var args = $"{favorite.Url}"; | ||
|
||
if (inPrivate) | ||
{ | ||
args += " -inprivate"; | ||
} | ||
|
||
args += $" -profile-directory=\"{favorite.Profile.Directory}\""; | ||
|
||
try | ||
{ | ||
Helper.OpenInShell(@"shell:AppsFolder\Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe!App", args); | ||
} | ||
catch (Exception ex) | ||
{ | ||
Log.Exception("Failed to launch Microsoft Edge", ex, typeof(EdgeHelpers)); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.