summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h5
-rw-r--r--dwm.c28
2 files changed, 30 insertions, 3 deletions
diff --git a/config.h b/config.h
index 873e68c..d4bc132 100644
--- a/config.h
+++ b/config.h
@@ -8,7 +8,7 @@
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 12; /* snap pixel */
-static const int refreshrate = 60;
+static const int refreshrate = 120;
static const int swallowfloating = 1; /* 1 means swallow floating windows by default */
static const int mousedefault = 1; /* 1 means enable mouse by default */
static const char col_gray1[] = "#000000";
@@ -91,6 +91,9 @@ static const Key keys[] = {
{ MODKEY, XK_equal, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.02} },
{ MODKEY, XK_l, setmfact, {.f = +0.02} },
+ { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.10} },
+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.10} },
+ { MODKEY, XK_b, setcfact, {.f = 0.00} },
{ MODKEYTWO, XK_Tab, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY, XK_q, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index eda4750..266ac69 100644
--- a/dwm.c
+++ b/dwm.c
@@ -208,6 +208,7 @@ static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
+static void setcfact(const Arg *arg);
static void setmfact(const Arg *arg);
static void setup(void);
static void showhide(Client *c);
@@ -1892,6 +1893,24 @@ setlayout(const Arg *arg)
arrange(selmon);
}
+void
+setcfact(const Arg *arg) {
+ float f;
+ Client *c;
+
+ c = selmon->sel;
+
+ if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
+ return;
+ f = arg->f + c->cfact;
+ if(arg->f == 0.0)
+ f = 1.0;
+ else if(f < 0.25 || f > 4.0)
+ return;
+ c->cfact = f;
+ arrange(selmon);
+}
+
/* arg > 1.0 will set mfact absolutely */
void
setmfact(const Arg *arg)
@@ -2056,9 +2075,14 @@ spawn(const Arg *arg)
void
swapfocus()
{
+ int n = 0;
Client *c;
- for(c = selmon->clients; c && c != prevclient; c = c->next) ;
- if(c == prevclient)
+ for(c = selmon->clients; c && c != prevclient; c = c->next);
+ for(c = selmon->clients; c; c = c->next) if(ISVISIBLE(c)) n++;;
+ if(n == 2) {
+ Arg arg = {.i = +1};
+ focusstack(&arg);
+ } else if(c == prevclient)
focus(prevclient);
XWarpPointer(dpy, None, selmon->sel->win, 0, 0, 0, 0, selmon->sel->w/2, selmon->sel->h/2);
}