You are not logged in.

#1326 2014-01-07 11:38:27

markoer
Member
Registered: 2010-12-15
Posts: 55

Re: DWM Hackers Unite! Share (or request) dwm patches.

@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

#1327 2014-01-07 11:40:06

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Re: DWM Hackers Unite! Share (or request) dwm patches.

markoer wrote:

@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

#1328 2014-01-07 12:20:15

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,471
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

pks wrote:
Unia wrote:

I'll hack it in right now wink 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 roll 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

#1329 2014-01-07 12:26:13

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Re: DWM Hackers Unite! Share (or request) dwm patches.

Unia wrote:
pks wrote:
Unia wrote:

I'll hack it in right now wink 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 roll Sorry for the confusion!

No problem, glad it works now smile

Offline

#1330 2014-01-07 23:57:58

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,471
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1331 2014-01-08 08:20:52

pks
Member
From: Germany
Registered: 2012-07-20
Posts: 110

Re: DWM Hackers Unite! Share (or request) dwm patches.

Unia wrote:

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

#1332 2014-01-12 03:39:31

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1333 2014-01-17 13:48:51

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1334 2014-01-18 23:11:21

marttt
Member
Registered: 2013-05-21
Posts: 22

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1335 2014-01-19 01:10:35

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,331
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

This isn't a support thread.


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#1336 2014-01-19 09:33:22

marttt
Member
Registered: 2013-05-21
Posts: 22

Re: DWM Hackers Unite! Share (or request) dwm patches.

jasonwryan wrote:

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

#1337 2014-01-19 11:10:22

ivoarch
Member
From: the six feet under the ground
Registered: 2011-03-31
Posts: 436

Re: DWM Hackers Unite! Share (or request) dwm patches.

marttt wrote:

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


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#1338 2014-01-19 12:50:43

marttt
Member
Registered: 2013-05-21
Posts: 22

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1339 2014-01-28 22:47:09

darkfeline
Member
Registered: 2012-02-14
Posts: 94

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1340 2014-01-28 22:50:24

jasonwryan
Forum & Wiki Admin
From: .nz
Registered: 2009-05-09
Posts: 18,331
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Merging with the dwm hacks thread...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Online

#1341 2014-01-30 15:50:54

dimigon
Member
Registered: 2009-03-07
Posts: 139
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1342 2014-02-08 02:33:16

botika
Member
Registered: 2013-07-12
Posts: 34

Re: DWM Hackers Unite! Share (or request) dwm patches.

[removed]

Last edited by botika (2014-02-10 22:40:21)

Offline

#1343 2014-02-13 08:23:33

totolotto
Member
From: Hungary
Registered: 2012-11-13
Posts: 107

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1344 2014-02-13 09:47:49

ivoarch
Member
From: the six feet under the ground
Registered: 2011-03-31
Posts: 436

Re: DWM Hackers Unite! Share (or request) dwm patches.

Dwm does not have dock support (_NET_WM_WINDOW_TYPE_DOCK)!
Try another window manager or create a patch for this.


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#1345 2014-02-18 03:58:38

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: DWM Hackers Unite! Share (or request) dwm patches.

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
aspect_ratio_2_resampled.jpg

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

#1346 2014-02-18 11:16:07

ivoarch
Member
From: the six feet under the ground
Registered: 2011-03-31
Posts: 436

Re: DWM Hackers Unite! Share (or request) dwm patches.

Try using wmname is mentioned in dwm's man page!

Last edited by ivoarch (2014-02-18 13:42:19)


I love GnuEmacs, GnuScreen, ratpoison, and conkeror.
Github )||( Weblog

Offline

#1347 2014-02-18 14:14:50

mmix
Member
Registered: 2014-01-11
Posts: 33

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1348 2014-03-03 06:19:46

sw2wolf
Member
From: China
Registered: 2009-06-08
Posts: 99
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

In a floating group, can i make midori always stay at the bottom of screen once started ?

Sincerely!


e^(π⋅i) + 1 = 0

Offline

#1349 2014-03-03 23:31:26

Greescom
Member
Registered: 2014-03-03
Posts: 1

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

#1350 2014-03-25 21:05:01

sediment
Member
Registered: 2012-08-01
Posts: 14

Re: DWM Hackers Unite! Share (or request) dwm patches.

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

Board footer

Powered by FluxBB