1
$\begingroup$

Is there a way to quit blender from the command line?

I tried

killall -s QUIT blender

However, blender does not quit the same way as it does when pressing CtrlQ, and no quit.blend is saved.

Is there a way to properly and politely quit blender (with a saved quit.blend) from the command line?

$\endgroup$
  • $\begingroup$ I know it's not usable in the command line, but you could use bpy.ops.wm.quit_blender() in a python script. $\endgroup$ – CharlesL Nov 20 '13 at 23:47
  • $\begingroup$ @CharlesL Exactly :/ $\endgroup$ – gandalf3 Nov 21 '13 at 1:35
2
$\begingroup$

I think you could try with wmctrl instead of kill. However it's behavior may be application and windows manager dependant.

wmctrl -xc <WIN>

By default, <WIN> is treated as string to be searched in window title (wmctrl -c blender will close any window containing "blender" in the title). With -x, it will be interpreted as window class, so this invocation:

wmctrl -xc blender

... only closes any window having "blender" as its class name, which is usually Blender itself.

| improve this answer | |
$\endgroup$
  • $\begingroup$ This makes me wonder, how does pressing the X on the window tell blender to close? I always assumed that it sent some signal, but now.. $\endgroup$ – gandalf3 Nov 21 '13 at 1:37
  • $\begingroup$ @gandalf3 Not a signal like those sent by kill, gui apps receive an event to closewindow which it then handles in it's event loop mixed in with other events like keypress or mousedown. If your quitting blender from the cli then there's a good chance your running blender in background mode - without a window to get a closewindow event. $\endgroup$ – sambler Nov 21 '13 at 13:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.