[sawfish] Implemented 'window-pid'. Checked that even if pid is not available it doesn't signal an error (with



commit ecd04c7377dd448c8532cfbaa607154ca618749c
Author: Teika kazura <teika lavabit com>
Date:   Sat Mar 20 13:41:54 2010 +0900

    Implemented 'window-pid'.
    Checked that even if pid is not available it doesn't signal an error (with xv).

 lisp/sawfish/wm/windows.jl |    6 ++++++
 man/news.texi              |    4 ++++
 man/sawfish.texi           |    4 ++++
 3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/lisp/sawfish/wm/windows.jl b/lisp/sawfish/wm/windows.jl
index 266512f..46a8a9a 100644
--- a/lisp/sawfish/wm/windows.jl
+++ b/lisp/sawfish/wm/windows.jl
@@ -35,6 +35,7 @@
 	     mark-window-as-dock
 	     window-in-cycle-p
 	     window-class
+	     window-pid
 	     warp-cursor-to-window
 	     activate-window
 	     constrain-dimension-to-hints
@@ -227,6 +228,11 @@ is returned."
 	  (t
 	   (and prop (> (length prop) 1) (aref prop 1)))))))
 
+  (define (window-pid win)
+    "Returns the window pid, or nil if not available."
+    (when (caddr (get-x-property win '_NET_WM_PID))
+      (aref (caddr (get-x-property win '_NET_WM_PID)) 0)))
+
   (define (get-window-wm-protocols w)
     "Return a list of symbols defining the X11 window manager protocols
 supported by client window W."
diff --git a/man/news.texi b/man/news.texi
index 05c250b..e9a4600 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -41,6 +41,10 @@ Technically, the window class consists of ``instance'' and ``class'',
 but only the latter was returned previously by the function
 @code{window-class}. Now with the new optional argument, the instance
 is returned too. (@pxref{Window Attributes})
+
+ item New function @code{window-pid} [Teika kazura]
+
+It returns the process id of a window. (@pxref{Window Attributes}
 @end itemize
 @item Bugfixes
 @itemize @minus
diff --git a/man/sawfish.texi b/man/sawfish.texi
index 7db917c..ac063a6 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -792,6 +792,10 @@ Return true if @var{window} includes @var{atom} in its
 @code{WM_PROTOCOLS} property.
 @end defun
 
+ defun window-pid window
+Returns the window process id, or nil if not available.
+ end defun
+
 @noindent
 Listed here are window visibility predicates:
 @code{stacking-visibility}, @code{window-obscured} (@pxref{Stacking



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]