Reload config in parent kitty when running the themes kitten

This commit is contained in:
Kovid Goyal 2021-08-07 16:54:47 +05:30
parent 9e2590eb15
commit 4645e78fa7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -8,6 +8,7 @@ import json
import os import os
import re import re
import shutil import shutil
import signal
import tempfile import tempfile
import zipfile import zipfile
from contextlib import suppress from contextlib import suppress
@ -257,6 +258,8 @@ class Theme:
with open(confpath + '.bak', 'w') as f: with open(confpath + '.bak', 'w') as f:
f.write(raw) f.write(raw)
atomic_save(nraw.encode('utf-8'), confpath) atomic_save(nraw.encode('utf-8'), confpath)
if 'KITTY_PID' in os.environ:
os.kill(int(os.environ['KITTY_PID']), signal.SIGUSR1)
class Themes: class Themes: