Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
2.0 KiB

4 years ago
  1. diff --git a/config.def.h b/config.def.h
  2. index 77ff358..3ba0efe 100644
  3. --- a/config.def.h
  4. +++ b/config.def.h
  5. @@ -84,6 +84,7 @@ static Key keys[] = {
  6. TAGKEYS( XK_8, 7)
  7. TAGKEYS( XK_9, 8)
  8. { MODKEY|ShiftMask, XK_q, quit, {0} },
  9. + { MODKEY, XK_o, winview, {0} },
  10. };
  11. /* button definitions */
  12. diff --git a/dwm.1 b/dwm.1
  13. index 5268a06..1188c82 100644
  14. --- a/dwm.1
  15. +++ b/dwm.1
  16. @@ -104,6 +104,9 @@ Increase master area size.
  17. .B Mod1\-h
  18. Decrease master area size.
  19. .TP
  20. +.B Mod1\-o
  21. +Select view of the window in focus. The list of tags to be displayed is matched to the window tag list.
  22. +.TP
  23. .B Mod1\-Return
  24. Zooms/cycles focused window to/from master area (tiled layouts only).
  25. .TP
  26. diff --git a/dwm.c b/dwm.c
  27. index 1d78655..abf944c 100644
  28. --- a/dwm.c
  29. +++ b/dwm.c
  30. @@ -247,6 +247,7 @@ static void updatewmhints(Client *c);
  31. static void view(const Arg *arg);
  32. static Client *wintoclient(Window w);
  33. static Monitor *wintomon(Window w);
  34. +static void winview(const Arg* arg);
  35. static int xerror(Display *dpy, XErrorEvent *ee);
  36. static int xerrordummy(Display *dpy, XErrorEvent *ee);
  37. static int xerrorstart(Display *dpy, XErrorEvent *ee);
  38. @@ -2080,6 +2081,26 @@ wintomon(Window w) {
  39. return selmon;
  40. }
  41. +/* Selects for the view of the focused window. The list of tags */
  42. +/* to be displayed is matched to the focused window tag list. */
  43. +void
  44. +winview(const Arg* arg){
  45. + Window win, win_r, win_p, *win_c;
  46. + unsigned nc;
  47. + int unused;
  48. + Client* c;
  49. + Arg a;
  50. +
  51. + if (!XGetInputFocus(dpy, &win, &unused)) return;
  52. + while(XQueryTree(dpy, win, &win_r, &win_p, &win_c, &nc)
  53. + && win_p != win_r) win = win_p;
  54. +
  55. + if (!(c = wintoclient(win))) return;
  56. +
  57. + a.ui = c->tags;
  58. + view(&a);
  59. +}
  60. +
  61. /* There's no way to check accesses to destroyed windows, thus those cases are
  62. * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
  63. * default error handler, which may call exit. */