Created
August 25, 2013 19:55
-
-
Save mtwebster/6335919 to your computer and use it in GitHub Desktop.
Script to use with optirun-desktop.nemo_action. Must be stored in the same folder as the nemo_action file (~/.local/share/nemo/actions) and be set to executable.
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
#! /usr/bin/python -OOt | |
import sys | |
import os | |
from gi.repository import GLib | |
path = sys.argv[1] | |
GROUP = "Desktop Entry" | |
keyfile = GLib.KeyFile.new() | |
if keyfile.load_from_file(path, GLib.KeyFileFlags.NONE): | |
if keyfile.has_group(GROUP): | |
try: | |
cmd = keyfile.get_string(GROUP, "Exec") | |
os.system("optirun %s" % cmd) | |
except GLib.GError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment