-
-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Eel work with Microsoft Edge on Linux
- Loading branch information
1 parent
7e88610
commit a6b2963
Showing
3 changed files
with
38 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
import platform | ||
import subprocess as sps | ||
import sys | ||
from typing import List | ||
from typing import List, Optional | ||
|
||
from eel.types import OptionsDictT | ||
|
||
name: str = 'Edge' | ||
|
||
|
||
def run(_path: str, options: OptionsDictT, start_urls: List[str]) -> None: | ||
cmd = 'start microsoft-edge:{}'.format(start_urls[0]) | ||
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True) | ||
def run(path: str, options: OptionsDictT, start_urls: List[str]) -> None: | ||
if path.startswith('start microsoft-edge:'): | ||
cmd = 'start microsoft-edge:{}'.format(start_urls[0]) | ||
sps.Popen(cmd, stdout=sys.stdout, stderr=sys.stderr, stdin=sps.PIPE, shell=True) | ||
else: | ||
args: List[str] = options['cmdline_args'] + start_urls | ||
sps.Popen([path, '--new-window'] + args, | ||
stdout=sps.PIPE, stderr=sys.stderr, stdin=sps.PIPE) | ||
|
||
|
||
def find_path() -> bool: | ||
if platform.system() == 'Windows': | ||
return True | ||
def find_path() -> Optional[str]: | ||
if sys.platform in ['win32', 'win64']: | ||
return _find_edge_win() | ||
elif sys.platform.startswith('linux'): | ||
return _find_edge_linux() | ||
else: | ||
return None | ||
|
||
return False | ||
|
||
def _find_edge_linux() -> Optional[str]: | ||
import whichcraft as wch | ||
return wch.which('microsoft-edge') # type: ignore # whichcraft doesn't currently have type hints | ||
|
||
|
||
def _find_edge_win() -> str: | ||
return 'start microsoft-edge:' |
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