Skip to content

Commit 73d727d

Browse files
committedJan 17, 2025
support starting a kitty window with the 'kitten' command
1 parent 29fb02f commit 73d727d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed
 

‎pwnlib/util/misc.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -450,13 +450,11 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr
450450
log.debug("Launching a new terminal: %r" % argv)
451451

452452
stdin = stdout = stderr = open(os.devnull, 'r+b')
453-
if terminal == 'tmux' or terminal == 'kitty':
453+
if terminal == 'tmux' or terminal in ('kitty', 'kitten'):
454454
stdout = subprocess.PIPE
455455

456456
p = subprocess.Popen(argv, stdin=stdin, stdout=stdout, stderr=stderr, preexec_fn=preexec_fn)
457457

458-
kittyid = None
459-
460458
if terminal == 'tmux':
461459
out, _ = p.communicate()
462460
try:
@@ -469,7 +467,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr
469467
with subprocess.Popen((qdbus, konsole_dbus_service, '/Sessions/{}'.format(last_konsole_session),
470468
'org.kde.konsole.Session.processId'), stdout=subprocess.PIPE) as proc:
471469
pid = int(proc.communicate()[0].decode())
472-
elif terminal == 'kitty':
470+
elif terminal in ('kitty', 'kitten'):
473471
pid = p.pid
474472

475473
out, _ = p.communicate()
@@ -503,7 +501,7 @@ def kill():
503501
try:
504502
if terminal == 'qdbus':
505503
os.kill(pid, signal.SIGHUP)
506-
elif terminal == 'kitty':
504+
elif terminal in ('kitty', 'kitten'):
507505
subprocess.Popen(["kitten", "@", "close-window", "--match", "id:{}".format(kittyid)], stderr=stderr)
508506
else:
509507
os.kill(pid, signal.SIGTERM)

0 commit comments

Comments
 (0)