;; send-to-head.jl -- send focused window to next/previous xinerama head ;; ;; Author: Pat Regan ;; fixes by Yann Hodique ;; - make sure newx and newy are integers ;; - fixed involuntary (window) calls ;; - "lispier" design (require 'maximize) (define (send-to-relative-head win offset) (let* ((x (car (window-position win))) (y (cdr (window-position win))) (chx (car (current-head-dimensions win))) (chy (cdr (current-head-dimensions win))) (chox (car (current-head-offset win))) (choy (cdr (current-head-offset win))) (nh (mod (+ (current-head win) offset) (head-count))) (nhx (car (head-dimensions nh))) (nhy (cdr (head-dimensions nh))) (newx (round (+ (* (/ nhx chx) (- x chox)) (car (head-offset nh))))) (newy (round (+ (* (/ nhy chy) (- y choy)) (cdr (head-offset nh)))))) (if (window-maximized-p win) (progn (unmaximize-window win) (move-window-to win newx newy) (maximize-window win)) (move-window-to win newx newy)) ) ) (defun send-to-next-head (w) "Send window to the next head." (interactive "%W") (send-to-relative-head w 1) ) (defun send-to-previous-head (w) "Send window to the next head." (interactive "%W") (send-to-relative-head w -1) ) (provide 'send-to-head)