Last active
June 9, 2016 03:29
-
-
Save kobapan/c5c32f7258b6f5eb68da445547b0cd26 to your computer and use it in GitHub Desktop.
create a virtual terminal for the mutt mail client
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 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