dwmc: Adding external control to set gaps
This commit is contained in:
@ -18,6 +18,60 @@ setgaps(int oh, int ov, int ih, int iv)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
#if DWMC_PATCH
|
||||
/* External function that takes one integer and splits it
|
||||
* into four gap values:
|
||||
* - outer horizontal (oh)
|
||||
* - outer vertical (ov)
|
||||
* - inner horizontal (ih)
|
||||
* - inner vertical (iv)
|
||||
*
|
||||
* Each value is represented as one byte with the uppermost
|
||||
* bit of each byte indicating whether or not to keep the
|
||||
* current value.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* 10000000 10000000 00001111 00001111
|
||||
* | | | |
|
||||
* + keep oh + keep ov + ih 15px + iv 15px
|
||||
*
|
||||
* This gives an int of:
|
||||
* 10000000100000000000111100001111 = 2155876111
|
||||
*
|
||||
* Thus this command should set inner gaps to 15:
|
||||
* xsetroot -name "fsignal:setgaps i 2155876111"
|
||||
*/
|
||||
static void
|
||||
setgapsex(const Arg *arg)
|
||||
{
|
||||
int oh = selmon->gappoh;
|
||||
int ov = selmon->gappov;
|
||||
int ih = selmon->gappih;
|
||||
int iv = selmon->gappiv;
|
||||
|
||||
if (!(arg->i & (1 << 31)))
|
||||
oh = (arg->i & 0x7f000000) >> 24;
|
||||
if (!(arg->i & (1 << 23)))
|
||||
ov = (arg->i & 0x7f0000) >> 16;
|
||||
if (!(arg->i & (1 << 15)))
|
||||
ih = (arg->i & 0x7f00) >> 8;
|
||||
if (!(arg->i & (1 << 7)))
|
||||
iv = (arg->i & 0x7f);
|
||||
|
||||
/* Auto enable gaps if disabled */
|
||||
#if PERTAG_PATCH
|
||||
if (!selmon->pertag->enablegaps[selmon->pertag->curtag])
|
||||
selmon->pertag->enablegaps[selmon->pertag->curtag] = 1;
|
||||
#else
|
||||
if (!enablegaps)
|
||||
enablegaps = 1;
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
setgaps(oh, ov, ih, iv);
|
||||
}
|
||||
#endif // DWMC_PATCH
|
||||
|
||||
static void
|
||||
togglegaps(const Arg *arg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user