| multimon-3-added-reset_view-function.diff - sites - public wiki contents of suc… | |
| git clone git://git.suckless.org/sites | |
| Log | |
| Files | |
| Refs | |
| --- | |
| multimon-3-added-reset_view-function.diff (6816B) | |
| --- | |
| 1 From b9f79c3dd07b285e974b2dfdf2371a72467539bb Mon Sep 17 00:00:00 2001 | |
| 2 From: "Gary B. Genett" <[email protected]> | |
| 3 Date: Mon, 24 Mar 2014 14:27:40 -0700 | |
| 4 Subject: added reset_view function | |
| 5 MIME-Version: 1.0 | |
| 6 Content-Type: multipart/mixed; boundary="------------1.8.3.2" | |
| 7 | |
| 8 This is a multi-part message in MIME format. | |
| 9 --------------1.8.3.2 | |
| 10 Content-Type: text/plain; charset=UTF-8; format=fixed | |
| 11 Content-Transfer-Encoding: 8bit | |
| 12 | |
| 13 --- | |
| 14 config.def.h | 8 ++++++++ | |
| 15 dwm.c | 21 +++++++++++++++++++++ | |
| 16 2 files changed, 29 insertions(+) | |
| 17 | |
| 18 | |
| 19 --------------1.8.3.2 | |
| 20 Content-Type: text/x-patch; name="0003-added-reset_view-function.patch" | |
| 21 Content-Transfer-Encoding: 8bit | |
| 22 Content-Disposition: attachment; filename="0003-added-reset_view-functio… | |
| 23 | |
| 24 diff --git a/config.def.h b/config.def.h | |
| 25 index d3b6a4b7bbf244a9d824d99340e5fc6d9ecb8a56..92b1a461604c81c061f60780… | |
| 26 --- a/config.def.h | |
| 27 +++ b/config.def.h | |
| 28 @@ -22,22 +22,28 @@ static const Rule rules[] = { | |
| 29 * WM_NAME(STRING) = title | |
| 30 */ | |
| 31 /* class instance title tags mask isfloating … | |
| 32 { "Gimp", NULL, NULL, 0, True, … | |
| 33 { "Firefox", NULL, NULL, 1 << 8, False, … | |
| 34 }; | |
| 35 | |
| 36 /* layout(s) */ | |
| 37 static const float mfact = 0.55; /* factor of master area size [0.… | |
| 38 static const int nmaster = 1; /* number of clients in master ar… | |
| 39 +static const int nviews = 1; /* number of tags highlighted by … | |
| 40 static const Bool resizehints = True; /* True means respect size hints … | |
| 41 | |
| 42 +static const int master[1]; /* nmaster override per monitor */ | |
| 43 +//static const int master[] = {1,-1}; /* monitor 0 = nmaster 1, monitor… | |
| 44 +static const int views[1]; /* nviews override per monitor */ | |
| 45 +//static const int views[] = {4,~0}; /* monitor 0 = nviews 4, monitor … | |
| 46 + | |
| 47 static const Layout layouts[] = { | |
| 48 /* symbol arrange function */ | |
| 49 { "[]=", tile }, /* first entry is default */ | |
| 50 { "><>", NULL }, /* no layout function means floating b… | |
| 51 { "[M]", monocle }, | |
| 52 }; | |
| 53 | |
| 54 /* key definitions */ | |
| 55 #define WINKEY Mod4Mask | |
| 56 #define MODKEY Mod1Mask | |
| 57 @@ -84,30 +90,32 @@ static Key keys[] = { | |
| 58 { MODKEY|ShiftMask, XK_period, tagmon, {.i … | |
| 59 TAGKEYS( XK_1, 0) | |
| 60 TAGKEYS( XK_2, 1) | |
| 61 TAGKEYS( XK_3, 2) | |
| 62 TAGKEYS( XK_4, 3) | |
| 63 TAGKEYS( XK_5, 4) | |
| 64 TAGKEYS( XK_6, 5) | |
| 65 TAGKEYS( XK_7, 6) | |
| 66 TAGKEYS( XK_8, 7) | |
| 67 TAGKEYS( XK_9, 8) | |
| 68 + { MODKEY, XK_grave, reset_view, {0} … | |
| 69 { MODKEY|ShiftMask, XK_q, quit, {0} … | |
| 70 }; | |
| 71 | |
| 72 /* button definitions */ | |
| 73 /* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, … | |
| 74 static Button buttons[] = { | |
| 75 /* click event mask button functio… | |
| 76 { ClkLtSymbol, 0, Button1, setlayo… | |
| 77 { ClkLtSymbol, 0, Button3, setlayo… | |
| 78 { ClkMonNum, 0, Button1, focusmo… | |
| 79 + { ClkMonNum, 0, Button2, reset_v… | |
| 80 { ClkMonNum, 0, Button3, focusmo… | |
| 81 { ClkWinTitle, 0, Button2, zoom, … | |
| 82 { ClkStatusText, 0, Button2, spawn, … | |
| 83 { ClkClientWin, MODKEY, Button1, movemou… | |
| 84 { ClkClientWin, MODKEY, Button2, togglef… | |
| 85 { ClkClientWin, MODKEY, Button3, resizem… | |
| 86 { ClkTagBar, 0, Button1, view, … | |
| 87 { ClkTagBar, 0, Button3, togglev… | |
| 88 { ClkTagBar, MODKEY|WINKEY, Button1, nview, … | |
| 89 { ClkTagBar, MODKEY|WINKEY, Button3, ntoggle… | |
| 90 diff --git a/dwm.c b/dwm.c | |
| 91 index f6e9588d78a01e3263de54e94bd1559434a802c2..2b3bf5f99c95180cfb5a3bb0… | |
| 92 --- a/dwm.c | |
| 93 +++ b/dwm.c | |
| 94 @@ -227,20 +227,21 @@ static void updatewindowtype(Client *c); | |
| 95 static void updatetitle(Client *c); | |
| 96 static void updatewmhints(Client *c); | |
| 97 static void nview(const Arg *arg); | |
| 98 static void view(const Arg *arg); | |
| 99 static Client *wintoclient(Window w); | |
| 100 static Monitor *wintomon(Window w); | |
| 101 static int xerror(Display *dpy, XErrorEvent *ee); | |
| 102 static int xerrordummy(Display *dpy, XErrorEvent *ee); | |
| 103 static int xerrorstart(Display *dpy, XErrorEvent *ee); | |
| 104 static void zoom(const Arg *arg); | |
| 105 +static void reset_view(const Arg *arg); | |
| 106 | |
| 107 /* variables */ | |
| 108 static const char broken[] = "broken"; | |
| 109 static char stext[256]; | |
| 110 static int screen; | |
| 111 static int sw, sh; /* X display screen geometry width, height… | |
| 112 static int bh, blw, bmw = 0; /* bar geometry */ | |
| 113 static int (*xerrorxlib)(Display *, XErrorEvent *); | |
| 114 static unsigned int numlockmask = 0; | |
| 115 static void (*handler[LASTEvent]) (XEvent *) = { | |
| 116 @@ -2069,28 +2070,48 @@ zoom(const Arg *arg) { | |
| 117 | |
| 118 if(!selmon->lt[selmon->sellt]->arrange | |
| 119 || (selmon->sel && selmon->sel->isfloating)) | |
| 120 return; | |
| 121 if(c == nexttiled(selmon->clients)) | |
| 122 if(!c || !(c = nexttiled(c->next))) | |
| 123 return; | |
| 124 pop(c); | |
| 125 } | |
| 126 | |
| 127 +void | |
| 128 +reset_view(const Arg *arg) { | |
| 129 + const Arg n = {.i = +1}; | |
| 130 + const Arg m = {.f = 1 + mfact}; | |
| 131 + const int mon = selmon->num; | |
| 132 + Arg i = {.i = 0}; | |
| 133 + Arg v = {.ui = 0}; | |
| 134 + do { | |
| 135 + focusmon(&n); | |
| 136 + i.i = (master[selmon->num] ? master[selmon->num] : nmas… | |
| 137 + incnmaster(&i); | |
| 138 + setmfact(&m); | |
| 139 + v.ui = (views[selmon->num] == ~0 ? ~0 : ((1 << (views[s… | |
| 140 + view(&v); | |
| 141 + } | |
| 142 + while (selmon->num != mon); | |
| 143 +} | |
| 144 + | |
| 145 int | |
| 146 main(int argc, char *argv[]) { | |
| 147 if(argc == 2 && !strcmp("-v", argv[1])) | |
| 148 die("dwm-"VERSION", © 2006-2012 dwm engineers, see LIC… | |
| 149 else if(argc != 1) | |
| 150 die("usage: dwm [-v]\n"); | |
| 151 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) | |
| 152 fputs("warning: no locale support\n", stderr); | |
| 153 if(!(dpy = XOpenDisplay(NULL))) | |
| 154 die("dwm: cannot open display\n"); | |
| 155 checkotherwm(); | |
| 156 setup(); | |
| 157 scan(); | |
| 158 + const Arg r = {0}; | |
| 159 + reset_view(&r); | |
| 160 run(); | |
| 161 cleanup(); | |
| 162 XCloseDisplay(dpy); | |
| 163 return EXIT_SUCCESS; | |
| 164 } | |
| 165 | |
| 166 --------------1.8.3.2-- | |
| 167 | |
| 168 |