Skip to content

Instantly share code, notes, and snippets.

@mtwebster
Created August 25, 2013 19:55
Show Gist options
  • Save mtwebster/6335919 to your computer and use it in GitHub Desktop.
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.
#! /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