diff --git a/src/clfswm-util.lisp b/src/clfswm-util.lisp index 6a298f31a3bed71b7c7beb88664e67012517a9fb..841cbedc1f51a6d2291ee789fc2818a2d03fd536 100644 --- a/src/clfswm-util.lisp +++ b/src/clfswm-util.lisp @@ -603,13 +603,21 @@ (let ((commands (command-in-path))) (defun run-program-from-query-string () "Run a program from the query input" - (multiple-value-bind (program return) - (query-string "Run:" "" commands) - (when (and (equal return :return) program (not (equal program ""))) - (setf *second-mode-leave-function* (let ((cmd (concatenate 'string "cd $HOME && " program))) - (lambda () - (do-shell cmd)))) - (leave-second-mode))))) + (labels ((run-program-from-query-string-fun () + (multiple-value-bind (program return) + (query-string "Run:" "" commands) + (when (and (equal return :return) program (not (equal program ""))) + (let ((cmd (concatenate 'string "cd $HOME && exec " program))) + (lambda () + (do-shell cmd))))))) + (let ((fun (run-program-from-query-string-fun))) + (when fun + (if *in-second-mode* + (progn + (setf *second-mode-leave-function* fun) + (leave-second-mode)) + (funcall fun))))))) +