Re: New window-class proposal, and question on ICCCM & ewmh.



Am Sat, 20 Feb 2010 14:52:05 +0900 (JST)
schrieb Teika Kazura <teika lavabit com>:

> Hi. I'd like window-class to behave as follows:
> (window-class w) ;; We have this now.
> -> "Emacs"
> 
> (window-class w 'full) 
> -> ["emacs" "Emacs" ""] ;; Probably cons is better.
> 
> (window-class w 'configurator)
> -> "Emacs/emacs" ;; sawfish-config "window-rules" style, without ^$
> 
> The following code implements this:
> (define (window-class w #!optional spec)
>     (let ((prop (get-x-text-property w 'WM_CLASS)))
>       (case spec
> 	    ((full)
> 	     prop)
> 	    ((configurator)
> 	     (concat (aref prop 1) "/" (aref prop 0)))
> 	    (t
> 	     (and prop (> (length prop) 1) (aref prop 1))))))
>

good idea

> What's WM_CLASS? WM_CLASS has two elements, "instance" and "class",
> but the current window-class returns the "class" only. This is not
> convenient. Though I don't have GIMP now, it has three windows, so I
> guess the class is common to all, and the instance varies for
> each. Firefox example is "Navigator" for main window, and "Browser"
> for config window, and so on. This will be good, including for
> jump-or-exec. (But firefox is not a good example, since the latter
> seems transient.) Some X applications, like terminals, accept -name
> option which overrides instance.  This is useful for matching, because
> usually terminals constantly change the title as you change the
> directory, so the matching by instance is more reliable.

GIMP Windows have different WINDOW_ROLE gimp-{window,toolbar,dock}. also claws mail
uses WINDOW_ROLE instead of instances. but in both cases same WM_CLASS. FF windows
have same WM_CLASS and WINDOW_ROLE, it's transients have different WM_CLASS and
WINDOW_ROLE. Is window-matching against WINDOW_ROLE possible? ... dunno If I
remember correctly but I guess WINDOW_ROLE is deprecated, though pretty usefull, in
my opinion.

> Now my question: It seems that ICCCM related functions are supposed to
> return nil at failure, but at which point can it fail, and should it
> be checked?

... the only case I could imagine is (get-x-property non-existant-window 'PROP) and
stuff.

> Same for planned "window pid function":
> (define (window-pid win)
>   (aref (caddr (get-x-property x '_NET_WM_PID)) 0))
> 
> It's defined in ewmh.
> 
> Second question: after above enhancement, good matching way for
> get-window-by-class(-re) is like what? "spec" again?

class I guess as instance is in the outermost cases the same, just lower-case.
WINDOW_ROLE is used instead mostly.

> I'm going to add new option 'ignore-case' for
> get-window-by-name/class-re, too.

> Thanks beforehand.
> Teika (Teika kazura)
> 

Chris

-- 

Re[2]: Bin jetzt schon seit über...
Gesendet von kartoffel200 am Do, 10. Dez um 9:00

Nein das heißt Waffen töten nicht sondern ihre User :D

  Re[3]: Bin jetzt schon seit über...
  Gesendet von einem Morgenmuffel am Do, 10. Dez um 10:46

  ...und:
  Computer töten nicht, sondern ihre Schützen!



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