Startup in the home directory when launched by launch services
This commit is contained in:
parent
af1f3cc7c7
commit
3911f18fd9
@ -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)
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user