~ubuntu-branches/ubuntu/lucid/sawfish/lucid-updates

« back to all changes in this revision

Viewing changes to lisp/sawfish/wm/session/init.jl

  • Committer: Bazaar Package Importer
  • Author(s): Christian Marillat
  • Date: 2005-02-23 16:16:46 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050223161646-4id6qyw4h9lkvb0v
Tags: 1:1.3+cvs20050222-1
* New cvs release.
* Add an emacs initialisation script to load sawfish.el (Closes: #295290)
* Updated sawfish.el to 1.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;; sm-init.jl -- session manager code loaded on startup
2
 
;; $Id: init.jl,v 1.17 2001/01/29 01:34:37 jsh Exp $
 
2
;; $Id: init.jl,v 1.21 2003/08/15 08:09:30 jsh Exp $
3
3
 
4
4
;; Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
5
5
 
23
23
 
24
24
    (export sm-find-file
25
25
            sm-add-saved-properties
 
26
            sm-add-restored-properties
26
27
            sm-get-window-prop
27
28
            sm-save-yourself
28
29
            sm-init)
50
51
  (defvar sm-saved-window-properties nil
51
52
    "List of window properties saved with the session.")
52
53
 
 
54
  (defvar sm-restored-window-properties nil
 
55
    "Extra window properties restored from the session.")
 
56
 
53
57
  (defvar sm-window-save-functions nil
54
58
    "List of functions called when the state of each window is saved. Each
55
59
function should return a list of alist elements that will be saved in
63
67
  (defvar sm-after-restore-hook nil
64
68
    "Hook called after loading a saved session.")
65
69
 
 
70
  (defvar sm-sloppy-id-matching nil
 
71
    "When loading sessions, the algorithm that matches saved session data
 
72
to running clients requires that if one has a session id, then so must
 
73
the other, and they must match. Setting this variable to true turns
 
74
that feature off, allowing some broken clients to be session managed.")
 
75
 
66
76
;;; utilities
67
77
 
68
78
  ;; PREFIX may be null
78
88
                      (cons p sm-saved-window-properties))))
79
89
          props))
80
90
 
 
91
  (define (sm-add-restored-properties #!rest props)
 
92
    (mapc (lambda (p)
 
93
            (or (memq p sm-restored-window-properties)
 
94
                (setq sm-restored-window-properties
 
95
                      (cons p sm-restored-window-properties))))
 
96
          props))
 
97
 
81
98
  ;; find PROP associated with W, or nil
82
99
  (define (sm-get-window-prop w prop)
83
100
    ;; first look in the window itself,
87
104
               (leader (cond ((and (setq tem (get-x-property
88
105
                                              w 'WM_CLIENT_LEADER))
89
106
                                   (eq (car tem) 'WINDOW)
90
 
                                   (eq (nth 1 tem) 32))
 
107
                                   (eq (nth 1 tem) 32)
 
108
                                   (not (zerop (aref (nth 2 tem) 0))))
91
109
                              (aref (nth 2 tem) 0))
92
110
                             ((window-group-id w))
93
111
                             ((window-transient-p w)))))
165
183
 
166
184
      (set-restart-command)
167
185
 
168
 
      (sm-set-property "CurrentDirectory" default-directory)
 
186
      (sm-set-property "CurrentDirectory" (local-file-name default-directory))
169
187
      (sm-set-property "ProcessId" (format nil "%d" (process-id)))
170
188
      (sm-set-property "Program" (car saved-command-line-args))
171
189
      (sm-set-property "UserId" (user-login-name))