File: openurl.py

package info (click to toggle)
game-data-packager 87
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 33,392 kB
  • sloc: python: 15,387; sh: 704; ansic: 95; makefile: 50
file content (20 lines) | stat: -rwxr-xr-x 539 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python3
# encoding=utf-8

# Open a URL. Command-line compatible with the openurl.sh provided with
# Quake 4, but a lot simpler, and with Flatpak support (via GLib and
# xdg-desktop-portal).

# Copyright © 2016 Simon McVittie <smcv@debian.org>
# SPDX-License-Identifier: FSFAP

import argparse

from gi.repository import Gio

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Open a URL')
    parser.add_argument('url')
    args = parser.parse_args()

    Gio.AppInfo.launch_default_for_uri(args.url)