A couple months ago I gave up all those fancy buttons, panels, widgets, icons, and other miscellaneous crap that make using a computer annoying, for a more simplistic approach. The dynamic window manager from suckless provides anything the casual web surfer or hardware design engineer could ever want and nothing more; exactly what a window manager should do. If you're reading this article chances are you already know this, so let's cut the crap.
The traditional Windows XP/2003 method of locking your workstation is pretty slick, just press WindowKey+L and you're good to go. But how do we bring that functionality to DWM? Easy...
Open your config.h:
q9550:/home/sysop/.dwm/dwm-5.6.1# vi config.h
Find this section:
/* key definitions */
#define MODKEY Mod1Mask
#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} },
Modify to look like this:
/* key definitions */
#define MODKEY Mod1Mask
#define WINKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ WINKEY, 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} },
Next, find the commands section, and append:
static const char *slock[] = { "slock", NULL };
Then make your way to the keys section and make it look like this:
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ WINKEY, XK_l, spawn, {.v = slock } },
{ MODKEY, XK_b, togglebar, {0} },
etc...
Save your changes and quit, then recompile dwm.
q9550:/home/sysop/.dwm/dwm-5.6.1# make clean install
Now, if you haven't already, download, extract, and install slock:
http://tools.suckless.org/slock
Finally, ModKey + Shift + Q to shut down dwm gracefully, then startx to fire it back up. Try locking your screen by pressing WindowKey (Mod4) + L. If the screen goes black, you're good to go. If not, you did something wrong, or my directions suck. Either way, let me know and we'll figure it out..
Word Count: 401



0 Comments
[ RSS feed | Trackback URI | Leave a Comment ]
Leave a Comment
Trackback Responses to This Post: