Rename spike to TabbedCasilda, drop timeout and prints, resize window
This commit is contained in:
parent
fc35f4f8fa
commit
88778ecbb4
1 changed files with 10 additions and 9 deletions
|
|
@ -23,16 +23,14 @@ def make_tab(notebook, command):
|
||||||
notebook.append_page(compositor, label)
|
notebook.append_page(compositor, label)
|
||||||
argv = shlex.split(command)
|
argv = shlex.split(command)
|
||||||
if not argv:
|
if not argv:
|
||||||
print(f"skip empty command: {command!r}", flush=True)
|
|
||||||
return
|
return
|
||||||
argv[0] = shutil.which(argv[0]) or argv[0]
|
argv[0] = shutil.which(argv[0]) or argv[0]
|
||||||
ok = compositor.spawn_async(None, argv, None, GLib.SpawnFlags.DEFAULT)
|
compositor.spawn_async(None, argv, None, GLib.SpawnFlags.DEFAULT)
|
||||||
print(f"spawn {argv[0]}: ok={ok}", flush=True)
|
|
||||||
|
|
||||||
|
|
||||||
class Spike(Gtk.Application):
|
class TabbedCasilda(Gtk.Application):
|
||||||
def __init__(self, commands):
|
def __init__(self, commands):
|
||||||
super().__init__(application_id="local.spike")
|
super().__init__(application_id="local.tabbed-casilda")
|
||||||
self.win = None
|
self.win = None
|
||||||
self.commands = commands
|
self.commands = commands
|
||||||
|
|
||||||
|
|
@ -40,14 +38,17 @@ class Spike(Gtk.Application):
|
||||||
if self.win:
|
if self.win:
|
||||||
self.win.present()
|
self.win.present()
|
||||||
return
|
return
|
||||||
win = Gtk.ApplicationWindow(application=self, title="spike")
|
win = Gtk.ApplicationWindow(
|
||||||
win.set_default_size(900, 700)
|
application=self,
|
||||||
|
title="tabbed casilda",
|
||||||
|
default_width=1280,
|
||||||
|
default_height=720,
|
||||||
|
)
|
||||||
nb = Gtk.Notebook()
|
nb = Gtk.Notebook()
|
||||||
win.set_child(nb)
|
win.set_child(nb)
|
||||||
for command in self.commands:
|
for command in self.commands:
|
||||||
make_tab(nb, command)
|
make_tab(nb, command)
|
||||||
win.present()
|
win.present()
|
||||||
GLib.timeout_add(90000, lambda: (self.quit(), False)[1])
|
|
||||||
self.win = win
|
self.win = win
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -62,5 +63,5 @@ if __name__ == "__main__":
|
||||||
help='quoted command, e.g. "foot -T htop"',
|
help='quoted command, e.g. "foot -T htop"',
|
||||||
)
|
)
|
||||||
args = parser.parse_args(sys.argv[1:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
app = Spike(args.commands)
|
app = TabbedCasilda(args.commands)
|
||||||
sys.exit(app.run([sys.argv[0]]))
|
sys.exit(app.run([sys.argv[0]]))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue