Skip to content

Instantly share code, notes, and snippets.

@kobapan
Last active June 9, 2016 03:29
Show Gist options
  • Save kobapan/c5c32f7258b6f5eb68da445547b0cd26 to your computer and use it in GitHub Desktop.
Save kobapan/c5c32f7258b6f5eb68da445547b0cd26 to your computer and use it in GitHub Desktop.
create a virtual terminal for the mutt mail client
#!/usr/bin/env python3
# libvte-2.90-9
from gi.repository import Gtk, Vte, GLib
class VteWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self) # now self means Gtk.Window object
# Create a virtual terminal
terminal = Vte.Terminal()
# Exit if mutt exited
terminal.connect("child-exited", self.on_terminal_child_exited)
# Sync
terminal.fork_command_full(
Vte.PtyFlags.DEFAULT,
GLib.get_home_dir(),
["/usr/bin/mutt"],
[],
GLib.SpawnFlags.DO_NOT_REAP_CHILD,
None,
None,
)
self.add(terminal)
self.set_title("mutt Terminal")
self.connect("delete-event", Gtk.main_quit)
# initial window size
self.resize(1300, 900)
self.show_all()
def on_terminal_child_exited(self, vteterminal):
Gtk.main_quit()
VteWindow()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment