Skip to content

Instantly share code, notes, and snippets.

@ZanderBrown
Created April 27, 2017 21:11
Show Gist options
  • Save ZanderBrown/9904d934e6aee0cad5031ec93d551788 to your computer and use it in GitHub Desktop.
Save ZanderBrown/9904d934e6aee0cad5031ec93d551788 to your computer and use it in GitHub Desktop.
Unity LowGFX Toggle

A simple tool to enable disable Unity LowGFX mode.

Inspired whist reading this and a blatent copy of this

As i don't have access to the required Unity version this is compleatly untested

#! /usr/bin/python
 
from gi.repository import Gtk, Gio
 
class Example(Gtk.Window):
def __init__(self):
# Setup the window with title and border width.
Gtk.Window.__init__(self, type=Gtk.WindowType.TOPLEVEL,
title="Unity LowGFX",
resizable=False,
border_width=10)
# Create and bind the Gtk Switch with the gsettings schema and its key.
switch = Gtk.Switch()
setting = Gio.Settings.new("com.canonical.Unity")
setting.bind("lowgfx", switch, "active", Gio.SettingsBindFlags.DEFAULT)
# Create the label for the switch
label = Gtk.Label("Use low GFX mode")
# Position the Switch and its Label inside a Horizontal child box.
box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 40)
box.pack_start(label, False, False, 10)
box.pack_end(switch, False, False, 10)
# Add the child box to the window
self.add(box)
self.connect("destroy", Gtk.main_quit)
self.show_all()
Gtk.main()
if __name__ == "__main__":
Example()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment