[Sawfish] Patch to set window-type

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


Hi,

Here i have a patch to set the window type for matched windows in
sawfish. You can set the type to normal, dialog, dock, desktop, menu,
toolbar, utility, and splashscreen.

I also know that this patch is not "correct". I also know
_NET_WM_WINDOW_TYPE shouldn't not set by a window manager but sometimes
i have windows with wrong _NET_WM_WINDOW_TYPE set by the application
(for me). Can't maximize window because a other window is a dock but it
should not, or a window is a normal window but it should a dialog etc.

I have no problem if you don't accepted the patch but maybe someone
other find the patch helpful, i use the patch since several month.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
--- sawfish/lisp/sawfish/wm/ext/match-window.jl.orgi
+++ sawfish/lisp/sawfish/wm/ext/match-window.jl
@@ -94,6 +94,7 @@
                                 `(choice ,@(mapcar car match-window-types))))
                  (frame-style ,(lambda ()
                                  `(symbol ,@(find-all-frame-styles t))))
+		 (window-type (choice normal dialog dock desktop menu toolbar utility splashscreen))
 		 (title-position (choice top bottom right left))
 		 (dimensions (pair (number 1) (number 1)))
 		 (maximized (choice all vertical horizontal
@@ -398,6 +399,35 @@
         ;; translate from 1.. to 0..
         (set-window-workspaces w (list (1- value))))))
 
+  (define-match-window-setter 'window-type
+    (lambda (w prop value)
+      (declare (unused prop))
+      (cond ((eq value 'normal)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_NORMAL) 'ATOM 32)
+         (set-window-type w 'default))
+	    ((eq value 'dialog)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_DIALOG) 'ATOM 32)
+         (mark-window-as-transient w))
+        ((eq value 'dock)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_DOCK) 'ATOM 32)
+         (mark-window-as-dock w))
+        ((eq value 'desktop)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_DESKTOP) 'ATOM 32)
+         (mark-window-as-desktop w))
+        ((eq value 'menu)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_MENU) 'ATOM 32)
+         (set-window-type w 'menu))
+        ((eq value 'toolbar)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_TOOLBAR) 'ATOM 32)
+         (set-window-type w 'toolbar))
+        ((eq value 'utility)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_UTILITY) 'ATOM 32)
+         (set-window-type w 'utility))
+        ((eq value 'splashscreen)
+	     (set-x-property w '_NET_WM_WINDOW_TYPE (vector '_NET_WM_WINDOW_TYPE_SPLASHSCREEN) 'ATOM 32)
+         (set-window-type w 'splash)
+         (window-put w 'place-mode 'centered)))))
+
   (define-match-window-setter 'position
     (lambda (w prop value)
       (declare (unused prop))

Attachment: signature.asc
Description: PGP signature



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