You are not logged in.
Fixed it! Don't ask me how, because I have no clue Final patch is up for grabs on my GitHub: 04-dwm-6.0-push.diff
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
mkaito wrote:It correctly removes the border when a window is displayed alone, but restores it when I view a tag on another monitor. Strange as hell...
Do you mean, that the borders are there, if you e.g. move a client to an empty tag on another monitor? Because in that case the border reappears too on my machine. I hardly move windows, so I never looked into it..
I suppose that would trigger the same kind of event. There's only three places in the code where border size is changed, and after fiddling with all 3 of them, I just have no idea where else to hack around. I'll have to try and figure out how windows are moved across monitors, I guess. Or why changing a to a tag with clients on another monitor A changes border size of clients on monitor B...
Fear me! I have root! Sometimes...
Offline
c00kiemon5ter told me I could fix the floating clients issue with my singularborders patch by using XRestackWindows() instead of XRaiseWindow(). To do so, I need to create an array of all the clients but I'm failing to create this. I looked at monsterwm's code and adapted it to work with DWM, but something is wrong and DWM crashes.
I already sent c00kie an email, but he's not responding (and I never expected any help from him, since his WM is monsterwm and I'm asking for DWM hacking - no hard feelings c00kie) so now I ask here. Here's monsterwm's relevant lines:
int n = 0, fl = 0, ft = 0;
for (c = d->head; c; c = c->next, ++n) if (ISFFT(c)) { fl++; if (!c->isfull) ft++; }
Window w[n];
w[(d->curr->isfloat || d->curr->istrans) ? 0:ft] = d->curr->win;
for (fl += !ISFFT(d->curr) ? 1:0, c = d->head; c; c = c->next) {
XSetWindowBorder(dis, c->win, c == d->curr ? win_focus:win_unfocus);
/*
* a window should have borders in any case, except if
* - the window is fullscreen
* - the window is not floating or transient and
* - the mode is MONOCLE or,
* - it is the only window on screen
*/
XSetWindowBorderWidth(dis, c->win, c->isfull || (!ISFFT(c) &&
(d->mode == MONOCLE || !d->head->next)) ? 0:BORDER_WIDTH);
if (c != d->curr) w[c->isfull ? --fl:ISFFT(c) ? --ft:--n] = c->win;
if (CLICK_TO_FOCUS || c == d->curr) grabbuttons(c);
}
XRestackWindows(dis, w, LENGTH(w));
Last edited by Unia (2013-03-20 21:19:29)
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
You can't statically declare an array with a variable number of elements.
Use a "Window *w = (Window *) malloc(n * sizeof(Window));"
Edit: then "free(w)" at the end of the function when you are done with it.
Personally, though, I find it much easier, and more efficient to loop through all the clients and call XRaiseWindow on any that need to be raised.
Last edited by Trilby (2013-03-20 21:22:57)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
Personally, though, I find it much easier, and more efficient to loop through all the clients and call XRaiseWindow on any that need to be raised.
Well, my issue is that to when I firstly created singularborders, some inactive borders would overlap the active borders. I fixed that by adding XRaiseWindow() into focus, but that caused floating clients dissapear behind tiled clients when I change focus to those. It does sound easier, but I'm not sure how I could do this. Would it be something like this? Also, would this cause much overhead when changing focus? Otherwise I might rather stick with this issue.
for(c = m->clients; c; c = c->next) {
XRaiseWindow();
if(c->isfloating)
XRaiseWindow();
}
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 had a similar issue in ttwm. As the ttwm stacking mode requires rasing the focused window in the stack, it would raise above floating windows. I raise the floating window, then loop through all the windows and raise any floaters.
This will cost less than creating an array, filling it, and raising all those windows anyways. And it is only done when the tile function is called (right?)
I'm not on the system with the code right now, but I can give a specifc example in a bit unless you beat me to it and find it on github (it should be at the very end of the tile_mode function if I remember right).
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
This will cost less than creating an array, filling it, and raising all those windows anyways. And it is only done when the tile function is called (right?)
Ah, yes. I was thinking this replacement for my XRaiseWindow() fix should also be put in focus(), but that might not be necessary..
I'm not on the system with the code right now, but I can give a specifc example in a bit unless you beat me to it and find it on github (it should be at the very end of the tile_mode function if I remember right).
Is this it?
if (focused) {
XRaiseWindow(dpy,focused->win);
for (c = clients; c; c = c->next)
if ( (c->tags & tagsSel) && (c->flags & TTWM_FLOATING))
XRaiseWindow(dpy,c->win);
}
I'll play around a bit and see if this works
EDIT: This does work, but only when a new client appears I get the floating client back on top: as soon as I focus anything, it dissapears to the background again. It seems indeed that tile() might be the required function, but then again changing focus has nothing to do with tile() so it might not work at all.
EDIT2: This isn't going to work. DWM handles this differently than TTWM. The tile() function has nothing to do with focusing clients, so putting it there has no effect. When putting it in focus, still have this issue. I guess I will have to stick with XRestackWindows and the array of clients...
EDIT3: Putting the loop in restack() and calling restack() from focus() works, albeit with a brief flash where the floating client is. I'll see if I can remove the flash now, but at least this is a start.
EDIT4: Adding a new function works without flashing:
void
raisefloating(void) {
Client *c;
XEvent ev;
/*if(!(selmon->lt[selmon->sellt]->arrange)) {*/
for(c = selmon->clients; c; c = c->next)
if(c->isfloating)
XRaiseWindow(dpy, c->win);
XSync(dpy, False);
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
The new patch is up on my GitHub. Thanks for this new suggestion Trilby!
Last edited by Unia (2013-03-20 23:53:47)
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
Your welcome - glad it got you somewhere. Indeed the differences from dwm would not allow it to work in the tile function - just just wherever the tiled window is raised one could loop through floating windows and raise each of them.
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
Trilby (or anyone else),
I just found another way of fixing the hiding of floating clients. I added this to focus():
+ if(!c->isfloating) {
+ wc.sibling = selmon->barwin;
+ wc.stack_mode = Below;
+ XConfigureWindow(dpy, c->win, CWSibling | CWStackMode, &wc);
+ }
I think it's a cleaner approach than having my raisefloating() function - what do you think?
Last edited by Unia (2013-03-21 22:49:34)
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 am trying to accomplish that when I press certian key it moves me from curtag to bgtag, and if i press it once more revert me back to prev tag. So far this is working for fist and seccond tag, for others 3 tags when I am in bgtag reverting to prevtag toggle first and second tag. So prevtag is messed with some bits. If I initialized prevtag to be 0, same thing happens, I am lost and will be glad to infom me litlebit and of course help me.
here is relevant part from config which trigger event:
{ SUPERKEY, XK_s, bgtag, {0} },
I am using references from view function
void
bgtag(const Arg *arg) {
unsigned int ptag;
unsigned int infotag = ( 1 << 5 );
if((arg->ui & TAGMASK) != selmon->tagset[selmon->seltags]){
selmon->pertag->prevtag = selmon->pertag->curtag; // only if above is true, but this desn't make sense if I am on bgtag couse this won't have effects
selmon->tagset[selmon->seltags] = arg->ui & infotag;
} else {
// this is working for first and second tag, not for 3 others
ptag = selmon->pertag->prevtag;
selmon->tagset[selmon->seltags] = ptag;
}
/* apply settings for pertag */
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
togglebar(NULL);
focus(NULL);
arrange(selmon);
}
if I get it correctly i dont have TAGMASK passed to function, but I have arg as 0, so i dont get why if (arg == 0) isn't true, above solution only works. Better soulution would be with two if statements, for example:
If i am on bgtag revert me beack to prevtag, if i am not then go to bgtag
NOTE: bgtag is not visible, it's 6 tag. I hide it in drawbar function with LENGHT(tags) - 1
Offline
Here's another tiling layout I whipped up quickly (inspired by Trilby's TTWM). It basically is like tile(), but with monocle() in the stack. That means that there is a master client (complete with nmaster et all) and where normally the stack would be, you now see only one client. If you open a new client, it will be overlapping the previous stacked client and so forth. In the statusbar, it will display the numbers of clients in the stack, as well. Here's a diff against a vanilla dwm.c:
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
Here's another tiling layout I whipped up quickly (inspired by Trilby's TTWM). It basically is like tile(), but with monocle() in the stack. That means that there is a master client (complete with nmaster et all) and where normally the stack would be, you now see only one client. If you open a new client, it will be overlapping the previous stacked client and so forth. In the statusbar, it will display the numbers of clients in the stack, as well. Here's a diff against a vanilla dwm.c:
That's actually really cool! I'll have to try this out.
Thinkpad T420 | Intel 3000 | systemd {,--user}
PKGBUILDs I use | pywer AUR helper
Offline
Just for those of you that don't use the pertag patch, here's a patch you can use:
The nmasters and mfacts are something from the pertag patch, which I don't use (also, curtag is not part of the monitor struct outside of pertag.)
EDIT: Also, unia, you should think about just using git to manage your patches instead of keeping patches in a version control system.
EDIT EDIT: For those using the single-window-no-border patch, here's a patch on top of that to make it work: http://ix.io/4Re
Last edited by KaiSforza (2013-03-23 18:12:28)
Thinkpad T420 | Intel 3000 | systemd {,--user}
PKGBUILDs I use | pywer AUR helper
Offline
Just for those of you that don't use the pertag patch, here's a patch you can use:
The nmasters and mfacts are something from the pertag patch, which I don't use (also, curtag is not part of the monitor struct outside of pertag.)
EDIT: Also, unia, you should think about just using git to manage your patches instead of keeping patches in a version control system.
You're right, I diffed it against vanilla but forgot to actually test it. About Git, I have no idea how it works. Plus, I feel this gives me more control.
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
KaiSforza wrote:Just for those of you that don't use the pertag patch, here's a patch you can use:
The nmasters and mfacts are something from the pertag patch, which I don't use (also, curtag is not part of the monitor struct outside of pertag.)
EDIT: Also, unia, you should think about just using git to manage your patches instead of keeping patches in a version control system.
You're right, I diffed it against vanilla but forgot to actually test it. About Git, I have no idea how it works. Plus, I feel this gives me more control.
This actually is a really cool patch. I'm thinking about editing it into another layout that has a configurable max amount of master and stack windows (so for gimp you could limit it to two in the stack and concentrate on a single image in the master area).
The Pro Git Book from the git website is a great resource if you're just starting out with git.
Thinkpad T420 | Intel 3000 | systemd {,--user}
PKGBUILDs I use | pywer AUR helper
Offline
^ I was thinking of modifying the tile() function so that we can (with shortcuts) enable deck layout or regular tile, since the deck layout is actually only a one line difference from tile.
Thanks for the link, I might start using Git for more than just commiting and pushing
Last edited by Unia (2013-03-23 18:56:13)
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 was thinking of modifying the tile() function so that we can (with shortcuts) enable deck layout or regular tile
I've combined these in ttwm-git in the rstack (or bstack) functions.
I have a stackcount variable (nstack might follow the dwm naming pattern) and maximum stackable variable - the latter changes as clients are mapped or closed.
I then have keybindings that increase or decrease stackcount to make the stack include more or less windows - and I have other keybindings that set stackcount to 1 or maxstack. which acts a lot like i3wm's toggling between a full stack of windows or a single window in tabbed mode. Toggling between 1 or maxstack would acheive the deck/stack change you are describing, if I'm understanding it right.
Inspiration for this design came from a request my HalosGhost in the forums. Feel free to check out the rstack() function if you think it may help.
Last edited by Trilby (2013-03-23 19:03:10)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Online
^ Indeed, that was where my inspiration came from I am now just figuring out how I can pass on an integer to tile(). Tile() is called from setlayout(), but I have to go now so I'll finish this later.
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
Also, just a nit pick, but I think that it should say '0' when nothing is currently in the stack, not '1'. (so basicallyjust take out that if(dn > 0) line.)
Thinkpad T420 | Intel 3000 | systemd {,--user}
PKGBUILDs I use | pywer AUR helper
Offline
Doesn't it do that? I use dn = n -1. So when we have only one client (e.g. no stack) n is 1 thus dn is zero, thus it will not display anything.
EDIT: We could also implement something like monoclecount. That shows the total number of clients in the stack and the number of the client you currently have on top, like so: [5/16]EDIT2: Another small issue is that when we increment nmaster, the number of clients in the stack stays the same.
EDIT3:
dn = n - m->nmasters[m->curtag];
if(dn > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", dn);
Solves the issue with nmasters. However, if nmaster is bigger than the amount of clients in the stack, it'll display a negative number (even though I still use if(dn > 0)). What's up with that?
EDIT4: dn should be declared as a regular int, not an unsigned one.
Last edited by Unia (2013-03-23 22:28:30)
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
Nice!!
I used something similar in my dwm
https://gist.github.com/ivoarch/5229597
Last edited by ivoarch (2013-03-23 22:37:27)
Offline
Nice!!
I used something similar in my dwm
https://gist.github.com/ivoarch/5229597
How does yours differ from mine?
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
Doesn't it do that? I use dn = n -1. So when we have only one client (e.g. no stack) n is 1 thus dn is zero, thus it will not display anything.
EDIT: We could also implement something like monoclecount. That shows the total number of clients in the stack and the number of the client you currently have on top, like so: [5/16]
EDIT2: Another small issue is that when we increment nmaster, the number of clients in the stack stays the same.
EDIT3:dn = n - m->nmasters[m->curtag]; if(dn > 0) /* override layout symbol */ snprintf(m->ltsymbol, sizeof m->ltsymbol, "D %d", dn);
Solves the issue with nmasters.
However, if nmaster is bigger than the amount of clients in the stack, it'll display a negative number (even though I still use if(dn > 0)). What's up with that?
EDIT4: dn should be declared as a regular int, not an unsigned one.
I think (for a few reasons) something like this would make sense:
dn = n - 1; /* Override symbol layout */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d/%d", m->nmaster, dn);
And it would display the number you have in nmaster as well, which could be useful if you're spawning a window and don't want to mess with something. (I realize it could be put somewhere else, but it makes sense to me.)
EDIT: {{{
if ((dn = n - m->nmaster) < 0) /* Don't use negative numbers */
dn = 0;
snprintf(m->ltsymbol, sizeof m->ltsymbol, "%d/%d", m->nmaster, dn); /* Override symbol layout */
This kind of does what I think we were both looking for. nmaster and dn can both not be <0, so it just shows the potential number of master windows and the number of windows in the stack.
}}}
Last edited by KaiSforza (2013-03-24 00:43:08)
Thinkpad T420 | Intel 3000 | systemd {,--user}
PKGBUILDs I use | pywer AUR helper
Offline
Getting error when trying to compile:
error:
dwm.c: In function 'drawbar':
dwm.c737:19: error: request for member 'name' in something not a structure or union
config.h top portion:
/* See LICENSE file for copyright and license details. */
#include <X11/XF86keysym.h>
#define NUMCOLORS 13
static const char colors[NUMCOLORS][ColLast][20] = {
/* border fg bg */
{ "#EEEEEE", "#666666", "#222222" }, // 1 - regular
{ "#CCCCC9", "#FFFFFF", "#222222" }, // 2 - selected
{ "#222222", "#FF0000", "#222222" }, // 3 - urgent
{ "#222222", "#222222", "#222222" }, // 4 - null
{ "#222222", "#A82222", "#222222" }, // 5 - red
{ "#222222", "#1F7B94", "#222222" }, // 6 - blue
{ "#222222", "#349147", "#222222" }, // 7 - green
{ "#222222", "#333333", "#222222" }, // 8 - dark grey
{ "#222222", "#DCDCDC", "#222222" }, // 9 - light grey
{ "#222222", "#08736C", "#222222" }, // A - teal
{ "#222222", "#B86A6A", "#222222" }, // B - pink
{ "#222222", "#FFFFFF", "#222222" }, // C - white
{ "#222222", "#000000", "#222222" }, // D - black
};
/* appearance */
static const char font[] = "-*-stlarch-medium-r-*-*-16-*-*-*-*-*-*-*";
static const char normbordercolor[] = "#141516";
static const char normbgcolor[] = "#6b0f38";
static const char normfgcolor[] = "#b7416e";
static const char selbordercolor[] = "#8c1924";
static const char selbgcolor[] = "#283B5D";
static const char selfgcolor[] = "#a0a0a0";
static const unsigned int borderpx = 1; /* border pixel of windows */
static const unsigned int gappx = 5; /* gap pixel between 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 */
static const Bool systray = True;
static const Bool showtray = True;
/* layout(s) */
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[t]", tile }, /* first entry is default */
{ "[f]", NULL }, /* no layout function means floating behavior */
{ "[m]", monocle },
};
/* tagging */
static const char *tags[] = { "man", "web", "mda", "prg", "irc", "ofc"};
and if you want to see my dwm.c its:
Patches:
uslessgaps
statusbarcolor
Last edited by kanazky (2013-03-24 00:28:13)
Archlinx + DWM I love Wingo-WM Bring it back!!
Offline