Пример #1
0
def open_browser(url):
    """Open URL in user's browser

    :param str uri: URL to open

    """

    if xdg_open:
        xdg_open(url)
    else:
        try:
            webbrowser.open(url, new=2)
        except webbrowser.Error:
            usage_note("Failed to open link", level=fail)
Пример #2
0
def open_browser(url):
    """Open URL in user’s browser.

    Args:
        uri (str): URL to open
    """

    if xdg_open:
        xdg_open(url)
    else:
        try:
            webbrowser.open(url, new=2)
        except webbrowser.Error:
            usage_note('Failed to open link', level=fail)
Пример #3
0
def cmd_call():
    filename = os.path.expanduser('~/.config/dm/contacts.json')
    with open(filename, encoding='utf-8') as f:
        contacts = json.load(f)
    o = output(dmenu(contacts.keys()))
    xdg_open(contacts[o])
Пример #4
0
def open_resource(target: Path):
    """ Opens a resource file in it's preferred application """
    xdg_open(fix(target))