Re: [dev] [dwm] NetActiveWindow

From: Anselm R Garbe <garbeam_AT_gmail.com>
Date: Thu, 14 Apr 2011 19:21:57 +0200

Hi Andreas,

I applied the patch with some additional rearrangements.

I still don't like the fact to call view() with some Arg from within
dwm, will need to improve this. Arg arguments were only intended for
config.h, but I think we can improve this.

Kind regards,
Anselm

On 14 April 2011 10:37, Andreas Amann <amann_AT_physik.tu-berlin.de> wrote:
> On Wed, Apr 13, 2011 at 06:08:42PM -0400, Peter John Hartman wrote:
>> On Wed, Apr 13, 2011 at 09:28:19PM +0100, Andreas Amann wrote:
>> > WARNING: This e-mail has been altered by MIMEDefang.  Following this
>> > paragraph are indications of the actual changes made.  For more
>> > information about your site's MIMEDefang policy, contact
>> > UCC Hostmaster / MIMEDefang Administrator <hostmaster_AT_ucc.ie>.  For more information about MIMEDefang, see:
>> >
>> >             http://www.roaringpenguin.com/mimedefang/enduser.php3
>> >
>> > An attachment named listwin.sh was removed from this document as it
>> > constituted a security hazard.  If you require this document, please contact
>> > the sender and arrange an alternate means of receiving it.
>> > One way is to rename it to somename.txt and re-send it. The recipient can then save the file and rename it to its original name.
>> >
>>
>> Can you paste listwin.sh?
>>
>
> Sure, see below. I also paste the new version of the patch which now only
> switches on the tags of the selected window.  Another option would be to tag
> the window with the currently visible tags (see what is commented out in the
> patch).  I prefer the first option which works great for me, thanks again!
>
> Andreas
>
>
> diff --git a/dwm.c b/dwm.c
> --- a/dwm.c
> +++ b/dwm.c
> @@ -58,7 +58,7 @@
>  enum { CurNormal, CurResize, CurMove, CurLast };        /* cursor */
>  enum { ColBorder, ColFG, ColBG, ColLast };              /* color */
>  enum { NetSupported, NetWMName, NetWMState,
> -       NetWMFullscreen, NetLast };                      /* EWMH atoms */
> +       NetWMFullscreen, NetActiveWindow, NetLast };     /* EWMH atoms */
>  enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
>  enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
>        ClkClientWin, ClkRootWin, ClkLast };             /* clicks */
> @@ -1286,6 +1286,17 @@
>                        arrange(c->mon);
>                }
>        }
> +       if(c && cme->message_type == netatom[NetActiveWindow]) {
> +            if (!ISVISIBLE(c)){
> +                /* c->tags |= c->mon->tagset[c->mon->seltags]; */
> +                    Arg a = {.ui = c->tags};
> +                    view(&a);
> +            }
> +            detach(c);
> +            attach(c);
> +            focus(c);
> +            arrange(c->mon);
> +       }
>  }
>
>  void
> @@ -1524,6 +1535,7 @@
>        wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
>        wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
>        wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
> +        netatom[NetActiveWindow] = XInternAtom(dpy, "_NET_ACTIVE_WINDOW", False);
>        wmatom[WMTakeFocus] = XInternAtom(dpy, "WM_TAKE_FOCUS", False);
>        netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
>        netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
>
>
> -------------- listwin.sh ---------------------
>
> #!/bin/sh
>
> foo=$(for i in $(xdotool search --onlyvisible --classname ".+"); do
>        win_id="${i}"
>        win_class=$(xprop -id ${win_id} WM_CLASS | cut -d'"' -f2)
>    win_title=$(xprop -id ${win_id} _NET_WM_NAME | cut -d'"' -f2)
>        printf  "%10.10s | %30.30s | %8.8d\n" "${win_class}" "${win_title}" "${win_id}"
> done |sort| dmenu -i -l 10)
> if [ $? -eq 0 ]; then
>        xdotool windowactivate $(echo $foo | awk -F'|' '{ print $NF }')
> fi
>
>
>
Received on Thu Apr 14 2011 - 19:21:57 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 14 2011 - 19:24:02 CEST