You are not logged in.

#51 2010-11-05 03:49:12

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

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

Just bizarre - I am using exactly the same config.h and, on a vanilla 5.8.2, it doesn't work...

One possible clue, when the term opens, it doesn't have the scratchy tag...

In any event, I'm comfortable with the setup I have (even if it is toggleless smile ), so unless anyone else experiences this I'll have to put it down to PEBKAC


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#52 2010-11-05 04:19:24

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

jasonwryan wrote:

One possible clue, when the term opens, it doesn't have the scratchy tag...

You mean it doesn't have the scratchy name, right? That's the real problem. Try run manually `urxvt -name scratchy`, see if it works?


This silver ladybug at line 28...

Offline

#53 2010-11-05 08:57:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

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

Running it manually has the same effect as using the key: it opens a terminal, named 'Terminal'...

This is the second machine I have tried it on (with a vanilla 5.8.2). Perhaps there is something in my .bashrc/profile that is fux0ring it...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#54 2010-11-05 09:29:10

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

Hmm... weird. In that case, I wonder why your old config.h approach would work (does it now?).

Tried `xterm -name scratchy`? Uhmm... `grep Terminal ~/.*`?


This silver ladybug at line 28...

Offline

#55 2010-11-05 15:28:26

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

I noticed (in dwm 5.8.2) when MPlayer plays in fullscreen mode, switching tags ("view") back and forth will have the MPlayer window pushed to the top. I Quickly created a patch. Pasting it here in case anyone may need it, and also for feedback/improvement:

--- dwm-5.8.2/dwm.c    2010-06-04 18:39:15.000000000 +0800
+++ dwm-5.8.2-mod/dwm.c    2010-11-05 23:00:34.840000349 +0800
@@ -88,7 +88,7 @@
     int basew, baseh, incw, inch, maxw, maxh, minw, minh;
     int bw, oldbw;
     unsigned int tags;
-    Bool isfixed, isfloating, isurgent, oldstate;
+    Bool isfixed, isfloating, isurgent, oldstate, isfullscreen;
     Client *next;
     Client *snext;
     Monitor *mon;
