Re: viewports and workspaces
- From: Brad Barnett <lists L8R net>
- To: sawfish-list gnome org
- Subject: Re: viewports and workspaces
- Date: Wed, 18 Aug 2004 23:05:00 -0400
With help from Ewan Mellor, I've come a long way. However, I still can't
get this working.
Here's the code:
(defvar raise-on-refocus-sivits t)
;;; alist of previously focused windows
(defvar focus-alist-sivits nil)
(defun return-focus-sivits ()
(let ((new-workspace (assoc current-workspace focus-alist-sivits)))
(if (null new-workspace)
(set-screen-viewport 0 0))
(move-viewport-to-window (cdr new-workspace))
(raise-window (cdr new-workspace))
(set-input-focus (cdr new-workspace))
))
(defun save-focus-sivits ()
(let ((old-workspace (assoc current-workspace focus-alist-sivits)))
(if (null old-workspace)
(if (input-focus)
(setq focus-alist-sivits
(cons (cons current-workspace (input-focus))
focus-alist-sivits))) (rplacd old-workspace (input-focus)))))
(add-hook 'leave-workspace-hook save-focus-sivits)
(add-hook 'enter-workspace-hook return-focus-sivits)
This isn't working too well. It almost seems like new-workspace is never
null. I'm also getting errors, such as:
Bad argument: #<subr window-position>, (), 1
Bad argument: #<subr window-position>, (), 1
The code works partially. That is, it will move the viewport to the
last focused window. However, if I have no focused windows, it
doesn't move to viewport 0 0 as I desire.
Any ideas?
On Tue, 10 Aug 2004 18:09:37 -0400
Brad Barnett <lists L8R net> wrote:
>
>
> If I place the code off of that site in my .sawfishrc, I end up with:
>
> Invalid function: save-focus-sivits
> Invalid function: save-focus-sivits
> Invalid function: save-focus-sivits
>
> as the result, every time I try to change workspaces. I have a feelign
> that I'm doing something obviously wrong.. any suggestions? Obviously
> the function isn't being loaded.. so Sawfish doesn't see it...
>
> Thanks!
>
>
> (defvar raise-on-refocus-sivits t)
>
> ;;; alist of previously focused windows
> (defvar focus-alist-sivits nil)
>
> (defun return-focus-sivits ()
> (let ((new-workspace (assoc current-workspace focus-alist-sivits)))
> (when (and (not (null new-workspace))
> (not (null (cdr new-workspace)))
> (equal (window-get (cdr new-workspace) 'workspace) (car
> new-workspace))) (if raise-on-refocus-sivits
> (raise-window (cdr new-workspace)))
> (if (not (eq focus-mode 'click))
> (warp-cursor-to-window (cdr new-workspace))
> (set-input-focus (cdr new-workspace))))))
>
> (defun save-focus-sivits ()
> (let ((old-workspace (assoc current-workspace focus-alist-sivits)))
> (if (null old-workspace)
> (if (input-focus)
> (setq focus-alist-sivits
> (cons (cons current-workspace (input-focus))
> focus-alist-sivits))) (rplacd old-workspace (input-focus)))))
>
> (add-hook 'leave-workspace-hook 'save-focus-sivits)
> (add-hook 'enter-workspace-hook 'return-focus-sivits)
>
>
>
> On Mon, 9 Aug 2004 20:40:24 +0100
> Ewan Mellor <sawfish ewanmellor org uk> wrote:
>
> > On Mon, Aug 09, 2004 at 01:02:23PM -0400, Brad Barnett wrote:
> >
> > >
> > >
> > > Hey all,
> > >
> > > Just wondering if anyone had considered this, or can think of an
> > > easy way to enable it.
> > >
> > > What I'm looking for is viewport position memory. That is, let's
> > > say I have 6 workspaces, and each of these has a viewport 3 high, 1
> > > wide. Now, let's say I consider desktop 6 my "work" workspace.. and
> > > that I typically have xterms open with ssh connections to remote
> > > boxes here.
> > >
> > >
> > > What I would like, is to have Sawfish remember what part of the
> > > viewport I am focused on when I leave and return to a workspace.
> > > So, let's say that I have three different remote machines I am
> > > working on, all for different people. Workspace 6 is still my
> > > "work" workspace, but on the top viewport I have one client, the
> > > middle another, and the bottom a third.
> > >
> > > What would be incredibly convenient is if Sawfish could remember my
> > > position in these viewports. Let's say I am working on the bottom
> > > third viewport, on workspace 6. I move to workspace 2.. do some
> > > work(at the top 1/3 of the viewport) and then return to my "work"
> > > workspace. It would be great if I found myself back on the bottom
> > > third of the viewport.. so I could continue where I left off.
> >
> > workspace-persistant-focus [sic] by Kevin Sivits is an extension that
> > remembers which window you have focussed on each workspace, and then
> > refocusses that window when you return. It should be pretty simple to
> > extend that work to remember the viewport position
> > (viewport-{x,y}-offset) as well. You will need the window-refocussing
> > behaviour in any case, I would have thought.
> >
> > http://www.sics.se/~lofgren/sawmill/repository.html
> >
> > Cheers,
> >
> > Ewan.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]