index.md - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       index.md (1251B)
       ---
            1 focus setting atom
            2 ==================
            3 
            4 Description
            5 -----------
            6 With this patch, dwm monitors the content of the `_DWM_FOCUS` property in the 
            7 root window (a 32-bit cardinal) and sets the focus accordingly, selecting the 
            8 client tags and monitor if needed.
            9 
           10 Usage
           11 -----
           12 After patching, you can use a modified version of lsw to print the window id:
           13 
           14         diff -up lsw-0.1/lsw.c lsw.new/lsw.c
           15         --- lsw-0.1/lsw.c        2006-10-13 11:09:18.000000000 +0200
           16         +++ lsw.new/lsw.c        2010-02-23 15:15:41.468637549 +0100
           17         @@ -63,7 +63,7 @@ main(int argc, char *argv[]) {
           18                                         continue;
           19                                 getname(wins[i]);
           20                                 if(buf[0])
           21         -                                fprintf(stdout, "%s\n", buf);
           22         +                                fprintf(stdout, "%s - %i\n", buf, wins[i]);
           23                         }
           24                 }
           25                 if(wins)
           26 
           27 And then call dmenu to choose a window by title, xprop to set it:
           28 
           29         win="$(lsw | grep -v ^\<unknown\> | dmenu | awk '{print $NF}')"
           30         test $win && xprop -root -f _DWM_FOCUS 32c -set _DWM_FOCUS $win
           31 
           32 Notes
           33 -----
           34 * May not be extremely portable
           35 * You can now use this with mainline lsw by using the -l parameter
           36 * This patch is now historical since dwm supports \_NET\_ACTIVE\_WINDOW
           37 
           38 Download
           39 --------
           40 * [dwm-r1507-focusatom.diff](dwm-r1507-focusatom.diff) (2057 bytes) (20100226)
           41 
           42 Author
           43 ------
           44 * Rafael Garcia - <rafael.garcia.gallego@gmail.com>