Rename spike to TabbedCasilda, drop timeout and prints, resize window

This commit is contained in:
Andrew Hamilton 2026-08-13 08:27:25 +10:00
parent fc35f4f8fa
commit 88778ecbb4

View file

@ -23,16 +23,14 @@ def make_tab(notebook, command):
notebook.append_page(compositor, label)
argv = shlex.split(command)
if not argv:
print(f"skip empty command: {command!r}", flush=True)
return
argv[0] = shutil.which(argv[0]) or argv[0]
ok = compositor.spawn_async(None, argv, None, GLib.SpawnFlags.DEFAULT)
print(f"spawn {argv[0]}: ok={ok}", flush=True)
compositor.spawn_async(None, argv, None, GLib.SpawnFlags.DEFAULT)
class Spike(Gtk.Application):
class TabbedCasilda(Gtk.Application):
def __init__(self, commands):
super().__init__(application_id="local.spike")
super().__init__(application_id="local.tabbed-casilda")
self.win = None
self.commands = commands
@ -40,14 +38,17 @@ class Spike(Gtk.Application):
if self.win:
self.win.present()
return
win = Gtk.ApplicationWindow(application=self, title="spike")
win.set_default_size(900, 700)
win = Gtk.ApplicationWindow(
application=self,
title="tabbed casilda",
default_width=1280,
default_height=720,
)
nb = Gtk.Notebook()
win.set_child(nb)
for command in self.commands:
make_tab(nb, command)
win.present()
GLib.timeout_add(90000, lambda: (self.quit(), False)[1])
self.win = win
@ -62,5 +63,5 @@ if __name__ == "__main__":
help='quoted command, e.g. "foot -T htop"',
)
args = parser.parse_args(sys.argv[1:])
app = Spike(args.commands)
app = TabbedCasilda(args.commands)
sys.exit(app.run([sys.argv[0]]))