@@ -210,6 +210,7 @@ static void focusin(XEvent *e);
210210static void focusmon (const Arg * arg );
211211static void focusstack (const Arg * arg );
212212static Atom getatomprop (Client * c , Atom prop );
213+ static void getgaps (Monitor * m , int * oh , int * ov , int * ih , int * iv , unsigned int * nc );
213214static int getrootptr (int * x , int * y );
214215static long getstate (Window w );
215216static int gettextprop (Window w , Atom atom , char * text , unsigned int size );
@@ -259,8 +260,9 @@ static void spawn(const Arg *arg);
259260static void tag (const Arg * arg );
260261static void tagmon (const Arg * arg );
261262static void togglebar (const Arg * arg );
262- static void togglefloating (const Arg * arg );
263263static void togglecanfocusfloating (const Arg * arg );
264+ static void togglefloating (const Arg * arg );
265+ static void togglegaps (const Arg * arg );
264266static void togglescratch (const Arg * arg );
265267static void togglesticky (const Arg * arg );
266268static void toggletag (const Arg * arg );
@@ -340,6 +342,7 @@ struct Pertag {
340342 unsigned int curtag , prevtag ; /* current and previous tag */
341343 int nmasters [LENGTH (tags ) + 1 ]; /* number of windows in master area */
342344 float mfacts [LENGTH (tags ) + 1 ]; /* mfacts per tag */
345+ int enablegaps [LENGTH (tags ) + 1 ]; /* vanitygaps per tag */
343346 unsigned int sellts [LENGTH (tags ) + 1 ]; /* selected layouts */
344347 const Layout * ltidxs [LENGTH (tags ) + 1 ][2 ]; /* matrix of tags and layouts indexes */
345348 int showbars [LENGTH (tags ) + 1 ]; /* display bar for the current tag */
@@ -825,6 +828,7 @@ createmon(void)
825828 m -> pertag -> nmasters [i ] = m -> nmaster ;
826829 m -> pertag -> mfacts [i ] = m -> mfact ;
827830
831+ m -> pertag -> enablegaps [i ] = enablegaps ;
828832 m -> pertag -> ltidxs [i ][0 ] = m -> lt [0 ];
829833 m -> pertag -> ltidxs [i ][1 ] = m -> lt [1 ];
830834 m -> pertag -> sellts [i ] = m -> sellt ;
@@ -2791,6 +2795,13 @@ togglecanfocusfloating(const Arg *arg)
27912795 arrange (selmon );
27922796}
27932797
2798+ void
2799+ togglegaps (const Arg * arg )
2800+ {
2801+ selmon -> pertag -> enablegaps [selmon -> pertag -> curtag ] = !selmon -> pertag -> enablegaps [selmon -> pertag -> curtag ];
2802+ arrange (NULL );
2803+ }
2804+
27942805void
27952806togglescratch (const Arg * arg )
27962807{
@@ -3303,6 +3314,25 @@ winpid(Window w)
33033314 return result ;
33043315}
33053316
3317+ void
3318+ getgaps (Monitor * m , int * oh , int * ov , int * ih , int * iv , unsigned int * nc )
3319+ {
3320+ unsigned int n , oe , ie ;
3321+ oe = ie = selmon -> pertag -> enablegaps [selmon -> pertag -> curtag ];
3322+ Client * c ;
3323+
3324+ for (n = 0 , c = nexttiled (m -> clients ); c ; c = nexttiled (c -> next ), n ++ );
3325+ if (smartgaps && n == 1 ) {
3326+ oe = 0 ; // outer gaps disabled when only one client
3327+ }
3328+
3329+ * oh = m -> gappoh * oe ; // outer horizontal gap
3330+ * ov = m -> gappov * oe ; // outer vertical gap
3331+ * ih = m -> gappih * ie ; // inner horizontal gap
3332+ * iv = m -> gappiv * ie ; // inner vertical gap
3333+ * nc = n ; // number of clients
3334+ }
3335+
33063336pid_t
33073337getparentprocess (pid_t p )
33083338{
0 commit comments