You are not logged in.
I used this script to set my dwm statusbar, without conky. It handled battery info (among other things) to my satisfaction.
...
If you want more info, just remove the "sed" part.
Thanks! I'll give it a whirl...
Offline
Been tweaking dwm on my EeePC...
The only piece of the puzzle left is a keyboard shortcut to cycle between tags: anyone have a patch for 5.7.2?
/edit config.h
/* See LICENSE file for copyright and license details. */
/* appearance */
#define BOTTOM_MARGIN_HEIGHT 0
static const char font[] = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#222222";
static const char normbgcolor[] = "#3f3f3f";
static const char normfgcolor[] = "#a6a6a6";
static const char selbordercolor[] = "#999999";
static const char selbgcolor[] = "#3f3f3f";
static const char selfgcolor[] = "#d3d3d3";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 0; /* 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[] = { "www", "term", "mail", "misc" };
static const Rule rules[] = {
/* class instance title tags mask isfloating monitor */
{ "Conkeror", NULL, NULL, 1 << 0, False, -1 },
{ "Thunderbird", NULL, NULL, 1 << 2, False, -1 },
{ "Skype", NULL, NULL, 1 << 3, True, -1 },
{ "Filezilla", NULL, NULL, 1 << 3, True, -1 },
{ "Gimp", NULL, NULL, 1 << 3, True, -1 },
};
/* layout(s) */
static const float mfact = 0.60; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = False; /* True means respect size hints in tiled resizals */
static const int nmaster = 2; /* default number of clients in the master area */
#include "bstack.c"
#include "push.c"
#include "nmaster-sym.c"
static const Layout layouts[] = {
/* symbol arrange function */
{ "[T]", tile }, /* first entry is default */
{ "[F]", NULL }, /* no layout = floating */
{ "[M]", monocle },
{ "[S]", bstack },
{ "-|=", ntile },
{ "+T+", nbstack },
};
/* 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/sh", "-c", cmd, NULL } }
/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "urxvt", NULL };
static const char *xtermcmd[] = { "xterm", NULL };
static const char *conkerorcmd[] = { "conkeror", NULL };
static const char *thunderbirdcmd[] = { "thunderbird", NULL };
static Key keys[] = {
/* modifier key function argument */
{ 0, XK_Menu, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ ControlMask|Mod1Mask, XK_t, spawn, {.v = xtermcmd} },
{ ControlMask|Mod1Mask, XK_c, spawn, {.v = conkerorcmd} },
{ ControlMask|Mod1Mask, XK_m, spawn, {.v = thunderbirdcmd} },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY|ControlMask, XK_j, pushdown, {0} },
{ MODKEY|ControlMask, XK_k, pushup, {0} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_a, incnmaster, {.i = +1 } },
{ MODKEY, XK_z, incnmaster, {.i = -1 } },
{ MODKEY, XK_x, setnmaster, {.i = 2 } },
{ MODKEY, XK_s, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_n, setlayout, {.v = &layouts[4] } },
{ MODKEY, XK_o, setlayout, {.v = &layouts[5] } },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
};
/* 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 } },
{ 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} },
};
Last edited by jasonwryan (2009-11-27 08:33:49)
Offline
Been tweaking dwm on my EeePC...
http://farm3.static.flickr.com/2584/413 … 1761_m.jpg http://farm3.static.flickr.com/2648/413 … 582a_m.jpg
The only piece of the puzzle left is a keyboard shortcut to cycle between tags: anyone have a patch for 5.7.2?
/edit config.h
/* See LICENSE file for copyright and license details. */ /* appearance */ #define BOTTOM_MARGIN_HEIGHT 0 static const char font[] = "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*"; static const char normbordercolor[] = "#222222"; static const char normbgcolor[] = "#3f3f3f"; static const char normfgcolor[] = "#a6a6a6"; static const char selbordercolor[] = "#999999"; static const char selbgcolor[] = "#3f3f3f"; static const char selfgcolor[] = "#d3d3d3"; static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 0; /* 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[] = { "www", "term", "mail", "misc" }; static const Rule rules[] = { /* class instance title tags mask isfloating monitor */ { "Conkeror", NULL, NULL, 1 << 0, False, -1 }, { "Thunderbird", NULL, NULL, 1 << 2, False, -1 }, { "Skype", NULL, NULL, 1 << 3, True, -1 }, { "Filezilla", NULL, NULL, 1 << 3, True, -1 }, { "Gimp", NULL, NULL, 1 << 3, True, -1 }, }; /* layout(s) */ static const float mfact = 0.60; /* factor of master area size [0.05..0.95] */ static const Bool resizehints = False; /* True means respect size hints in tiled resizals */ static const int nmaster = 2; /* default number of clients in the master area */ #include "bstack.c" #include "push.c" #include "nmaster-sym.c" static const Layout layouts[] = { /* symbol arrange function */ { "[T]", tile }, /* first entry is default */ { "[F]", NULL }, /* no layout = floating */ { "[M]", monocle }, { "[S]", bstack }, { "-|=", ntile }, { "+T+", nbstack }, }; /* 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/sh", "-c", cmd, NULL } } /* commands */ static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; static const char *termcmd[] = { "urxvt", NULL }; static const char *xtermcmd[] = { "xterm", NULL }; static const char *conkerorcmd[] = { "conkeror", NULL }; static const char *thunderbirdcmd[] = { "thunderbird", NULL }; static Key keys[] = { /* modifier key function argument */ { 0, XK_Menu, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { ControlMask|Mod1Mask, XK_t, spawn, {.v = xtermcmd} }, { ControlMask|Mod1Mask, XK_c, spawn, {.v = conkerorcmd} }, { ControlMask|Mod1Mask, XK_m, spawn, {.v = thunderbirdcmd} }, { MODKEY, XK_b, togglebar, {0} }, { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY|ControlMask, XK_j, pushdown, {0} }, { MODKEY|ControlMask, XK_k, pushup, {0} }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY, XK_a, incnmaster, {.i = +1 } }, { MODKEY, XK_z, incnmaster, {.i = -1 } }, { MODKEY, XK_x, setnmaster, {.i = 2 } }, { MODKEY, XK_s, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_t, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_n, setlayout, {.v = &layouts[4] } }, { MODKEY, XK_o, setlayout, {.v = &layouts[5] } }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) TAGKEYS( XK_4, 3) TAGKEYS( XK_5, 4) TAGKEYS( XK_6, 5) TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) { MODKEY|ShiftMask, XK_q, quit, {0} }, }; /* 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 } }, { 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} }, };
How did you get the icons on your top status bar?
Could you give me your terminal color scheme?
Last edited by zowki (2009-11-27 13:40:55)
How's my programming? Call 1-800-DEV-NULL
Offline
jasonwryan wrote:Been tweaking dwm on my EeePC...
How did you get the icons on your top status bar?
Could you give me your terminal color scheme?
He's using dzen to display his statusbar, not dwm. You can view the related thread here:
thayer williams ~ cinderwick.ca
Offline
So this is my new Asus eee 1005 HA connected to external monitor:
Config here:
/* See LICENSE file for copyright and license details. */
/* appearance */
static const char font[] = "-*-*-medium-*-*-*-10-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#333333";
static const char normbgcolor[] = "#333333";
static const char normfgcolor[] = "#eeeeee";
static const char selbordercolor[] = "#789e2d";
static const char selbgcolor[] = "#333333";
static const char selfgcolor[] = "#789e2d";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int snap = 32; /* 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[] = {
/* class instance title tags mask isfloating monitor */
{ "Gimp", NULL, NULL, 0, True },
{ "Navigator", NULL, NULL, 0, True },
{ "Conky", NULL, NULL, 0, True },
{ "Gajim.py", NULL, NULL, 0, True },
{ "Sonata", NULL, NULL, 0, True },
{ "Gmplayer", NULL, NULL, 0, True },
{ "Xpdf", NULL, NULL, 0, True },
{ "Evince", NULL, NULL, 0, True },
{ "feh", NULL, NULL, 0, True },
{ "Mirage", NULL, NULL, 0, True },
{ "Putty", NULL, NULL, 0, True },
{ "Pidgin", NULL, NULL, 0, True },
{ "pcmanfm", NULL, NULL, 0, True },
{ "OpenOffice.org 3.1", NULL, NULL, 0, True },
{ "trayer", NULL, NULL, 1 << 8, True },
{ "Wicd-client.py", NULL, NULL, 0, True },
{ "Nitrogen", NULL, NULL, 0, True },
{ "Vlc", NULL, NULL, 0, True },
{ "Skype", NULL, NULL, 0, True },
{ "Abiword", NULL, NULL, 0, True },
{ "Gnumeric", NULL, NULL, 0, True },
};
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const Bool resizehints = False; /* False 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 */
{ "[M]", 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/sh", "-c", cmd, NULL } }
/* commands */
static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
static const char *termcmd[] = { "urxvt", NULL };
static const char *menucmd[] = { "9menu", "-popup", "-teleport", "-file", "/home/david/.config/9menu/9menurc", "-bg", normbgcolor, "-fg", selfgcolor, "-font", font, NULL };
static const char *playcmd[] = { "mpc", "play", NULL };
static const char *pausecmd[] = { "mpc", "pause", NULL };
static const char *prevcmd[] = { "mpc", "prev", NULL };
static const char *nextcmd[] = { "mpc", "next", NULL };
static const char *gajimcmd[] = { "gajim", NULL };
static const char *muttcmd[] = { "urxvt", "-e", "mutt", NULL };
static const char *ncmpcppcmd[] = { "urxvt", "-e", "ncmpcpp", NULL };
static const char *irssicmd[] = { "urxvt", "-e", "irssi", NULL };
static const char *firecmd[] = { "firefox", NULL };
static const char *lockcmd[] = { "slock", NULL };
static const char *suspendcmd[] = { "sudo", "pm-suspend", NULL };
static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_a, spawn, {.v = menucmd } },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = suspendcmd } },
{ MODKEY|ShiftMask, XK_z, spawn, {.v = lockcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|ShiftMask, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_F1, 0)
TAGKEYS( XK_F2, 1)
TAGKEYS( XK_F3, 2)
TAGKEYS( XK_F4, 3)
TAGKEYS( XK_F5, 4)
TAGKEYS( XK_F6, 5)
TAGKEYS( XK_F7, 6)
TAGKEYS( XK_F8, 7)
TAGKEYS( XK_F9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ControlMask, XK_b, spawn, {.v = playcmd } },
{ MODKEY|ControlMask, XK_n, spawn, {.v = pausecmd } },
{ MODKEY|ControlMask, XK_v, spawn, {.v = prevcmd } },
{ MODKEY|ControlMask, XK_m, spawn, {.v = nextcmd } },
{ MODKEY|ShiftMask, XK_g, spawn, {.v = gajimcmd } },
{ MODKEY|ShiftMask, XK_m, spawn, {.v = muttcmd } },
{ MODKEY|ShiftMask, XK_n, spawn, {.v = ncmpcppcmd } },
{ MODKEY|ShiftMask, XK_i, spawn, {.v = irssicmd } },
{ MODKEY|ShiftMask, XK_f, spawn, {.v = firecmd } },
};
/* button definitions */
/* click can be a tag number (starting at 0),
* ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
{ ClkRootWin, 0, Button3, spawn, {.v =menucmd } },
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ 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} },
};
Last edited by DawiX (2009-11-27 16:40:27)
xmonad @ Arch + zsh
dwm @ freeBSD +zsh
Registered linux user #495331
http://dawix-net.bluefile.cz
Offline
jasonwryan wrote:Been tweaking dwm on my EeePC...
*snip*
How did you get the icons on your top status bar?
Could you give me your terminal color scheme?
Thayer is right: conky-cli piped to dzen2.
My Xdefaults:
! jwr low contrast
!black
*color0: #222222
*color8: #454545
!red
*color1: #9E5641
*color9: #CC896D
!green
*color2: #6C7E55
*color10: #7DB37D
!yellow
*color3: #CAAF2B
*color11: #BFB556
!blue
*color4: #7C9AA6
*color12: #8FADBF
!magenta
*color5: #956D9D
*color13: #C18FCB
!cyan
*color6: #4c8ea1
*color14: #6bc1d0
!white
*color7: #808080
*color15: #cdcdcd
*borderColor: #343434
*background: #343434
*foreground: #cdcdcd
Offline
I wrote my own patch to dwm that changes the behaviour of windows moving between monitors. Instead of re-tagging the window to the active tag of the destination monitor, it rereads the rules in the config file and attached the corresponding tags if any are specified. Otherwise it falls back to the default behaviour. It only uses this behaviour when tagmon is invoked, dragging a window between screens behaves as it always has.
I did this so I could make sure my web browser and a few other programs stayed within their own particular tags if I had to shuffle windows between different monitors due to a lack of space. Otherwise I have to do the organization manually.
EDIT: spelling
--- a/dwm.c 05:58:16.685464754 -0500
+++ b/dwm.c 2009-11-28 06:03:23.384599060 -0500
@@ -204,7 +204,7 @@
static void restack(Monitor *m);
static void run(void);
static void scan(void);
-static void sendmon(Client *c, Monitor *m);
+static void sendmon(Client *c, Monitor *m, Bool readrules);
static void setclientstate(Client *c, long state);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
@@ -1234,7 +1234,7 @@
} while(ev.type != ButtonRelease);
XUngrabPointer(dpy, CurrentTime);
if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) {
- sendmon(c, m);
+ sendmon(c, m, False);
selmon = m;
focus(NULL);
}
@@ -1355,7 +1355,7 @@
XUngrabPointer(dpy, CurrentTime);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
if((m = ptrtomon(c->x + c->w / 2, c->y + c->h / 2)) != selmon) {
- sendmon(c, m);
+ sendmon(c, m, False);
selmon = m;
focus(NULL);
}
@@ -1423,14 +1423,39 @@
}
void
-sendmon(Client *c, Monitor *m) {
+sendmon(Client *c, Monitor *m, Bool readrules) {
+ const char *class, *instance;
+ unsigned int i;
+ const Rule *r;
+ XClassHint ch = { 0 };
+
if(c->mon == m)
return;
unfocus(c);
detach(c);
detachstack(c);
c->mon = m;
- c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
+ if (!readrules) {
+ c->tags = m->tagset[m->seltags];
+ } else {
+ c->tags = 0;
+ if(XGetClassHint(dpy, c->win, &ch)) {
+ class = ch.res_class ? ch.res_class : broken;
+ instance = ch.res_name ? ch.res_name : broken;
+ for(i = 0; i < LENGTH(rules); i++) {
+ r = &rules[i];
+ if((!r->title || strstr(c->name, r->title))
+ && (!r->class || strstr(class, r->class))
+ && (!r->instance || strstr(instance, r->instance)))
+ c->tags |= r->tags;
+ }
+ if(ch.res_class)
+ XFree(ch.res_class);
+ if(ch.res_name)
+ XFree(ch.res_name);
+ }
+ c->tags = c->tags & TAGMASK ? c->tags & TAGMASK : m->tagset[m->seltags];
+ }
attach(c);
attachstack(c);
focus(NULL);
@@ -1572,9 +1596,16 @@
void
tagmon(const Arg *arg) {
+ Monitor *m;
+
if(!selmon->sel || !mons->next)
return;
- sendmon(selmon->sel, dirtomon(arg->i));
+ m = dirtomon(arg->i);
+ if(selmon->sel->isfloating) {
+ selmon->sel->x += m->mx - selmon->mx;
+ selmon->sel->y += m->my - selmon->my;
+ }
+ sendmon(selmon->sel, m, True);
}
int
Last edited by simongmzlj (2009-11-28 11:21:10)
Offline
The only piece of the puzzle left is a keyboard shortcut to cycle between tags: anyone have a patch for 5.7.2?
i would be interested in such a patch as well. anyone?
Offline
@ccc1 and @jasonwryan: The patch for using Mod-R or L arrow to cycle between tags is integrated into my dwm patches (see configs in my sig). I got it from a post here, I believe, but the original is escaping me at the moment. You'll have to sort through the other patches in the diff file, but it should be pretty obvious which changes are applicable.
Scott
Offline
Hi,
My dwm hg repo :
http://server.julienpecqueur.com:10000
In addition, i use a hacked version of fbpanel as systray :
http://aur.archlinux.org/packages.php?ID=34594
And a conky instance in bottom of the screen :
http://www.julienpecqueur.com/wordpress … ion-conky/
Have fun
[EDIT] : url of mercurial repo was false
Last edited by JPEC (2010-02-27 11:11:03)
Julien Pecqueur (JPEC)
--
[url]http://julienpecqueur.com - Unix, code & web![/url]
HTC Magic (Android) | Shuttle X27D (Archlinux + DWM) | Asus EeeBox (Debian Lenny Server)
Offline
@ccc1 and @jasonwryan: The patch for using Mod-R or L arrow to cycle between tags is integrated into my dwm patches (see configs in my sig).
cheers!
ccc1
patch for cycling between tags (for dwm-5.7.2):
--- a/dwm.c 2009-09-27 21:20:23.000000000 +0200
+++ b/dwm.c 2010-02-01 20:45:19.196759958 +0100
@@ -238,6 +238,9 @@
static int xerrordummy(Display *dpy, XErrorEvent *ee);
static int xerrorstart(Display *dpy, XErrorEvent *ee);
static void zoom(const Arg *arg);
+static void view_next_tag(const Arg *);
+static void view_prev_tag(const Arg *);
+static void view_adjacent_tag(const Arg *, int);
/* variables */
static const char broken[] = "broken";
@@ -2016,3 +2019,38 @@
XCloseDisplay(dpy);
return 0;
}
+
+static void
+view_adjacent_tag(const Arg *arg, int distance)
+{
+ int i, curtags;
+ int seltag = 0;
+ Arg a;
+
+ curtags = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
+ for (i = 0; i < LENGTH(tags); i++) {
+ if ((curtags & (1 << i)) != 0) {
+ seltag = i;
+ break;
+ }
+ }
+
+ seltag = (seltag + distance) % (int)LENGTH(tags);
+ if (seltag < 0)
+ seltag += LENGTH(tags);
+
+ a.i = (1 << seltag);
+ view(&a);
+}
+
+static void
+view_next_tag(const Arg *arg)
+{
+ view_adjacent_tag(arg, +1);
+}
+
+static void
+view_prev_tag(const Arg *arg)
+{
+ view_adjacent_tag(arg, -1);
+}
to use Mod-R or L arrow to cycle between tags, just add the following lines in your config.h (in the appropriate section of course )
{ MODKEY, XK_Left, view_prev_tag, {0} },
{ MODKEY, XK_Right, view_next_tag, {0} },
Last edited by ccc1 (2010-02-01 22:37:17)
Offline
firecat53 wrote:@ccc1 and @jasonwryan: The patch for using Mod-R or L arrow to cycle between tags is integrated into my dwm patches (see configs in my sig).
cheers!
ccc1
I tried applying this patch, but I can't get it to work properly. view_next_tag goes to the 2nd tab and view_prev_tag goes to the last one regardless of current tag set.
Offline
Did you remember to update your config.h with the view_next_tag and view_prev_tag keybinding? ccc1 -- you might want to update your post above to include the portion of the patch for config.h or config.def.h
Scott
Offline
I tried applying this patch, but I can't get it to work properly. view_next_tag goes to the 2nd tab and view_prev_tag goes to the last one regardless of current tag set.
hmm ... strange.
i copy & pasted the patch again in my post above (in case that something went wrong at this point) and tested it again -> works fine here.
ccc1 -- you might want to update your post above to include the portion of the patch for config.h or config.def.h
yep. i'll do that.
ccc1
Offline
@firecat53 Thanks Scott! That works a treat...
@ccc1 Thanks for posting the diff.
On a sadder note, I now have exhausted the tweaking that I can do with dwm (at least until the next version appears...)
Offline
I tried applying this patch, but I can't get it to work properly. view_next_tag goes to the 2nd tab and view_prev_tag goes to the last one regardless of current tag set.
hmm ... strange.
i copy & pasted the patch again in my post above (in case that something went wrong at this point) and tested it again -> works fine here.ccc1 -- you might want to update your post above to include the portion of the patch for config.h or config.def.h
yep. i'll do that.
ccc1
Okay, I tried it again and I got it working this time. Took a slightly different path to it however:
cycle.c:
static void
view_adjacent_tag(const Arg *arg, int distance)
{
int i, curtags;
int seltag = 0;
Arg a;
curtags = selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK);
for (i = 0; i < LENGTH(tags); i++) {
if ((curtags & (1 << i)) != 0) {
seltag = i;
break;
}
}
seltag = (seltag + distance) % (int)LENGTH(tags);
if (seltag < 0)
seltag += LENGTH(tags);
a.i = (1 << seltag);
view(&a);
}
static void
view_next_tag(const Arg *arg)
{
view_adjacent_tag(arg, +1);
}
static void
view_prev_tag(const Arg *arg)
{
view_adjacent_tag(arg, -1);
}
config.h
#include "cycle.c"
static Key keys[] = {
...
...
{ MODKEY, XK_Left, view_prev_tag, {0} },
{ MODKEY, XK_Right, view_next_tag, {0} },
};
This way you don't need to worry about patching.
Offline
...snip...
This way you don't need to worry about patching.
You should submit this to suckless.
Offline
I cleaned it up a bit more
static int
shifttag(int dist)
{
int i, curtags;
int seltag = 0;
curtags = selmon->tagset[selmon->seltags];
for(i = 0; i < LENGTH(tags); i++) {
if((curtags & (1 << i)) != 0) {
seltag = i;
break;
}
}
seltag = (seltag + dist) % LENGTH(tags);
if(seltag < 0)
seltag += LENGTH(tags);
return 1 << seltag;
}
static void
cycle(const Arg *arg)
{
Arg a = { .i = shifttag(arg->i) };
view(&a);
}
static void
tagcycle(const Arg *arg)
{
Arg a = { .i = shifttag(arg->i) };
tag(&a);
view(&a);
}
cycle moves to an adjacent view, tagcycle moves the current window along
EDIT: config.h
#include "cycle.c"
static Key keys[] = {
...
...
{ MODKEY|ControlMask, XK_Left, cycle, {.i = -1} },
{ MODKEY|ControlMask, XK_Right, cycle, {.i = +1} },
{ MODKEY|ShiftMask|ControlMask, XK_Left, tagcycle, {.i = -1} },
{ MODKEY|ShiftMask|ControlMask, XK_Right, tagcycle, {.i = +1} },
};
Last edited by simongmzlj (2010-02-02 02:38:28)
Offline
I also have been a modified version of the transparency patch http://dwm.suckless.org/patches/transparency
My version stores transparency as an integer value from 0 to 100 instead of as a double from 0 to 1 and allows for changing transparency at runtime (mainly useful for floating windows).
opacity.diff
--- a/dwm.c 2010-02-01 18:04:12.774500168 -0500
+++ b/dwm.c 2010-02-01 18:01:33.245764111 -0500
@@ -57,7 +57,7 @@
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { ColBorder, ColFG, ColBG, ColLast }; /* color */
-enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
+enum { NetSupported, NetWMName, NetWMWindowOpacity, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -91,6 +91,7 @@
Client *snext;
Monitor *mon;
Window win;
+ int opacity;
};
typedef struct {
@@ -147,6 +148,7 @@
unsigned int tags;
Bool isfloating;
int monitor;
+ int opacity;
} Rule;
/* function declarations */
@@ -176,6 +179,7 @@
static void drawtext(const char *text, unsigned long col[ColLast], Bool invert);
static void enternotify(XEvent *e);
static void expose(XEvent *e);
+static void opacify(Client *c, int opy);
static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
@@ -297,6 +301,7 @@
&& (!r->instance || strstr(instance, r->instance)))
{
c->isfloating = r->isfloating;
+ c->opacity = r->opacity;
c->tags |= r->tags;
for(m = mons; m && m->num != r->monitor; m = m->next);
if(m)
@@ -811,11 +829,26 @@
}
void
+opacify(Client *c, int opy) {
+ if(opy >= 0 && opy <= 100) {
+ unsigned long opacity[] = { (opy / 100.0) * 0xffffffff };
+ XChangeProperty(dpy, c->win, netatom[NetWMWindowOpacity], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)opacity, 1);
+ } else
+ XDeleteProperty(dpy, c->win, netatom[NetWMWindowOpacity]);
+}
+
+void
focus(Client *c) {
if(!c || !ISVISIBLE(c))
for(c = selmon->stack; c && !ISVISIBLE(c); c = c->snext);
if(selmon->sel)
unfocus(selmon->sel);
+ if(selmon->sel && c != selmon->sel) {
+ if(selmon->sel->opacity == -1)
+ opacify(selmon->sel, shade);
+ else
+ opacify(selmon->sel, MIN(shade, selmon->sel->opacity));
+ }
if(c) {
if(c->mon != selmon)
selmon = c->mon;
@@ -831,6 +861,8 @@
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
selmon->sel = c;
drawbars();
+ if(c)
+ opacify(c, c->opacity);
}
void
@@ -1100,6 +1132,7 @@
updatetitle(c);
if(XGetTransientForHint(dpy, w, &trans))
t = wintoclient(trans);
+ c->opacity = -1;
if(t) {
c->mon = t->mon;
c->tags = t->tags;
@@ -1493,6 +1551,7 @@
wmatom[WMState] = XInternAtom(dpy, "WM_STATE", False);
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
+ netatom[NetWMWindowOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
/* init cursors */
cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr);
cursor[CurResize] = XCreateFontCursor(dpy, XC_sizing);
opacity.c
static void
setopy(const Arg *arg) {
Client *c = selmon->sel;
if(c->opacity == -1 && arg->i < 0)
c->opacity = 100 + arg->i;
else if(c->opacity == -1 && arg->i > 0)
return;
else {
c->opacity += arg->i;
if(c->opacity >= 100)
c->opacity = -1;
else if(c->opacity < 0)
c->opacity = 0;
}
opacify(c, c->opacity);
}
config.h
...
static const int shade = 80;
...
#include "cycle.c"
static Key keys[] = {
...
{ MODKEY|ShiftMask|ControlMask, XK_j, setopy, {.i = -10} },
{ MODKEY|ShiftMask|ControlMask, XK_k, setopy, {.i = +10} },
The Rules files need to be updated with a opacity value as described on the original patches' page.
Offline
cycle moves to an adjacent view, tagcycle moves the current window along
thanks for the patch. the tagcycle function is really handy, but you should change:
seltag = (seltag + dist) % LENGTH(tags);
to
seltag = (seltag + dist) % (int)LENGTH(tags);
otherwise mod is behaving weird. -1 % 6 was suddently 3
ccc1
Offline
simongmzlj wrote:cycle moves to an adjacent view, tagcycle moves the current window along
thanks for the patch. the tagcycle function is really handy, but you should change:
seltag = (seltag + dist) % LENGTH(tags);
to
seltag = (seltag + dist) % (int)LENGTH(tags);
otherwise mod is behaving weird. -1 % 6 was suddently 3
ccc1
I'm not sure I understand. LENGTH(tags) expands to
sizeof tags / sizeof tags[0]
and isn't sizeof supposed to return an unsigned int? What does the cast do? Or maybe theres a different bug here at work. I noticed some other strange behaviour with this patch as well. I'll see what I can do.
Offline
I'm not sure I understand. LENGTH(tags) expands to
sizeof tags / sizeof tags[0]
and isn't sizeof supposed to return an unsigned int? What does the cast do? Or maybe theres a different bug here at work. I noticed some other strange behaviour with this patch as well. I'll see what I can do.
i have no idea why this happens . but without the cast mod behaves strange:
#include <stdio.h>
#define d(x) (sizeof(x)/sizeof(x[0]))
static const char *tags[] = { "1", "2", "3", "4", "5", "6" };
void main()
{
printf ("%d %d %d\n",d(tags),-1 % d(tags),-1 % (int)d(tags));
}
beside that, i haven't noticed any strange behavior with this patch ....
ccc1
Last edited by ccc1 (2010-02-04 01:38:52)
Offline
I understand. The weird behaviour is because I'm lacking the cast. And heres why, btw:
#include <stdio.h>
#define d(x) (sizeof(x)/sizeof(x[0]))
static const char *tags[] = { "1", "2", "3", "4", "5", "6" };
void main()
{
printf ("%d %d %d %d\n",d(tags),-1 % d(tags),-1 % (int)d(tags), (unsigned int)-1 % d(tags));
}
Output is 6 3 -1 3; int % unsigned int seems to yield and unsigned int. To avoid having to explicitly put in a cast I changed the code to this:
seltag += dist;
if(seltag < 0)
seltag = LENGTH(tags) - 1;
else
seltag %= LENGTH(tags);
Offline
My dwm git repo:
http://github.com/JohannesSM64/dwm
Last edited by JohannesSM64 (2010-02-17 17:00:45)
Offline