stumpwm-devel
[Top][All Lists]
Advanced

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

[STUMP] Help wanted for custom window property, define-window-slot, r un


From: Sharad Pratap
Subject: [STUMP] Help wanted for custom window property, define-window-slot, r un-or-raise
Date: Fri, 31 Jul 2009 00:09:20 +0530

Hi Friends,

I am trying to implement, a little GTD system with emacs in server-mode and planner-mode, for which
I made few function file group.lisp attached.
In this I only implemented initial primitive features, changing the timelog with changing stumpwm group
as stumpwm group I am mapping to planner tasks, in TasksByProjects.muse

my aim is to associate new opened window to current group, and when I will move this window to another
group it also get associated with that group, but it still kept associated with old initail group and all of the
groups it will change. By this I want that when I will change to group A all its associate window will
automatically brought to/raise in group A.

For this I wanted to create my own custom property of window for which I have seen,
`define-window-slot' function available in window.lisp, that I have used like

(define-window-slot "myatt") ;; please correct me if this usage is wrong.
it will define two functions window-myatt and (setf window-myatt)

And based on this this my custom property  I wanted to bring to /raise in  Window in  changed group,
by `run-or-raise' similar command.

But I do not now that how to associate own custom property to new program's window
I tried

(run-or-raise "xterm" '(:myatt "GTD"))

failed!

In below function `run-or-raise' also I did not got any clue how it is associating property to window created by `cmd' arguemnt.

Please suggest correct way to do it.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun run-or-raise (cmd props &optional (all-groups *run-or-raise-all-groups*) (all-screens *run-or-raise-all-screens*))
  "Run the shell command, @var{cmd}, unless an existing window
matches @var{props}. @var{props} is a property list with the following keys:

@table @code
@item :class
Match the window's class.
@item :instance
Match the window's instance or resource-name.
@item :role
Match the window's @code{WM_WINDOW_ROLE}.
@item :title
Match the window's title.
@end table

By default, the global @var{*run-or-raise-all-groups*} decides whether
to search all groups or the current one for a running
instance. @var{all-groups} overrides this default. Similarily for
@var{*run-or-raise-all-screens*} and @var{all-screens}."
  (labels
      ;; Raise the window win and select its frame.  For now, it
      ;; does not select the screen.
      ((goto-win (win)
         (let* ((group (window-group win))
                (frame (window-frame win))
                (old-frame (tile-group-current-frame group)))
           (frame-raise-window group frame win)
           (focus-all win)
           (unless (eq frame old-frame)
             (show-frame-indicator group)))))
    (let* ((matches (find-matching-windows props all-groups all-screens))
           ;; other-matches is list of matches "after" the current
           ;; win, if current win matches. getting 2nd element means
           ;; skipping over the current win, to cycle through matches
           (other-matches (member (current-window) matches))
           (win (if (> (length other-matches) 1)
                    (second other-matches)
                    (first matches))))
      (if win
          (goto-win win)
          (run-shell-command cmd)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

--
Regard
-sharad
reply via email to

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