@@ -1308,6 +1308,7 @@
         if(cme->data.l[0]) {
             XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
                             PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
+      c->isfullscreen = True;
             c->oldstate = c->isfloating;
             c->oldbw = c->bw;
             c->bw = 0;
@@ -1318,6 +1319,7 @@
         else {
             XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32,
                             PropModeReplace, (unsigned char*)0, 0);
+      c->isfullscreen = False;
             c->isfloating = c->oldstate;
             c->bw = c->oldbw;
             c->x = c->oldx;
@@ -1577,7 +1579,7 @@
         return;
     if(ISVISIBLE(c)) { /* show clients top down */
         XMoveWindow(dpy, c->win, c->x, c->y);
-        if(!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
+        if((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
             resize(c, c->x, c->y, c->w, c->h, False);
         showhide(c->snext);
     }

If you use 5.7.2 you will not have this issue.


This silver ladybug at line 28...

Offline

#56 2010-11-06 00:34:21

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

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

lolilolicon wrote:

Hmm... weird. In that case, I wonder why your old config.h approach would work (does it now?).

Yes - like a charm smile

Tried `xterm -name scratchy`? Uhmm... `grep Terminal ~/.*`?

I was setting the Title in .Xdefaults - unsetting it made no difference. Put it down as a mystery...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#57 2010-11-06 06:17:17

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

That's just very illogical... a.k.a. WTF?

So that means, if you run:

urxvtc -title pad -geometry 64x10+540+24

The window name will be "pad"
While with

urxvtc -name scratchy -geometry 70x12+730+24

The window name will be "Terminal"?

Can you do `xprop` and paste the detailed window properties please?


This silver ladybug at line 28...

Offline

#58 2010-11-07 06:35:46

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

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

jasonwryan wrote:

I was setting the Title in .Xdefaults - unsetting it made no difference.

Scratch that (groan). Unsetting and then running xrdb -load ~/.Xdefaults sees the expected behaviour, ie., toggling and the window is named 'scratchy.'

I thought it was a case of PEBCAK smile Sorry to lead you astray lolilolicon - it works as advertised (providing you don't have a URxvt.title entry in your .Xdefaults)!


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#59 2010-11-07 06:48:19

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

Hooray for that! (I got a customer, hey (-:)


This silver ladybug at line 28...

Offline

#60 2010-11-09 20:49:44

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

using the patch from this post and dwm-5.8.2-pertag.diff i made this pertag patch with initlayouts for vanilla dwm 5.8.2 big_smile i like rolling release hmm

--- dwm-5.8.2.orig/dwm.c    2010-06-04 13:39:15.000000000 +0300
+++ dwm-5.8.2/dwm.c    2010-11-09 22:33:55.000000000 +0200
@@ -122,26 +122,6 @@ typedef struct {
     void (*arrange)(Monitor *);
 } Layout;
 
-struct Monitor {
-    char ltsymbol[16];
-    float mfact;
-    int num;
-    int by;               /* bar geometry */
-    int mx, my, mw, mh;   /* screen size */
-    int wx, wy, ww, wh;   /* window area  */
-    unsigned int seltags;
-    unsigned int sellt;
-    unsigned int tagset[2];
-    Bool showbar;
-    Bool topbar;
-    Client *clients;
-    Client *sel;
-    Client *stack;
-    Monitor *next;
-    Window barwin;
-    const Layout *lt[2];
-};
-
 typedef struct {
     const char *class;
     const char *instance;
@@ -278,6 +258,31 @@ static Window root;
 /* configuration, allows nested code to access above variables */
 #include "config.h"
 
+struct Monitor {
+    char ltsymbol[16];
+    float mfact;
+    int num;
+    int by;               /* bar geometry */
+    int mx, my, mw, mh;   /* screen size */
+    int wx, wy, ww, wh;   /* window area  */
+    unsigned int seltags;
+    unsigned int sellt;
+    unsigned int tagset[2];
+    Bool showbar;
+    Bool topbar;
+    Client *clients;
+    Client *sel;
+    Client *stack;
+    Monitor *next;
+    Window barwin;
+    const Layout *lt[2];
+    int curtag;
+    int prevtag;
+    const Layout *lts[LENGTH(tags) + 1];
+    double mfacts[LENGTH(tags) + 1];
+    Bool showbars[LENGTH(tags) + 1];
+};
+
 /* compile-time check if all tags fit into an unsigned int bit array. */
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 
@@ -611,6 +616,7 @@ configurerequest(XEvent *e) {
 Monitor *
 createmon(void) {
     Monitor *m;
+    unsigned int i;
 
     if(!(m = (Monitor *)calloc(1, sizeof(Monitor))))
         die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
@@ -620,7 +626,16 @@ createmon(void) {
     m->topbar = topbar;
     m->lt[0] = &layouts[0];
     m->lt[1] = &layouts[1 % LENGTH(layouts)];
-    strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
+    strncpy(m->ltsymbol, initlayouts[1] && initlayouts[1] < LENGTH(layouts) ? layouts[initlayouts[1]].symbol : layouts[0].symbol, sizeof m->ltsymbol);
+
+    /* pertag init */
+    m->curtag = m->prevtag = 1;
+    for(i=0; i < LENGTH(tags) + 1 ; i++) {
+        m->mfacts[i] = mfact;
+        m->lts[i] = initlayouts[i] && initlayouts[i] < LENGTH(layouts) ? &layouts[initlayouts[i]] : &layouts[0];
+        m->showbars[i] = m->showbar;
+    }
+
     return m;
 }
 
@@ -1494,7 +1509,7 @@ setlayout(const Arg *arg) {
     if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
         selmon->sellt ^= 1;
     if(arg && arg->v)
-        selmon->lt[selmon->sellt] = (Layout *)arg->v;
+        selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *)arg->v;
     strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
     if(selmon->sel)
         arrange(selmon);
@@ -1512,7 +1527,7 @@ setmfact(const Arg *arg) {
     f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
     if(f < 0.1 || f > 0.9)
         return;
-    selmon->mfact = f;
+    selmon->mfact = selmon->mfacts[selmon->curtag] = f;
     arrange(selmon);
 }
 
@@ -1555,7 +1570,6 @@ setup(void) {
     XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
     if(!dc.font.set)
         XSetFont(dpy, dc.gc, dc.font.xfont->fid);
-    /* init bars */
     updatebars();
     updatestatus();
     /* EWMH support per view */
@@ -1666,7 +1680,7 @@ tile(Monitor *m) {
 
 void
 togglebar(const Arg *arg) {
-    selmon->showbar = !selmon->showbar;
+    selmon->showbar = selmon->showbars[selmon->curtag] = !selmon->showbar;
     updatebarpos(selmon);
     XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
     arrange(selmon);
@@ -1686,12 +1700,27 @@ togglefloating(const Arg *arg) {
 void
 toggletag(const Arg *arg) {
     unsigned int newtags;
+    unsigned int i;
 
     if(!selmon->sel)
         return;
     newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
     if(newtags) {
         selmon->sel->tags = newtags;
+        if(newtags == ~0) {
+            selmon->prevtag = selmon->curtag;
+            selmon->curtag = 0;
+        }
+        if(!(newtags & 1 << (selmon->curtag - 1))) {
+            selmon->prevtag = selmon->curtag;
+            for (i=0; !(newtags & 1 << i); i++);
+            selmon->curtag = i + 1;
+        }
+        selmon->sel->tags = newtags;
+        selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
+        selmon->mfact = selmon->mfacts[selmon->curtag];
+        if (selmon->showbar != selmon->showbars[selmon->curtag])
+            togglebar(NULL);
         arrange(selmon);
     }
 }
@@ -1959,11 +1988,29 @@ updatewmhints(Client *c) {
 
 void
 view(const Arg *arg) {
+    unsigned int i;
+
     if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
         return;
     selmon->seltags ^= 1; /* toggle sel tagset */
-    if(arg->ui & TAGMASK)
+    if(arg->ui & TAGMASK) {
         selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+        selmon->prevtag = selmon->curtag;
+        if(arg->ui == ~0)
+            selmon->curtag = 0;
+        else {
+            for (i=0; !(arg->ui & 1 << i); i++);
+            selmon->curtag = i + 1;
+        }
+    } else {
+        selmon->prevtag= selmon->curtag ^ selmon->prevtag;
+        selmon->curtag^= selmon->prevtag;
+        selmon->prevtag= selmon->curtag ^ selmon->prevtag;
+    }
+    selmon->lt[selmon->sellt]= selmon->lts[selmon->curtag];
+    selmon->mfact = selmon->mfacts[selmon->curtag];
+    if(selmon->showbar != selmon->showbars[selmon->curtag])
+        togglebar(NULL);
     arrange(selmon);
 }

Offline

#61 2010-11-18 23:13:23

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

lolilolicon wrote:

*) Auto focus:
   In the old days, I have to press Mod+j or move the mouse to get focus on the pad, which is annoying...
   Now, the pad will always get the focus immediately after it's brought up.

seems like in floating mode is not working so well this feature..

http://ompldr.org/vNjgyeg/ffcast.101119010615.mkv

sorry for the double post, but is very quiet around here..

Offline

#62 2010-11-19 08:51:38

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

Yep, that problem I also noticed. To solve this, we must guarantee that Scratchpad always stays on top, which the patch does not do. I tried to fiddle with the "clients stack" but failed. I didn't bother to look into it further since 99% of the time I wouldn't have floating windows piling up my screen so as to cover up Scratchpad completely.

But I would love to see this solved too smile


This silver ladybug at line 28...

Offline

#63 2010-11-19 12:25:02

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

too bad is not staying on top on floating mode also.. i use floating for im tag, so i can live with this.

regarding uselessgap and gaplessgrid, i have seen you tried to make a patch for an older version of dwm that won't double the gaps in grid mode. you have something similar for the current version of dwm? smile

Offline

#64 2010-11-19 13:04:34

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

Here you go:
uselessgap.diff for 5.8.2
gaplessgrid.c for 5.8.2
And the relevant settings in config.h:

static const unsigned int gappx = 6; /* gap pixel around windows */
#include "gaplessgrid.c"
static const Layout layouts[] = {
  { "[+]", gaplessgrid },
}

Hope that helps.


This silver ladybug at line 28...

Offline

#65 2010-11-19 14:22:54

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

http://ompldr.org/vNjhhcA
http://ompldr.org/vNjhhcQ

the same thing happens to you too?

Offline

#66 2010-11-19 14:54:40

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

Yes, it's the norm wink


This silver ladybug at line 28...

Offline

#67 2010-11-20 01:34:38

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

lolilolicon wrote:

But I would love to see this solved too smile

it works using restack(selmon);


scratchpad_stay.config.diff

--- dwm-5.8.2.orig/config.h    2010-06-04 13:39:15.000000000 +0300
+++ dwm-5.8.2/config.h    2010-11-20 03:18:06.000000000 +0200
@@ -47,11 +47,14 @@
 /* commands */
 static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL };
 static const char *termcmd[]  = { "uxterm", NULL };
+static const char scratchpadname[] = "scratchy";
+static const char *scratchpadcmd[] = { "urxvtc", "-name", scratchpadname, "-geometry", "80x20", NULL };
 
 static Key keys[] = {
     /* modifier                     key        function        argument */
     { MODKEY,                       XK_p,      spawn,          {.v = dmenucmd } },
     { MODKEY|ShiftMask,             XK_Return, spawn,          {.v = termcmd } },
+    { MODKEY,                       XK_x,      togglescratch,  {.v = scratchpadcmd} },
     { MODKEY,                       XK_b,      togglebar,      {0} },
     { MODKEY,                       XK_j,      focusstack,     {.i = +1 } },
     { MODKEY,                       XK_k,      focusstack,     {.i = -1 } },

scratchpad_stay.diff

--- dwm-5.8.2.orig/dwm.c    2010-06-04 13:39:15.000000000 +0300
+++ dwm-5.8.2/dwm.c    2010-11-20 03:21:59.000000000 +0200
@@ -222,6 +222,7 @@
 static void tile(Monitor *);
 static void togglebar(const Arg *arg);
 static void togglefloating(const Arg *arg);
+static void togglescratch(const Arg *arg);
 static void toggletag(const Arg *arg);
 static void toggleview(const Arg *arg);
 static void unfocus(Client *c, Bool setfocus);
@@ -278,6 +279,8 @@
 /* configuration, allows nested code to access above variables */
 #include "config.h"
 
+static unsigned int scratchtag = 1 << LENGTH(tags); /* This tag specially for you, Scratchpad. */
+
 /* compile-time check if all tags fit into an unsigned int bit array. */
 struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
 
@@ -1137,6 +1140,13 @@
                    && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
         c->bw = borderpx;
     }
+    if(strcmp(c->name, scratchpadname) == 0) {
+        c->tags = scratchtag;
+        c->isfloating = True;
+        c->x = (c->mon->mw - c->w) / 2;
+        c->y = (c->mon->mh - c->h) / 2;
+        c->mon->tagset[c->mon->seltags] |= c->tags;
+    }
     wc.border_width = c->bw;
     XConfigureWindow(dpy, w, CWBorderWidth, &wc);
     XSetWindowBorder(dpy, w, dc.norm[ColBorder]);
@@ -1684,6 +1694,26 @@
 }
 
 void
+togglescratch(const Arg *arg) {
+    Client *c = NULL;
+    unsigned int found = 0;
+
+    /* check if a scratchpad is already there in scratchtag */
+    for(c = selmon->clients; c && !(found = c->tags & scratchtag); c = c->next);
+    if(!found) { /* not found: launch it and put it in its tag (see manage()) */
+        spawn(arg);
+        return;
+    }
+    unsigned int newtagset = selmon->tagset[selmon->seltags] ^ scratchtag;
+    if(newtagset) {
+        selmon->tagset[selmon->seltags] = newtagset;
+        arrange(selmon);
+    }
+    focus(c);
+    restack(selmon);
+}
+
+void
 toggletag(const Arg *arg) {
     unsigned int newtags;
 
@@ -1959,11 +1989,13 @@
 
 void
 view(const Arg *arg) {
-    if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+    if((arg->ui & TAGMASK) == (selmon->tagset[selmon->seltags] & TAGMASK))
         return;
+    unsigned int stag = (selmon->tagset[selmon->seltags] & scratchtag);
     selmon->seltags ^= 1; /* toggle sel tagset */
     if(arg->ui & TAGMASK)
         selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+    selmon->tagset[selmon->seltags] |= stag;
     arrange(selmon);
 }

huh, i made this diff's for vanilla dwm but now when i tried to use them it didn't go so smoth like i expected. strange.

lolilolicon - using scratchpad_stay.diff try to kill scratchpad, then start any other application and switch to an another tag.. the application will behave like it was scratchpad..

Last edited by JokerBoy (2010-11-20 03:39:57)

Offline

#68 2010-11-20 06:06:12

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

JokerBoy wrote:
lolilolicon wrote:

But I would love to see this solved too smile

it works using restack(selmon);
[..snip..]
huh, i made this diff's for vanilla dwm but now when i tried to use them it didn't go so smoth like i expected. strange.

Hmm.. How does it work out? I will test it later when I have the time.

lolilolicon - using scratchpad_stay.diff try to kill scratchpad, then start any other application and switch to an another tag.. the application will behave like it was scratchpad..

That's right: the application is scratched, because it starts in *both* the current tag(s) and the "hidden" scratchtag, therefore, it is, by definition ("Any client that's in the scratchtag is a scratchpad"), scratched.

This is a bug, thank you!
I think I've fixed it by explicitly discarding scratchtag from non-scratchpads:

c->tags &= TAGMASK;

Newest patches can be found at github

Last edited by lolilolicon (2010-11-20 06:41:35)


This silver ladybug at line 28...

Offline

#69 2010-11-20 14:46:09

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

lolilolicon wrote:

Hmm.. How does it work out? I will test it later when I have the time.

well, i checked the focusstack function.. and there it was.. big_smile so i tried for your patch.

a request.. a patch for a patch.. when i'm using useless gap patch and i'm in tile or grid mode, and i'm running mplayer in fullscreen, gaps are added to mplayer. it's very annoying having to change the layout to float every time i want to see a movie.

Offline

#70 2010-11-20 15:45:18

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,722

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

For mplayer, I have a rule in config.h that sets MPlayer to always floating. I've also tested with a tiled MPlayer client (by triggering the togglefloating key combo). In either case, I don't see the problem you described.
Note that I have the fullscreen.diff patch applied, which I posted earlier on the 2nd page. It's possible that this patch has fixed the problem for me smile


This silver ladybug at line 28...

Offline

#71 2010-11-20 16:39:05

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

i'm using a same rule for mplayer for floating. i'm using your fullscreen fix too.

i'll make a shot and i'll list all the patches that i use when i'll have access to my pc.

// edit again

http://ompldr.org/vNjh2MQ

with gappx = 32.. seems to be a problem with my uselessgap patch sad with your patch is working ok.. sorry..

Last edited by JokerBoy (2010-11-20 20:10:30)

Offline

#72 2010-11-21 21:57:11

Devcon
Member
Registered: 2010-03-07
Posts: 9

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

I love scratchpad patches.  I'm using JokerBoy's edit, and everything seems to work well here.  While probably unnecessary, I think it'd be neat to be able to specify multiple pads.  For example, have one pop up on the right side of the screen, one the bottom, etc...

Also, I know little about C, so how would I go about specifying the exact dimensions of the term?  I assume it is here:

        if(strcmp(c->name, scratchpadname) == 0) { 
            c->tags = scratchtag;
            c->isfloating = True;
            c->x = (c->mon->mw - c->w) / 2; 
            c->y = (c->mon->mh - c->h) / 1; 
            c->mon->tagset[c->mon->seltags] |= c->tags;
        } 

I would like it to not only popup on the bottom, but to also increase the width while reducing the height.

Thanks for the patch.

Offline

#73 2010-11-22 02:09:21

steve___
Member
Registered: 2008-02-24
Posts: 452

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

You could do this with urxvt -title and -geometry option along with setting keybinding in config.h

Last edited by steve___ (2010-11-22 03:55:22)

Offline

#74 2010-11-22 03:46:16

Devcon
Member
Registered: 2010-03-07
Posts: 9

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

Oops, I misread lolilolicon's earlier post when he mentioned geometry.  All sorted.  Thanks

Offline

#75 2010-11-24 16:29:16

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

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

this uselessgap patch based on simongmzlj work is working great with gaplessgrid patch.

dwm-5.8.2-uselessgap.diff

--- dwm-5.8.2.orig/dwm.c    2010-11-24 05:43:22.360001672 +0200
+++ dwm-5.8.2/dwm.c    2010-11-24 05:39:57.000000000 +0200
@@ -119,6 +119,7 @@
 
 typedef struct {
     const char *symbol;
+    Bool addgaps;
     void (*arrange)(Monitor *);
 } Layout;
 
@@ -485,7 +486,7 @@
 void
 cleanup(void) {
     Arg a = {.ui = ~0};
-    Layout foo = { "", NULL };
+    Layout foo = { "", False, NULL };
     Monitor *m;
 
     view(&a);
@@ -1365,12 +1366,18 @@
 void
 resizeclient(Client *c, int x, int y, int w, int h) {
     XWindowChanges wc;
+    //unsigned int gap = c->isfloating ? 0 : selmon->lt[selmon->sellt]->addgaps ? gappx : 0;
+    unsigned int gap = c->isfloating ? 0 : c->mon->lt[c->mon->sellt]->addgaps ? gappx : 0;
 
-    c->oldx = c->x; c->x = wc.x = x;
-    c->oldy = c->y; c->y = wc.y = y;
-    c->oldw = c->w; c->w = wc.width = w;
-    c->oldh = c->h; c->h = wc.height = h;
-    wc.border_width = c->bw;
+    c->oldx = c->x; c->x = wc.x = x + gap;
+    c->oldy = c->y; c->y = wc.y = y + gap;
+    c->oldw = c->w; c->w = wc.width = w - (gap ? (x + w + (c->bw * 2) == c->mon->wx + c->mon->ww ? 2 : 1) * gap : 0);
+    c->oldh = c->h; c->h = wc.height = h - (gap ? (y + h + (c->bw * 2) == c->mon->wy + c->mon->wh ? 2 : 1) * gap : 0);
+    wc.border_width = (c->mon->lt[c->mon->sellt]->arrange == monocle && !c->isfloating) ? 0 : c->bw;
+    if(c->mon->lt[c->mon->sellt]->arrange == monocle && !c->isfloating) {
+        c->w = wc.width+=2;
+        c->h = wc.height+=2;
+    }
     XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
     configure(c);
     XSync(dpy, False);

config.h

static const Layout layouts[] = {
    /* symbol     gaps       arrange function */
    { "[G]",      True,      gaplessgrid },    /* first entry is default */
    { "[F]",      False,     NULL },           /* no layout function means floating behavior */
    { "[M]",      False,     monocle },
    { "[s]",      True,      spiral },
    { "[D]",      True,      dwindle },
    { "[b]",      True,      bstack },
    { "[T]",      True,      tile },
};

Offline

Board footer

Powered by FluxBB