Remove bar

This commit is contained in:
Alex Kotov 2021-11-20 20:00:31 +05:00
parent 2812acbeaa
commit 1d95ddcfdc
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
6 changed files with 1 additions and 100 deletions

View File

@ -29,7 +29,6 @@ MODULES_SRC = \
src/util.c
DWM_SRC = \
src/dwm/bar.c \
src/dwm/handlers.c \
src/dwm/layouts.c \
src/dwm/swallow.c \

View File

@ -45,9 +45,6 @@ Send focused window to previous screen, if any.
.B Mod1\-Shift\-.
Send focused window to next screen, if any.
.TP
.B Mod1\-b
Toggles bar on and off.
.TP
.B Mod1\-m
Sets monocle layout.
.TP

View File

@ -70,7 +70,6 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_x, killclient, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
// Appearance
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
{ MODKEY|Mod1Mask, XK_b, configborder, {.i = -1 } },

View File

@ -104,15 +104,8 @@ typedef struct {
void (*arrange)(Monitor *);
} Layout;
typedef struct Bar {
int by;
int topbar;
int bh;
} *Bar;
struct Monitor {
Unit unit;
Bar bar;
int nmaster;
int num;
@ -124,9 +117,6 @@ struct Monitor {
Client *stack;
Monitor *next;
const Layout *lt[2];
// actual state
bool show_bar;
};
typedef struct {
@ -212,7 +202,6 @@ static Client *wintoclient(Window w);
static Monitor *wintomon(Window w);
static void zoom(const Arg *arg);
#include "dwm/bar.h"
#include "dwm/handlers.h"
#include "dwm/layouts.h"
#include "dwm/swallow.h"
@ -262,7 +251,6 @@ static xcb_connection_t *xcon;
* function implementations *
****************************/
#include "dwm/bar.c"
#include "dwm/handlers.c"
#include "dwm/layouts.c"
#include "dwm/swallow.c"
@ -374,10 +362,6 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact)
if (*y + *h + 2 * bw <= m->wy)
*y = m->wy;
}
if (*h < m->bar->bh)
*h = m->bar->bh;
if (*w < m->bar->bh)
*w = m->bar->bh;
if (
c->isfloating
||
@ -545,7 +529,6 @@ cleanupmon(Monitor *mon)
m->next = mon->next;
}
free(mon->bar);
UNIT_DELETE(mon->unit);
free(mon);
}
@ -580,25 +563,12 @@ createmon(void)
goto fail_without_unit;
}
if (!(m->bar = malloc(sizeof(struct Bar)))) {
goto fail_without_bar;
}
memset(m->bar, 0, sizeof(struct Bar));
m->bar->bh = drw->fonts->h + 2;
m->nmaster = settings_get_default_clients_in_master();
m->bar->topbar = settings_get_bar_on_top_by_default();
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
// actual state
m->show_bar = unit_get_show_bar(m->unit);
return m;
fail_without_bar:
UNIT_DELETE(m->unit);
fail_without_unit:
free(m);
fail_without_mon:
@ -920,18 +890,7 @@ manage(Window w, XWindowAttributes *wa)
}
c->x = MAX(c->x, c->mon->mx);
/* only fix client y-offset, if the client center might cover the bar */
c->y = MAX(
c->y,
(
(c->mon->bar->by == c->mon->my) &&
(c->x + (c->w / 2) >= c->mon->wx) &&
(c->x + (c->w / 2) < c->mon->wx + c->mon->ww)
)
? c->mon->bar->bh
: c->mon->my
);
c->y = MAX(c->y, c->mon->my);
c->bw = settings_get_border_width();
@ -1749,7 +1708,6 @@ updategeom(void)
m->my = m->wy = unique[i].y_org;
m->mw = m->ww = unique[i].width;
m->mh = m->wh = unique[i].height;
updatebarpos(m);
}
} else { /* less monitors available nn < n */
for (i = nn; i < n; i++) {
@ -1777,7 +1735,6 @@ updategeom(void)
dirty = 1;
mons->mw = mons->ww = sw;
mons->mh = mons->wh = sh;
updatebarpos(mons);
}
}
if (dirty) {

View File

@ -1,42 +0,0 @@
#ifndef _DWM_BAR_C
#define _DWM_BAR_C
void
togglebar(const Arg *arg)
{
unit_toggle_show_bar(selmon->unit);
updatebars();
}
void
updatebar(Monitor *m)
{
m->show_bar = unit_get_show_bar(m->unit);
updatebarpos(m);
arrange(m);
}
void
updatebars()
{
for (Monitor *m = mons; m; m = m->next) {
updatebar(m);
}
}
void
updatebarpos(Monitor *m)
{
m->wy = m->my;
m->wh = m->mh;
if (m->show_bar) {
m->wh -= m->bar->bh;
m->bar->by = m->bar->topbar ? m->wy : m->wy + m->wh;
m->wy = m->bar->topbar ? m->wy + m->bar->bh : m->wy;
} else
m->bar->by = -m->bar->bh;
}
#endif // _DWM_BAR_C

View File

@ -1,9 +0,0 @@
#ifndef _DWM_BAR_H
#define _DWM_BAR_H
static void togglebar(const Arg *arg);
static void updatebarpos(Monitor *m);
static void updatebar(Monitor *m);
static void updatebars();
#endif // _DWM_BAR_H