;; sticky-head.jl by Aaron Lehmann ;; Time-stamp: <10-Feb-2004 13:09:10 yann> ;; The author retains copyright of this file but you are free to distribute, ;; modify, and use it as you please. ;; This is a very simple hack that is quite useful to me. I make ;; extensive use of virtual desktops, putting full screen windows on ;; most virtual desktops. This worked great until I got Xinerama. With ;; Xinerama, switching virtual desktops would switch what was on both ;; monitors! Since I like having things side-by-side, it's important ;; that the reference manual I'm looking at on the second head doesn't ;; get moved off the screen when I switch to the virtual desktop with ;; my emacs session on head 1. A very luxurious solution to this ;; problem would be to have Xinerama-aware virtual desktops, so that ;; there are different desktops for each head and you only have to ;; switch the desktop that one head displays at a time. This would be ;; difficult to implement. As you can see from the two lines of code ;; below, what I did end up doing was pretty easy. It involved making ;; virtual desktops only affect the first head by making all windows ;; on the second head "sticky". It's not as good as having seperate ;; virutal desktops for each head, but it sure makes Xinerama much ;; more bearable! ;; You will probably need to modify it if you use a configuration ;; other than a simple two-head configuration with head one being ;; left of head two. (defun analyze (window) (if (>= (car (window-position window)) (car (head-offset 1))) (make-window-sticky window) (make-window-unsticky window))) (mapc (lambda (hook) (add-hook hook analyze)) '(after-move-hook add-window-hook place-window-hook after-initialization-hook))