Skip to content

Commit

Permalink
Fixed Opera (post-blink) private mode (closes #35)
Browse files Browse the repository at this point in the history
  • Loading branch information
zumoshi committed Jun 12, 2018
1 parent 9ed45c7 commit e86c645
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
28 changes: 12 additions & 16 deletions BrowserSelect/Browser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class Browser
public string name;
public string exec;
public Icon icon;
public string additionalArgs="";
public string additionalArgs = "";

public string private_arg
{
Expand All @@ -31,18 +31,14 @@ public string private_arg
return "-private";
if (file.Contains("edge"))
return "-private";
if (file.Contains("launcher"))
return "-private";
return "-private-window"; // FF
}
}

public List<char> shortcuts
{
get
{
// a one liner it is
return Regex.Replace(this.name, @"[^A-Za-z\s]", "").Split(new[] { ' ' }).Select(x => x.Substring(0, 1).ToLower()[0]).ToList();
}
}
public List<char> shortcuts => Regex.Replace(name, @"[^A-Za-z\s]", "").Split(' ')
.Where(x => !string.IsNullOrWhiteSpace(x)).Select(x => x.Substring(0, 1).ToLower()[0]).ToList();
public override string ToString()
{
return name;
Expand Down Expand Up @@ -100,7 +96,7 @@ public static List<Browser> find()
{
string ChromeUserDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), @"Google\Chrome\User Data");
List<string> ChromeProfiles = FindChromeProfiles(ChromeUserDataDir);

if (ChromeProfiles.Count > 1)
{
//add the Chrome instances and remove the default one
Expand Down Expand Up @@ -132,9 +128,9 @@ private static List<string> FindChromeProfiles(string ChromeUserDataDir)
{
List<string> Profiles = new List<string>();
var ProfileDirs = Directory.GetFiles(ChromeUserDataDir, "Google Profile.ico", SearchOption.AllDirectories).Select(Path.GetDirectoryName);
foreach(var Profile in ProfileDirs)
foreach (var Profile in ProfileDirs)
{
Profiles.Add(Profile.Substring(ChromeUserDataDir.Length+1));
Profiles.Add(Profile.Substring(ChromeUserDataDir.Length + 1));
}
return Profiles;
}
Expand All @@ -159,10 +155,10 @@ private static List<Browser> find(RegistryKey hklm)

//0. check if it can handle the http protocol
var capabilities = key.OpenSubKey("Capabilities");
// IE does not have the capabilities subkey...
// so assume that the app can handle http if it doesn't
// advertise it's capablities
if(capabilities != null)
// IE does not have the capabilities subkey...
// so assume that the app can handle http if it doesn't
// advertise it's capablities
if (capabilities != null)
if ((string)capabilities.OpenSubKey("URLAssociations").GetValue("http") == null)
continue;
//1. check if path is not empty
Expand Down
2 changes: 1 addition & 1 deletion BrowserSelect/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private void browser_click(object sender, EventArgs e)
public static void open_url(Browser b, bool incognito = false)
{
var args = new List<string>();
if (!String.IsNullOrEmpty(b.additionalArgs))
if (!string.IsNullOrEmpty(b.additionalArgs))
args.Add(b.additionalArgs);
if (incognito)
args.Add(b.private_arg);
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ it has been tested on windows 7, windows 8.1 and windows 10. requires **.net fra

# Download

you can download browser select here : [Browser select v1.3.9 (205KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.3.9/BrowserSelect.exe)
you can download browser select here : [Browser select v1.4.0 (411KB)](https://github.com/zumoshi/BrowserSelect/releases/download/1.4.0/BrowserSelect.exe)

[![100% safe Award from softpedia](http://s1.softpedia-static.com/_img/sp100free.png?1)](http://www.softpedia.com/get/Internet/Browsers/Browser-Select.shtml#status)

Expand Down Expand Up @@ -74,6 +74,11 @@ just a list of some ideas that can be integrated into BrowserSelect.

# Changelog

v1.4.0 [12/06/18]
- Fixed Opera (post-blink) private mode (#35)
- Chrome profiles are now listed as separate options (#29)
(special thanks to [kueswol](https://github.com/kueswol) for his pull request)

v1.3.9 [06/04/18]
- Fixed Edge private mode (#34)
- Added Alt as alternative to shift for open in private/incognito mode (#33)
Expand Down

0 comments on commit e86c645

Please sign in to comment.