You are not logged in.
@pks
if there is more than one client in stack you can see gap which increases every time a new client is spawned in stack
Offline
@pks
if there is more than one client in stack you can see gap which increases every time a new client is spawned in stack
Yeah, I've spotted that issue as well, it's some kind of rounding error. I'll think of a fix.
Edit: I've updated the patch, it works for me now without the increasing-gaps-issue.
diff --git a/config.def.h b/config.def.h
index 875885b..3dbd05f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -65,6 +65,8 @@ static Key keys[] = {
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.05} },
+ { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
diff --git a/dwm.c b/dwm.c
index 1bbb4b3..f16ab61 100644
--- a/dwm.c
+++ b/dwm.c
@@ -86,6 +86,7 @@ typedef struct Client Client;
struct Client {
char name[256];
float mina, maxa;
+ float cfact;
int x, y, w, h;
int oldx, oldy, oldw, oldh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
@@ -200,6 +201,7 @@ static void setclientstate(Client *c, long state);
static void setfocus(Client *c);
static void setfullscreen(Client *c, Bool 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);
@@ -1027,6 +1029,7 @@ manage(Window w, XWindowAttributes *wa) {
c->w = c->oldw = wa->width;
c->h = c->oldh = wa->height;
c->oldbw = wa->border_width;
+ c->cfact = 1.0;
if(c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
c->x = c->mon->mx + c->mon->mw - WIDTH(c);
@@ -1473,6 +1476,21 @@ setlayout(const Arg *arg) {
drawbar(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(f < 0.25 || f > 4.0)
+ return;
+ c->cfact = f;
+ arrange(selmon);
+}
+
/* arg > 1.0 will set mfact absolutly */
void
setmfact(const Arg *arg) {
@@ -1602,9 +1620,15 @@ tagmon(const Arg *arg) {
void
tile(Monitor *m) {
unsigned int i, n, h, mw, my, ty;
+ float mfacts = 0, sfacts = 0;
Client *c;
- for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
+ for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) {
+ if(n < m->nmaster)
+ mfacts += c->cfact;
+ else
+ sfacts += c->cfact;
+ }
if(n == 0)
return;
@@ -1614,14 +1638,16 @@ tile(Monitor *m) {
mw = m->ww;
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if(i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
+ h = (m->wh - my) * (c->cfact / mfacts) + 0.5;
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
my += HEIGHT(c);
+ mfacts -= c->cfact;
}
else {
- h = (m->wh - ty) / (n - i);
+ h = (m->wh - ty) * (c->cfact / sfacts) + 0.5;
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
ty += HEIGHT(c);
+ sfacts -= c->cfact;
}
}
Last edited by pks (2014-01-07 11:52:02)
Offline
Unia wrote:I'll hack it in right now I'll be back
EDIT: Not sure if this is intended behaviour, but if I have three clients in the stack and I resize the bottom one to the smallest, I expected the other two would equally share the remaining space but this is not the case.
Edit: Are you sure you didn't accidentaly modify the other client's cfacts?
I just tried it on a fresh boot and now they indeed equally share the space, so I guess I did Sorry for the confusion!
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
pks wrote:Unia wrote:I'll hack it in right now I'll be back
EDIT: Not sure if this is intended behaviour, but if I have three clients in the stack and I resize the bottom one to the smallest, I expected the other two would equally share the remaining space but this is not the case.
Edit: Are you sure you didn't accidentaly modify the other client's cfacts?
I just tried it on a fresh boot and now they indeed equally share the space, so I guess I did Sorry for the confusion!
No problem, glad it works now
Offline
I have modified the setcfact function a small bit, so you can easily reset a client's cfact to 1.0 (because, sometimes, I don't quite see when it is 0.95 or 1.0).
void
setcfact(const Arg *arg) {
float f;
Client *c;
c = selmon->sel;
if(!arg || !c || !selmon->lt[selmon->sellt]->arrange)
return;
if(arg->f == 0.0)
f = 1.0;
else {
f = arg->f + c->cfact;
if(f < 0.25 || f > 4.0)
return;
}
c->cfact = f;
arrange(selmon);
}
And in config.h:
{ MODKEY|ShiftMask, XK_0, setcfact, {.f = 0.0} },
If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres
Offline
I have modified the setcfact function a small bit, so you can easily reset a client's cfact to 1.0 (because, sometimes, I don't quite see when it is 0.95 or 1.0).
void setcfact(const Arg *arg) { float f; Client *c; c = selmon->sel; if(!arg || !c || !selmon->lt[selmon->sellt]->arrange) return; if(arg->f == 0.0) f = 1.0; else { f = arg->f + c->cfact; if(f < 0.25 || f > 4.0) return; } c->cfact = f; arrange(selmon); }
And in config.h:
{ MODKEY|ShiftMask, XK_0, setcfact, {.f = 0.0} },
That's definitly useful, I'll add it to my patch, thanks. Guess I'll send it to the suckless mailing list this evening.
Offline
Hi, i am fine with default dwm-6.1,
but sometimes wish to have 3 columns.
i have tried flextile patch, but it doesn't works for me.
Offline
modified dwm 6.1 default tile layout, so this KISS n columns.
vi dwm.c
void
tile(Monitor *m) {
...
for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
- if(i < m->nmaster) {
- h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
- my += HEIGHT(c);
- }
- else {
- h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
- ty += HEIGHT(c);
- }
+ {
+ h = (m->wh - my) / MIN(n, m->nmaster);
+ resize(c, m->ww * i/n, m->wy + my, m->ww/n, h, False);
+ }
Offline
I've set dwm to start in floating mode. Currently, all windows open in the upper left corner of the screen. How can I set them to open in the center by default? Thanks!
Offline
This isn't a support thread.
Offline
This isn't a support thread.
Thanks and I apologize. Please delete my post as I re-posted the question here: https://bbs.archlinux.org/viewtopic.php … 4#p1372564
Offline
When I set dwm to floating mode, all new windows open in the upper left corner of the screen. How could I position them in the center by default?
Thanks!
Try this
In your config.h
static const Rule rules[] = {
/* class instance title tags mask isfloating iscentred monitor */
{ "Gimp", NULL, NULL, 0, True, False, -1 },
{ "MPlayer", NULL, NULL, 0, True, True, -1 },
....
apply to dwm.c this patch
http://hg.punctweb.ro/dwm/src/3299f6adc … at=default
Offline
In your config.h
static const Rule rules[] = {
/* class instance title tags mask isfloating iscentred monitor */
{ "Gimp", NULL, NULL, 0, True, False, -1 },
{ "MPlayer", NULL, NULL, 0, True, True, -1 },
....apply to dwm.c this patch
http://hg.punctweb.ro/dwm/src/3299f6adc … at=default
Excellent, works nicely on dwm 6.1. Thanks very much!
Offline
This is just some info that I thought would be useful to share in case
anyone else (including future me) needs it.
Getting Compton (https://wiki.archlinux.org/index.php/Compton) and dwm
to work is a little non-intuitive. (In this case, I was trying to get
inactive window transparency to work, but anything that relies on window
focus will need to do this).
The key is that you need to set the following options in your config:
mark-ovredir-focused = false;
use-ewmh-active-win = false;
Setting the former as true will make Compton think every window is
focused, and setting the latter as true will make Compton think every
window is unfocused.
However, even with this, by default the dwm status bar will also be
considered unfocused, so will be transparent (or dimmed, whatever you're
trying to do). I had to modify dwm so that it is setting WM_CLASS and
WM_NAME. The patch is pretty simple, so I'll include it in the post:
diff -u a/dwm.c b/dwm.c
--- a/dwm.c 2011-12-19 10:02:46.000000000 -0500
+++ b/dwm.c 2014-01-28 17:42:13.011804758 -0500
@@ -1826,13 +1826,18 @@
.background_pixmap = ParentRelative,
.event_mask = ButtonPressMask|ExposureMask
};
+ XClassHint *ch = XAllocClassHint();
+ ch->res_name = "dwmstatus";
+ ch->res_class = "dwm";
for(m = mons; m; m = m->next) {
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0,
DefaultDepth(dpy, screen),
CopyFromParent, DefaultVisual(dpy,
screen),
CWOverrideRedirect|CWBackPixmap|CWEventMask,
&wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
XMapRaised(dpy, m->barwin);
+ XSetClassHint(dpy, m->barwin, ch);
}
+ XFree(ch);
}
void
Note that I'm applying this patch after the pango patch, so the line
numbers may be wrong, but it should still apply cleanly on a fresh copy
of dwm.
Next, you just have to set a rule in compton.conf:
focus-exclude = [ "class_g = 'dwm'" ];
This will make Compton set the dwm status bar as focused at all times.
Cheers.
Offline
Merging with the dwm hacks thread...
Offline
I made a simple dwm FIFO patch that maps commands to all existing keybinds, you can find it here http://dwm.suckless.org/patches/dwm-6.1-dwmfifo.diff
Offline
[removed]
Last edited by botika (2014-02-10 22:40:21)
Offline
I would like to use dwm with tint2, without the bulit-in bar but I cannot get it right.
If I set
static const Bool showbar = False
tint2 bar is acting wierd (sometimes shows, sometimes not and not according to tint2cond settings), and also the windows opened in dwm do not respect the tint2 bar (i.e. using the whole screen).
I also tried
static const Bool showbar = True
and in tint2rc file
panel_dock = 1
but then only the dwm bar shows.
Is it possilbe what I want and how? Thanks.
EDIT: tint2 works with echinus perfectly.
Last edited by totolotto (2014-02-13 08:25:53)
Offline
i had tried android studio 0.4.5 on dwm 0.6.1
http://tools.android.com/download/studio/canary
then android studio looks like white rectangle
so this is somewhat annoying,
for these usage, using openbox.
--
PS: this works. yeah read the manual..
wmname LG3D
Last edited by mmix (2014-06-21 03:08:33)
Offline
Thanks for the info!
But, it partially worked for initial setting window(vivid visible),
actually, not work for main ide window(white rectangle).
--
PS: normal android studio is not good by design.
lighttable is better alternative i start to believe,
and LT works fine with dwm! :)
Last edited by mmix (2014-02-19 14:06:10)
Offline
In a floating group, can i make midori always stay at the bottom of screen once started ?
Sincerely!
e^(π⋅i) + 1 = 0
Offline
Anyone know how to stop a client from ever floating?
I have some software that's misbehaving (Double commander) whenever the program has more than one copy-file dialog window on screen at once the main window floats & disappears behind the other windows, which is very annoying.
I have hacked together a solution, which is to insert this line:
if (strncmp(c->name,"Double Commander 0.5.8 beta build 5390; 2013/12/28",50)==0) c->isfloating=False;
within the clients for loop in the drawbar() function in dwm.c this at least keeps the main window visible & re-tiles it once the dialogs disappear but it's still floated while the dialogs are active.
Thanks!
Offline
Hi all,
I'm running dwm with the noborders and bstack patches applied, but I'm noticing that they interfere with one another a little bit: noborders doesn't always work as it should when I'm using the bstack layout. I guess this is because the noborders patch (unsurprisingly) doesn't patch bstack.c. I tried to get it working myself by manually doing to bstack.c what the noborders patch does to dwm.c's tile function, but I got stumped because I don't really know what's going on in there.
Has anyone by any chance got a patch for this lying around already? Or would anyone be so kind as to attempt to come up with one for me? (I guess it would be a quick task for anyone who actually groks the dwm source.) Either way, I'd be very grateful to anyone who could help me. Thanks!
Offline