#!/bin/python ## Run the script, select the area you want to screencast, then stop the script by closing the window. ## The video should output into ~/Videos/pants.webm import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk import dbus import signal from subprocess import call import os class MyWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="Screencaster") self.button = Gtk.Button(label="Finish Screencast") self.button.connect("clicked", Gtk.main_quit) self.add(self.button) bus = dbus.SessionBus() screenshot_object = bus.get_object('org.gnome.Shell.Screenshot', '/org/gnome/Shell/Screenshot') screenshot_interface = dbus.Interface(screenshot_object, 'org.gnome.Shell.Screenshot') screencast_object = bus.get_object('org.gnome.Shell.Screencast', '/org/gnome/Shell/Screencast') screencast_interface = dbus.Interface(screencast_object, 'org.gnome.Shell.Screencast') selectedarea = screenshot_interface.SelectArea() print "byzanz-record -x "+str(selectedarea[0])+" -y "+str(selectedarea[1])+" -w "+str(selectedarea[2])+" -h "+str(selectedarea[3])+" -d 300 pants.gif" os.system("byzanz-record -x "+str(selectedarea[0])+" -y "+str(selectedarea[1])+" -w "+str(selectedarea[2])+" -h "+str(selectedarea[3])+" -d 300 pants.gif") print selectedarea #subprocess.call(["xdg-open", filename[1]])