2011-02-17 14:43:48 -05:00
|
|
|
#!@PYTHON@
|
|
|
|
# -*- mode: Python; indent-tabs-mode: nil; -*-
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
import optparse
|
|
|
|
|
2019-07-11 12:16:41 -04:00
|
|
|
def extension_command(args):
|
|
|
|
print("gnome-shell-extension-tool is deprecated, use gnome-extensions instead",
|
|
|
|
file=sys.stderr)
|
|
|
|
subprocess.run(["@bindir@/gnome-extensions"] + args)
|
2011-06-22 21:32:08 -04:00
|
|
|
|
2011-10-16 14:24:20 -04:00
|
|
|
def create_extension():
|
2019-07-11 12:16:41 -04:00
|
|
|
extension_command(["create", "--interactive"])
|
2011-10-16 14:24:20 -04:00
|
|
|
|
|
|
|
def enable_extension(uuid):
|
2019-07-11 12:16:41 -04:00
|
|
|
extension_command(["enable", uuid])
|
2011-10-16 14:24:20 -04:00
|
|
|
|
|
|
|
def disable_extension(uuid):
|
2019-07-11 12:16:41 -04:00
|
|
|
extension_command(["disable", uuid])
|
2011-10-16 14:24:20 -04:00
|
|
|
|
2016-10-08 14:23:45 -04:00
|
|
|
def reload_extension(uuid):
|
2019-08-27 04:55:54 -04:00
|
|
|
print("Reloading extensions does not work correctly and is no longer supported",
|
2019-07-11 12:16:41 -04:00
|
|
|
file=sys.stderr)
|
2016-10-08 14:23:45 -04:00
|
|
|
|
2011-10-16 14:24:20 -04:00
|
|
|
def main():
|
|
|
|
parser = optparse.OptionParser()
|
|
|
|
parser.add_option("-d", "--disable-extension", dest="disable",
|
|
|
|
help="Disable a GNOME Shell extension")
|
|
|
|
parser.add_option("-e", "--enable-extension", dest="enable",
|
|
|
|
help="Enable a GNOME Shell extension")
|
|
|
|
parser.add_option("-c", "--create-extension", dest="create", action="store_true",
|
|
|
|
help="Create a new GNOME Shell extension")
|
2016-10-08 14:23:45 -04:00
|
|
|
parser.add_option("-r", "--reload-extension", dest="reload",
|
|
|
|
help="Reload a GNOME Shell extension")
|
2011-10-16 14:24:20 -04:00
|
|
|
options, args = parser.parse_args()
|
|
|
|
|
|
|
|
if args:
|
|
|
|
parser.print_usage()
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if options.disable:
|
|
|
|
disable_extension(options.disable)
|
|
|
|
|
|
|
|
elif options.enable:
|
|
|
|
enable_extension(options.enable)
|
|
|
|
|
|
|
|
elif options.create:
|
|
|
|
create_extension()
|
|
|
|
|
2016-10-08 14:23:45 -04:00
|
|
|
elif options.reload:
|
|
|
|
reload_extension(options.reload)
|
|
|
|
|
2011-10-16 14:24:20 -04:00
|
|
|
else:
|
|
|
|
parser.print_usage()
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|