src/clfswm-expose-mode.lisp (expose-query-key-press-hook): Add an option to immediate...
[clfswm.git] / src / netwm-util.lisp
blob9d5eea959ff5ff98ffb760b465e8fd0dbf00b241
1 ;;; --------------------------------------------------------------------------
2 ;;; CLFSWM - FullScreen Window Manager
3 ;;;
4 ;;; --------------------------------------------------------------------------
5 ;;; Documentation: NetWM functions
6 ;;; http://freedesktop.org/wiki/Specifications_2fwm_2dspec
7 ;;; --------------------------------------------------------------------------
8 ;;;
9 ;;; (C) 2012 Philippe Brochard <pbrochard@common-lisp.net>
10 ;;;
11 ;;; This program is free software; you can redistribute it and/or modify
12 ;;; it under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or
14 ;;; (at your option) any later version.
15 ;;;
16 ;;; This program is distributed in the hope that it will be useful,
17 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with this program; if not, write to the Free Software
23 ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 ;;;
25 ;;; --------------------------------------------------------------------------
27 (in-package :clfswm)
30 ;;; Client List functions
31 (defun netwm-set-client-list (id-list)
32 (xlib:change-property *root* :_NET_CLIENT_LIST id-list :window 32))
34 (defun netwm-get-client-list ()
35 (xlib:get-property *root* :_NET_CLIENT_LIST))
37 (defun netwm-add-in-client-list (window)
38 (let ((last-list (netwm-get-client-list)))
39 (pushnew (xlib:window-id window) last-list)
40 (netwm-set-client-list last-list)))
42 (defun netwm-remove-in-client-list (window)
43 (netwm-set-client-list (remove (xlib:window-id window) (netwm-get-client-list))))
47 ;;; Desktop functions ;; +PHIL
48 (defun netwm-update-desktop-property ()
49 ;; (xlib:change-property *root* :_NET_NUMBER_OF_DESKTOPS
50 ;; (list (length *workspace-list*)) :cardinal 32)
51 ;; (xlib:change-property *root* :_NET_DESKTOP_GEOMETRY
52 ;; (list (xlib:screen-width *screen*)
53 ;; (xlib:screen-height *screen*))
54 ;; :cardinal 32)
55 ;; (xlib:change-property *root* :_NET_DESKTOP_VIEWPORT
56 ;; (list 0 0) :cardinal 32)
57 ;; (xlib:change-property *root* :_NET_CURRENT_DESKTOP
58 ;; (list 1) :cardinal 32)
59 ;;; TODO
60 ;;(xlib:change-property *root* :_NET_DESKTOP_NAMES
61 ;; (list "toto" "klm" "poi") :string 8 :transform #'xlib:char->card8))
67 ;;; Taken from stumpwm (thanks)
68 (defun netwm-set-properties ()
69 "Set NETWM properties on the root window of the specified screen.
70 FOCUS-WINDOW is an extra window used for _NET_SUPPORTING_WM_CHECK."
71 ;; _NET_SUPPORTED
72 (xlib:change-property *root* :_NET_SUPPORTED
73 (mapcar (lambda (a)
74 (xlib:intern-atom *display* a))
75 (append +netwm-supported+
76 (mapcar 'car +netwm-window-types+)))
77 :atom 32)
78 ;; _NET_SUPPORTING_WM_CHECK
79 (xlib:change-property *root* :_NET_SUPPORTING_WM_CHECK
80 (list *no-focus-window*) :window 32
81 :transform #'xlib:drawable-id)
82 (xlib:change-property *no-focus-window* :_NET_SUPPORTING_WM_CHECK
83 (list *no-focus-window*) :window 32
84 :transform #'xlib:drawable-id)
85 (xlib:change-property *no-focus-window* :_NET_WM_NAME
86 "clfswm"
87 :string 8 :transform #'xlib:char->card8)
88 (netwm-update-desktop-property))