#!/bin/python

import argparse
import subprocess

parser = argparse.ArgumentParser()

parser.add_argument("-t","--toggle", action="store_true")

args = parser.parse_args()

current = subprocess.check_output(["prime-select", "query"]).decode('utf-8').strip()

mapping = {
    "intel": ["nvidia", ""],
    "nvidia": ["intel", ""],
}

if args.toggle:
    subprocess.call(["urxvt", "-e", "sudo", "prime-select", mapping[current][0]])
else:
    print(mapping[current][1])
