Procházet zdrojové kódy

Added attachbelow patch

master
= před 4 roky
rodič
revize
707877cf07
7 změnil soubory, kde provedl 52 přidání a 12 odebrání
  1. binární
      .dwm.c.swp
  2. +1
    -0
      .gitignore
  3. +1
    -0
      config.def.h
  4. +8
    -8
      config.h
  5. binární
      dwm
  6. +3
    -0
      dwm.1
  7. +39
    -4
      dwm.c

binární
.dwm.c.swp Zobrazit soubor


+ 1
- 0
.gitignore Zobrazit soubor

@@ -1,4 +1,5 @@
*.sw[op] *.sw[op]
*.swp
*.o *.o
*.rej *.rej
*.orig *.orig


+ 1
- 0
config.def.h Zobrazit soubor

@@ -33,6 +33,7 @@ static const Rule rules[] = {
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ 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 int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static int attachbelow = 1; /* 1 means attach after the currently active window */


static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */


+ 8
- 8
config.h Zobrazit soubor

@@ -2,7 +2,7 @@


/* appearance */ /* appearance */
static const char *fonts[] = { static const char *fonts[] = {
"monospace:size=10"
"SauceCodePro NF:size=10"
}; };
static const char dmenufont[] = "monospace:size=10"; static const char dmenufont[] = "monospace:size=10";
static const char normbordercolor[] = "#444444"; static const char normbordercolor[] = "#444444";
@@ -36,11 +36,11 @@ static const int resizehints = 1; /* 1 means respect size hints in tiled resi


static const Layout layouts[] = { static const Layout layouts[] = {
/* symbol arrange function */ /* symbol arrange function */
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
{ "|M|", centeredmaster }, { "|M|", centeredmaster },
{ ">M>", centeredfloatingmaster }, { ">M>", centeredfloatingmaster },
{ "[M]", monocle },
{ "[]=", tile }, /* first entry is default */
{ "><>", NULL }, /* no layout function means floating behavior */
}; };


/* key definitions */ /* key definitions */
@@ -75,11 +75,11 @@ static Key keys[] = {
{ MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} }, { MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
{ MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
{ MODKEY, XK_u, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_o, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_space, setlayout, {0} }, { MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } }, { MODKEY, XK_0, view, {.ui = ~0 } },


binární
dwm Zobrazit soubor


+ 3
- 0
dwm.1 Zobrazit soubor

@@ -28,6 +28,9 @@ color. The tags of the focused window are indicated with a filled square in the
top left corner. The tags which are applied to one or more windows are top left corner. The tags which are applied to one or more windows are
indicated with an empty square in the top left corner. indicated with an empty square in the top left corner.
.P .P
The attach below patch makes newly spawned windows attach after the currently
selected window
.P
dwm draws a small border around windows to indicate the focus state. dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS .SH OPTIONS
.TP .TP


+ 39
- 4
dwm.c Zobrazit soubor

@@ -151,6 +151,8 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
static void arrange(Monitor *m); static void arrange(Monitor *m);
static void arrangemon(Monitor *m); static void arrangemon(Monitor *m);
static void attach(Client *c); static void attach(Client *c);
static void attachBelow(Client *c);
static void toggleAttachBelow();
static void attachstack(Client *c); static void attachstack(Client *c);
static void buttonpress(XEvent *e); static void buttonpress(XEvent *e);
static void checkotherwm(void); static void checkotherwm(void);
@@ -417,6 +419,26 @@ attach(Client *c)
c->next = c->mon->clients; c->next = c->mon->clients;
c->mon->clients = c; c->mon->clients = c;
} }
void
attachBelow(Client *c)
{
//If there is nothing on the monitor or the selected client is floating, attach as normal
if(c->mon->sel == NULL || c->mon->sel == c || c->mon->sel->isfloating) {
attach(c);
return;
}

//Set the new client's next property to the same as the currently selected clients next
c->next = c->mon->sel->next;
//Set the currently selected clients next property to the new client
c->mon->sel->next = c;

}

void toggleAttachBelow()
{
attachbelow = !attachbelow;
}


void void
attachstack(Client *c) attachstack(Client *c)
@@ -1091,6 +1113,9 @@ hidewin(Client *c) {
XSelectInput(dpy, root, ra.your_event_mask); XSelectInput(dpy, root, ra.your_event_mask);
XSelectInput(dpy, w, ca.your_event_mask); XSelectInput(dpy, w, ca.your_event_mask);
XUngrabServer(dpy); XUngrabServer(dpy);

focus(c->snext);
arrange(c->mon);
} }


void void
@@ -1191,7 +1216,10 @@ manage(Window w, XWindowAttributes *wa)
c->isfloating = c->oldstate = trans != None || c->isfixed; c->isfloating = c->oldstate = trans != None || c->isfixed;
if (c->isfloating) if (c->isfloating)
XRaiseWindow(dpy, c->win); XRaiseWindow(dpy, c->win);
attach(c);
if( attachbelow )
attachBelow(c);
else
attach(c);
attachstack(c); attachstack(c);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend, XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &(c->win), 1); (unsigned char *) &(c->win), 1);
@@ -1561,7 +1589,10 @@ sendmon(Client *c, Monitor *m)
detachstack(c); detachstack(c);
c->mon = m; c->mon = m;
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */ c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
attach(c);
if( attachbelow )
attachBelow(c);
else
attach(c);
attachstack(c); attachstack(c);
focus(NULL); focus(NULL);
arrange(NULL); arrange(NULL);
@@ -1889,7 +1920,8 @@ void
togglewin(const Arg *arg) togglewin(const Arg *arg)
{ {
Client *c = (Client*)arg->v; Client *c = (Client*)arg->v;

if (!c)
return;
if (c == selmon->sel) { if (c == selmon->sel) {
hidewin(c); hidewin(c);
focus(NULL); focus(NULL);
@@ -2054,7 +2086,10 @@ updategeom(void)
m->clients = c->next; m->clients = c->next;
detachstack(c); detachstack(c);
c->mon = mons; c->mon = mons;
attach(c);
if( attachbelow )
attachBelow(c);
else
attach(c);
attachstack(c); attachstack(c);
} }
if (m == selmon) if (m == selmon)


Načítá se…
Zrušit
Uložit