[Sawfish] Cabinet keybindings patch

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

Patch for cabinet to make broken keybindings work. Add file
heads.jl for multihead stuff. Add send-to-next-head and
send-to-previous-head to sawfish.

What have you do with the german translation? Many translation/strings
(keybindings and other) are remove. Have you use the script in sawfish
for the strings? The script is broken, missing many strings. I have add
the missing strings by hand and it was a lot of work. The german po file
was complete translated.


-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
diff -urNad /usr/share/sawfish.orgi/lisp/sawfish/wm/autoload.jl /usr/share/sawfish/lisp/sawfish/wm/autoload.jl
--- /usr/share/sawfish.orgi/lisp/sawfish/wm/autoload.jl
+++ /usr/share/sawfish/lisp/sawfish/wm/autoload.jl
@@ -176,6 +176,8 @@
 (autoload-placement-mode 'top-left 'sawfish.wm.placement.top-left #:for-normal t)
 (autoload-placement-mode 'stagger 'sawfish.wm.placement.stagger #:for-normal t)
 (autoload-placement-mode 'off-center 'sawfish.wm.placement.off-center #:for-normal t)
+(autoload-command 'send-to-next-head 'sawfish.wm.heads)
+(autoload-command 'send-to-previous-head 'sawfish.wm.heads)
 (autoload-command 'move-viewport-right 'sawfish.wm.viewport)
 (autoload-command 'move-viewport-up 'sawfish.wm.viewport)
 (autoload-command 'move-viewport-down 'sawfish.wm.viewport)
diff -urNad /usr/share/sawfish.orgi/lisp/sawfish/wm/ext/cabinet.jl /usr/share/sawfish/lisp/sawfish/wm/ext/cabinet.jl
--- /usr/share/sawfish.orgi/lisp/sawfish/wm/ext/cabinet.jl
+++ /usr/share/sawfish/lisp/sawfish/wm/ext/cabinet.jl
@@ -18,6 +18,21 @@
 ;; along with this program.  If not, see `http://www.gnu.org/licenses/'.
 
 
+;; XXX Without this, this key-commands not run in cabinet, but i have no idea why.
+;; XXX
+;; XXX maximize-window-toggle maximize-window-fullscreen-toggle
+;; XXX maximize-window-horizontally-toggle maximize-window-vertically-toggle
+;; XXX maximize-window-fullxinerama-toggle maximize-fill-window
+;; XXX maximize-fill-window-horizontally maximize-fill-window-vertically
+;; XXX tab-release-window tab-move-to-end tab-move-to-beginning
+;; XXX tab-move-to-right tab-move-to-left
+;; XXX window-history-save-position window-history-save-dimensions
+;; XXX window-history-save-attributes window-history-forget
+(require 'sawfish.wm.heads)
+(require 'sawfish.wm.state.maximize)
+(require 'sawfish.wm.tabs.tabgroup)
+(require 'sawfish.wm.ext.window-history)
+
 (define-structure sawfish.wm.ext.cabinet
   
     (export cabinet-switch
@@ -251,8 +266,7 @@
     :type* `(alist (event ,(_ "Key:"))
                    ((h-and (symbol 
                             delete-window maximize-window-toggle toggle-window-iconified toggle-window-shaded toggle-window-sticky
-                            maximize-window-fullscreen-toggle maximize-window-horizontally-toggle maximize-window-vertically-toggle
-                            maximize-window-fullxinerama-toggle maximize-full-vertical-left-toggle maximize-full-vertical-right-toggle
+                            maximize-window-fullscreen-toggle maximize-window-horizontally-toggle maximize-window-vertically-toggle maximize-window-fullxinerama-toggle
                             tab-add-maked-windows tab-release-window tab-move-to-end tab-move-to-beginning tab-move-to-right tab-move-to-left
                             move-window-to-center move-window-to-top-left move-window-to-next-workspace move-window-to-previous-workspace
                             toggle-fixed-postion toggle-window-never-focus toggle-window-ignored toggle-task-list-skip toggle-window-cycle-skip
diff -urNad /usr/share/sawfish.orgi/lisp/sawfish/wm/heads.jl /usr/share/sawfish/lisp/sawfish/wm/heads.jl
--- /usr/share/sawfish.orgi/lisp/sawfish/wm/heads.jl
+++ /usr/share/sawfish/lisp/sawfish/wm/heads.jl
@@ -0,0 +1,92 @@
+;; heads.jl -- Multihead support
+
+;; Copyright (C) 2014 fuchur <flohtransporter@xxxxxxxxx>
+
+;; This file is part of sawfish.
+
+;; This program is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or (at
+;; your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see `http://www.gnu.org/licenses/'.
+
+
+(define-structure sawfish.wm.heads
+
+    (export send-to-next-head
+            send-to-previous-head)
+    
+    (open rep
+          rep.data
+          rep.system
+          sawfish.wm.misc
+          sawfish.wm.windows
+          sawfish.wm.commands
+          sawfish.wm.state.maximize
+          sawfish.wm.tabs.tabgroup)
+
+
+  (define (move-win-to-head w head)
+    "Move window to head"
+    (let ((maximized-fullscreen (window-get w 'maximized-fullscreen))
+          (maximized-vertically (window-get w 'maximized-vertically))
+          (maximized-horizontally (window-get w 'maximized-horizontally))
+          is-maximized)
+      
+      (when (window-maximized-p w)
+        (unmaximize-window w)
+        (setq is-maximized t))
+      
+      (let ((dim-x (car (window-position w)))
+            (dim-y (cdr (window-position w)))
+            (head-dim-x (car (current-head-dimensions w)))
+            (head-dim-y (cdr (current-head-dimensions w)))
+            (head-offset-x (car (current-head-offset w)))
+            (head-offset-y (cdr (current-head-offset w)))
+            (wins (tab-group-windows w))
+            (new-head head)
+            new-dim-x new-dim-y new-head-dim-x new-head-dim-y)
+        
+        (setq new-head-dim-x (car (head-dimensions new-head)))
+        (setq new-head-dim-y (cdr (head-dimensions new-head)))
+        (setq new-dim-x (+ (* (/ new-head-dim-x head-dim-x) (- dim-x head-offset-x)) (car (head-offset new-head))))
+        (setq new-dim-y (+ (* (/ new-head-dim-y head-dim-y) (- dim-y head-offset-y)) (cdr (head-offset new-head))))
+        
+        (if (eq is-maximized t)
+            (progn
+              (move-window-to w new-dim-x new-dim-y)
+              (if maximized-fullscreen
+                  (maximize-window-fullscreen w 't)
+                (if maximized-horizontally
+                    (maximize-window-horizontally w))
+                (if maximized-vertically
+                    (maximize-window-vertically w)))
+              (setq is-maximized nil))
+          (mapcar (lambda (w) (move-window-to w new-dim-x new-dim-y)) wins)))))
+  
+  (define (send-to-next-head w)
+    "Send window to the next head."
+    (interactive "%W")
+    (when (> (head-count) 1)
+      (if (< (current-head w) (- (head-count) 1))
+          (move-win-to-head w (+ (current-head w) 1))
+        (move-win-to-head w 0))))
+  
+  (define (send-to-previous-head w)
+    "Send window to the previous head."
+    (interactive "%W")
+    (when (> (head-count) 1)
+      (if (> (current-head w) 0)
+          (move-win-to-head w (- (current-head w) 1))
+        (move-win-to-head w (- (head-count) 1)))))
+  
+  (define-command 'send-to-next-head send-to-next-head #:spec "%W")
+  (define-command 'send-to-previous-head send-to-previous-head #:spec "%W")
+  )

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/