diff --git a/kitty/main.py b/kitty/main.py index 058cd6d07..f478e326b 100644 --- a/kitty/main.py +++ b/kitty/main.py @@ -138,6 +138,8 @@ def on_glfw_error(code, msg): def main(): + if os.environ.pop('KITTY_LAUNCHED_BY_LAUNCH_SERVICES', None) == '1' and getattr(sys, 'frozen', True): + os.chdir(os.path.expanduser('~')) args = option_parser().parse_args() if args.cmd: exec(args.cmd) diff --git a/linux-launcher.c b/linux-launcher.c index c3a216e37..9d3e3ef1f 100644 --- a/linux-launcher.c +++ b/linux-launcher.c @@ -46,6 +46,7 @@ static int run_embedded(const char* exe_dir_, int argc, wchar_t **argv) { if (num < 0 || num >= PATH_MAX) { fprintf(stderr, "Failed to create path to kitty lib\n"); return 1; } Py_Initialize(); PySys_SetArgvEx(argc - 1, argv + 1, 0); + PySys_SetObject("frozen", Py_True); // dont care if this fails PyObject *kitty = PyUnicode_FromWideChar(stdlib, -1); if (kitty == NULL) { fprintf(stderr, "Failed to allocate python kitty lib object\n"); goto end; } PyObject *runpy = PyImport_ImportModule("runpy");