stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] run-or-raise behavior


From: Jay Belanger
Subject: [STUMP] run-or-raise behavior
Date: Tue, 19 Dec 2006 11:27:44 -0600
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.91 (gnu/linux)

I don't know if this is common, but the main reason I use groups is so
I can have more than one easily accessible instance of a program
running.  For example, in group 1 "C-t c" might bring up a terminal in
one directory, and in group 2 "C-t c" might start a terminal to do
some compiling.  However, run-or-raise will now change groups if
necessary to find a particular program.  Is it reasonable to make the
old behavior (stay in the same group) an option?  The following
(trivial) patch will add an allgroups keyword to run-or-raise; if
:allgroups is t (the default), run-or-raise will search all groups
before starting a program, if nil, it will only stay in the current
group.

Jay

*** user.lisp.orig      Tue Dec 19 11:15:45 2006
--- user.lisp   Tue Dec 19 11:16:28 2006
***************
*** 811,817 ****
            (focus-frame group new-frame))
          (show-frame-indicator group))))))
  
! (defun run-or-raise (cmd &key class instance title)
    "If any of class, title, or instance are set and a matching window can
  be found, select it.  Otherwise simply run cmd."
    (labels ((win-app-info (win)
--- 811,817 ----
            (focus-frame group new-frame))
          (show-frame-indicator group))))))
  
! (defun run-or-raise (cmd &key class instance title (allgroups t))
    "If any of class, title, or instance are set and a matching window can
  be found, select it.  Otherwise simply run cmd."
    (labels ((win-app-info (win)
***************
*** 824,830 ****
             (let* ((group (window-group win))
                    (frame (window-frame win))
                    (old-frame (tile-group-current-frame group)))
!              (switch-to-group group)
               (frame-raise-window group frame win)
               (focus-frame group frame)
               (unless (eq frame old-frame)
--- 824,831 ----
             (let* ((group (window-group win))
                    (frame (window-frame win))
                    (old-frame (tile-group-current-frame group)))
!                (if allgroups
!                    (switch-to-group group))
               (frame-raise-window group frame win)
               (focus-frame group frame)
               (unless (eq frame old-frame)
***************
*** 843,862 ****
                        (not b)
                        (string= a b))
                    (app-info-cmp (cdr match1) (cdr match2))))))
!          (find-window (group)
!            (find (list class instance title)
!                  (group-windows group)
!                  :key #'win-app-info
!                  :test #'app-info-cmp)))
      (let ((win
           ;; If no qualifiers are set don't bother looking for a match.
           (and (or class instance title)
!               ;; search all groups
!               (loop
!                  for g in (screen-groups (current-screen))
!                  for win = (find-window g)
!                  when win
!                  return win))))
        (if win
          (goto-win win)
          (run-shell-command cmd)))))
--- 844,868 ----
                        (not b)
                        (string= a b))
                    (app-info-cmp (cdr match1) (cdr match2))))))
!            (find-window (group)
!                         (find (list class instance title)
!                               (group-windows group)
!                               :key #'win-app-info
!                               :test #'app-info-cmp)))
      (let ((win
           ;; If no qualifiers are set don't bother looking for a match.
           (and (or class instance title)
!                 (if allgroups
!                     ;; search all groups
!                     (loop
!                      for g in (screen-groups (current-screen))
!                      for win = (find-window g)
!                      when win
!                      return win)
!                   (find (list class instance title)
!                         (group-windows (screen-current-group 
(current-screen)))
!                         :key #'win-app-info
!                         :test #'app-info-cmp)))))
        (if win
          (goto-win win)
          (run-shell-command cmd)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]