Created
March 31, 2017 09:31
-
-
Save Barteks2x/3dbb087114ffeb1ba4e73dcb033b9574 to your computer and use it in GitHub Desktop.
A way to make running things with nvidia GPU with nouuveau easier on Cinnamon. These files go into /usr/share/nemo/actions/
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/env python | |
import errno | |
import os | |
import sys | |
from gi.repository import Gio | |
os.environ["DRI_PRIME"] = "1" | |
arg, *rest = sys.argv[1:] | |
if not os.path.isfile(arg): | |
exit("error: not a file: %r" % arg) | |
# check for .desktop mime type as workaround to https://bugs.launchpad.net/ubuntu/+source/gvfs/+bug/378783 | |
if arg.endswith(".desktop"): | |
Gio.DesktopAppInfo.new_from_filename(sys.argv[1]).launch_uris(sys.argv[2:]) | |
else: | |
try: | |
os.execl(arg, arg, *rest) | |
except OSError as e: | |
if e.errno in {errno.ENOEXEC, errno.EACCES}: | |
print("bad file format, trying xdg-open") | |
os.execlp("xdg-open", "xdg-open", arg) | |
else: | |
exit("error: could not run %r: %r" % (arg, e)) |
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
[Nemo Action] | |
Name=Run with PRIME | |
Comment=Run the executable with DRI_PRIME=1 to use nvidia GPU | |
Exec=<run-prime.py %F> | |
Selection=s | |
Mimetypes=application/*; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment