suckless-patches / dwm-config.h

# HG changeset patch
# Parent 10e232f9ace72da0ff7999b13f3a2b68cd4fa240
# Date 1294783976 -3600
# User Julien Jehannet <julien@smaf.org>
* * *
[mq]: dwm

diff --git a/config.h b/config.h
new file mode 100644
--- /dev/null
+++ b/config.h
@@ -0,0 +1,134 @@
+/* See LICENSE file for copyright and license details. */
+
+/* appearance */
+static const char font[]            = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-u";
+static const char normbordercolor[] = "#333333";
+static const char normbgcolor[]     = "#111111";
+static const char normfgcolor[]     = "#888888";
+static const char selbordercolor[]  = "#ffff00";
+static const char selbgcolor[]      = "#333333";
+static const char selfgcolor[]      = "#ffff00";
+static const unsigned int borderpx  = 1;        /* border pixel of windows */
+static const unsigned int snap      = 4;        /* snap pixel */
+static const Bool showbar           = True;     /* False means no bar */
+static const Bool topbar            = True;     /* False means bottom bar */
+
+/* tagging */
+static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
+
+static const Rule rules[] = {
+	/* xprop(1):
+	 *	WM_CLASS(STRING) = instance, class
+	 *	WM_NAME(STRING) = title
+	 */
+	/* class      instance    title       tags mask     isfloating   monitor */
+	{ "Gimp",     NULL,       NULL,       0,            True,        -1 },
+	{ "Firefox",  NULL,       NULL,       1 << 8,       False,       -1 },
+	{ "QEMU",     NULL,       NULL,       4,            True,        -1 },
+	{ "Xeyes",    NULL,       NULL,       1 << 9,       False,       -1 },
+};
+
+/* layout(s) */
+static const float mfact      = 0.55; /* factor of master area size [0.05..0.95] */
+static const int nmaster      = 1;    /* number of clients in master area */
+static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
+
+static const Layout layouts[] = {
+	/* symbol     arrange function */
+	{ "τ",        tile },    /* first entry is default */
+	{ "≈",        NULL },    /* no layout function means floating behavior */
+	{ "⇔",        monocle },
+};
+
+/* key definitions */
+#define MODKEY Mod4Mask
+#define TAGKEYS(KEY,TAG) \
+	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
+	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
+	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
+	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
+
+/* helper for spawning shell commands in the pre dwm-5.0 fashion */
+//#define SHCMD(cmd) { .v = (const char*[]){ "/bin/zsh", "-c", cmd, NULL } }
+
+/* commands */
+//static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
+static const char *dmenucmd[] = { "/bin/zsh", "-fc", "$(print -lo ${commands:t} | dmenu -p Run)", NULL };
+static const char *surfcmd[] = { "/bin/zsh", "-fc", "surf $(sselp)", NULL };
+static const char *termcmd[]  = { "xterm", NULL };
+static const char *conkycmd[]  = { "conky", NULL };
+static const char *amixercmd[]  = { "amixer", "-q", "set", "Master", NULL };
+static const char *audiomute[]  = { "amixer", "-q", "set", "Master", "toggle", NULL };
+static const char *suspendcmd[]  = { "sudo", "pm-suspend", NULL };
+static const char *scrsavcmd[]  = { "vlock", "-nas", NULL };
+static const char *snapshotcmd[]  = { "import", "-quality", "60", "-comment", "%m:%f %wx%h", "~/screenshot.png", NULL };
+
+static Key keys[] = {
+	/* modifier                     key                     function        argument */
+	{ MODKEY,                       XK_p,                   spawn,          {.v = dmenucmd } },
+	{ MODKEY,                       XK_o,                   spawn,          {.v = surfcmd } },
+	{ MODKEY,                       XK_Return,              spawn,          {.v = termcmd } },
+	{ MODKEY,                       XK_Down,                focusstack,     {.i = +1 } },
+	{ MODKEY,                       XK_Up,                  focusstack,     {.i = -1 } },
+	{ MODKEY,                       XK_Left,                focusstack,     {.i = -1} },
+	{ MODKEY,                       XK_Right,               focusstack,     {.i = +1} },
+	{ MODKEY|ShiftMask,             XK_Left,                setmfact,       {.f = -0.02} },
+	{ MODKEY|ShiftMask,             XK_Right,               setmfact,       {.f = +0.02} },
+	{ MODKEY,                       XK_plus,                incnmaster,     {.i = +1 } },
+	{ MODKEY,                       XK_minus,               incnmaster,     {.i = -1 } },
+	{ MODKEY|ControlMask,           XK_Left,                zoom,           {0} },
+	{ MODKEY|ControlMask,           XK_Right,               zoom,           {0} },
+	{ MODKEY|ControlMask,           XK_Return,              zoom,           {0} },
+	{ MODKEY,                       XK_Tab,                 view,           {0} },
+	{ MODKEY,                       XK_space,               zoom,           {0} },
+	//{ MODKEY|ShiftMask,             XK_space,               setlayout,      {0} },
+	//{ MODKEY|ControlMask,           XK_space,               setlayout,      {.v = &layouts[2]} },
+	{ MODKEY|ControlMask,           XK_space,               setlayout,      {0} },
+	{ MODKEY,                       XK_f,                   setlayout,      {.v = &layouts[2]} },
+	{ MODKEY|ControlMask,           XK_f,                   setlayout,      {.v = &layouts[1]} },
+	{ MODKEY,                       XK_d,                   setlayout,      {.v = &layouts[0]} },
+	{ MODKEY,                       XK_t,                   setlayout,      {.v = &layouts[0]} },
+	{ MODKEY|ShiftMask,             XK_f,                   togglefloating, {0} },
+	{ MODKEY|ControlMask,           XK_Prior,               focusmon,       { .i = -1 } },
+	{ MODKEY|ControlMask,           XK_Next,                focusmon,       { .i = +1 } },
+	{ MODKEY|ShiftMask,             XK_Prior,               tagmon,         { .i = -1 } },
+	{ MODKEY|ShiftMask,             XK_Next,                tagmon,         { .i = +1 } },
+	{ MODKEY,                       XK_agrave,              view,           { .ui = ~0 } },
+	{ MODKEY|ShiftMask,             XK_agrave,              tag,            { .ui = ~0 } },
+	TAGKEYS(                        XK_ampersand,                           0)
+	TAGKEYS(                        XK_eacute,                              1)
+	TAGKEYS(                        XK_quotedbl,                            2)
+	TAGKEYS(                        XK_apostrophe,                          3)
+	TAGKEYS(                        XK_parenleft,                           4)
+	TAGKEYS(                        XK_minus,                               5)
+	TAGKEYS(                        XK_egrave,                              6)
+	TAGKEYS(                        XK_underscore,                          7)
+	TAGKEYS(                        XK_ccedilla,                            8)
+	{ MODKEY,                       XK_b,                   togglebar,      {0} },
+	{ MODKEY,                       XK_BackSpace,           killclient,     {0} },
+	{ MODKEY,                       XK_Print,               spawn,          {.v = snapshotcmd} },
+	{ 0,                            XF86XK_ScreenSaver,     spawn,          {.v = scrsavcmd} },
+	{ 0,                            XF86XK_AudioMute,       spawn,          {.v = audiomute} },
+	{ 0,                            XF86XK_Standby,         spawn,          {.v = suspendcmd} },
+	{ 0,                            XF86XK_AudioLowerVolume,spawn,          {.v = amixercmd} },
+	{ 0,                            XF86XK_AudioRaiseVolume,spawn,          {.v = amixercmd} },
+};
+
+/* button definitions */
+/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
+static Button buttons[] = {
+	/* click                event mask      button          function        argument */
+	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
+	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
+	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
+	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
+	{ ClkStatusText,        0,              Button3,        spawn,          {.v = conkycmd } },
+	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
+	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
+	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
+	{ ClkTagBar,            0,              Button1,        view,           {0} },
+	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
+	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
+	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
+};
+
diff --git a/dwm.c b/dwm.c
--- a/dwm.c
+++ b/dwm.c
@@ -30,10 +30,11 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <X11/cursorfont.h>
 #include <X11/keysym.h>
+#include <X11/XF86keysym.h>
 #include <X11/Xatom.h>
 #include <X11/Xlib.h>
 #include <X11/Xproto.h>
 #include <X11/Xutil.h>
 #ifdef XINERAMA
@@ -203,11 +204,11 @@ static void monocle(Monitor *m);
 static void motionnotify(XEvent *e);
 static void movemouse(const Arg *arg);
 static Client *nexttiled(Client *c);
 static void pop(Client *);
 static void propertynotify(XEvent *e);
-static void quit(const Arg *arg);
+//static void quit(const Arg *arg);
 static Monitor *recttomon(int x, int y, int w, int h);
 static void resize(Client *c, int x, int y, int w, int h, Bool interact);
 static void resizeclient(Client *c, int x, int y, int w, int h);
 static void resizemouse(const Arg *arg);
 static void restack(Monitor *m);
@@ -1331,14 +1332,14 @@ propertynotify(XEvent *e) {
 		if(ev->atom == netatom[NetWMWindowType])
 			updatewindowtype(c);
 	}
 }
 
-void
-quit(const Arg *arg) {
-	running = False;
-}
+//void
+//quit(const Arg *arg) {
+//	running = False;
+//}
 
 Monitor *
 recttomon(int x, int y, int w, int h) {
 	Monitor *m, *r = selmon;
 	int a, area = 0;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.