Skip to content

Commit

Permalink
Basic support for Edge-chromium browser under Windows and MacOS (#188)
Browse files Browse the repository at this point in the history
* edge chromium

* mac

* extract const
  • Loading branch information
AlexKamaev authored and miherlosev committed Dec 31, 2019
1 parent 58d20d8 commit 413c11c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ const ALIASES = {
macOpenCmdTemplate: `open -n -a "{{{path}}}" --args /dev/null open {{{pageUrl}}} {{{cmd}}}`
},

'edge-chromium': {
nameRe: /edge\s*beta/i,
cmd: '--new-window',
macOpenCmdTemplate: 'open -n -a "{{{path}}}" --args {{{pageUrl}}} {{{cmd}}}'
},

'edge': {
nameRe: /edge/i,
cmd: '',
Expand Down
4 changes: 3 additions & 1 deletion src/api/get-installations.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const MICROSOFT_EDGE_CLASS = 'Microsoft.MicrosoftEdge';
const MICROSOFT_EDGE_KEY_GLOB = `HKCU\\Software\\Classes\\ActivatableClasses\\Package\\${MICROSOFT_EDGE_CLASS}*`;
const BROWSER_COMMANDS_KEY_GLOB = root => `${root}\\Software\\Clients\\StartMenuInternet\\*\\shell\\open\\command`;

const MACOS_GET_BROWSER_LIST_COMMAND = 'ls "/Applications/" | grep -E "Chrome|Firefox|Opera|Safari|Chromium|Edge Beta" | sed -E "s/ /032/"';

const LINE_WRAP = '\r\n';
const DOUBLE_LINE_WRAP = LINE_WRAP + LINE_WRAP;

Expand Down Expand Up @@ -113,7 +115,7 @@ async function findMacBrowsers () {
var installations = {};

// NOTE: replace the space symbol with code, because grep splits strings by space.
var stdout = await exec('ls "/Applications/" | grep -E "Chrome|Firefox|Opera|Safari|Chromium" | sed -E "s/ /032/"');
var stdout = await exec(MACOS_GET_BROWSER_LIST_COMMAND);

await Promise.all(stdout
.split('\n')
Expand Down

0 comments on commit 413c11c

Please sign in to comment.