Remove anybar garbage code that wasn't being used anyway. I don't think

I'm going to add back anybar unless an issue asks for it. It causes
issues upon issues and no one is using it to my knowledge. I am not
using it myself meaning issues can sneak in without being noticed. I
think removing this patch is the best option. If one doesn't want the
default bar, just disable it.
This commit is contained in:
speedie 2022-12-04 21:30:20 +01:00
parent 14cb252263
commit 01dcf72c10
5 changed files with 3 additions and 156 deletions

View file

@ -2,10 +2,6 @@
!! Bar options
speedwm.bar.altbar: 0 ! Enable alternative bar (0/1)
speedwm.bar.altbarclass: Polybar ! Class of the alternative bar. Default is for Polybar.
speedwm.bar.altbarcmd: polybar & ! Alternative bar binary. Default is for Polybar.
speedwm.bar.alttrayname: tray ! Tray name, specifically for Polybar.
speedwm.bar.height: 4 ! Height of the bar in pixels (<num>)
speedwm.bar.position: 1 ! Position of the bar (0: Bottom, 1: Top)
speedwm.bar.paddingh: 10 ! Horizontal padding (extra space) around the bar in pixels (<num>)

View file

@ -65,25 +65,6 @@ static char font[] = "Noto Sans Regular 9"; /* Font t
/* Status options */
static char defaultstatus[] = ""; /* What to print when a status bar is not running */
/* Alternate bar
*
* Some users may prefer to use a different bar than what speedwm provides.
* Polybar users for example might want to use their (previously) bspwm bar in speedwm.
* If so, follow these instructions:
* - Use xprop to find the class (WM_CLASS) and add that to altbarclass
* - Set altbarcmd to the bar you want to use.
* - Set altbar to 1 (0 will disable it).
* - Recompile speedwm and restart it using 'speedwm_run -r'
*
* If you didn't do any changes to the source code, just run speedwm_run -r'
* If you use Polybar, the default settings here will work, just set altbar to 1.
*
*/
static int altbar = 0; /* Use alternative bar (0/1) */
static char *altbarcmd = "polybar &"; /* Command to run instead of the speedwm bar */
static char *altbarclass = "Polybar"; /* Alternate bar class name */
static char *alttrayname = "tray"; /* Tray instance name */
/* Task switcher options
* NOTE: The modifier and cycle key is a constant and because of this, it cannot be changed in speedwmrc/.Xresources.
*/

View file

@ -25,9 +25,7 @@ static Signal signals[] = {
{ 18, setmfact, {.f = +0.05} },
{ 19, setmfact, {.f = -0.05} },
{ 20, togglesticky, {0} },
/*
{ 21, togglebar, {0} },
*/
{ 22, togglefullscr, {0} },
{ 23, togglefloating, {0} },
{ 24, zoom, {0} },

130
speedwm.c
View file

@ -286,7 +286,6 @@ struct Monitor {
int mastercount; /* number of clients in the master stack */
int num;
int bh; /* bar geometry */
int tx, tw; /* bar tray geometry */
int btw;
int bt;
int mx, my, mw, mh; /* screen size */
@ -482,7 +481,6 @@ static int sendevent(Window w, Atom proto, int m, long d0, long d1, long d2, lon
static int sendevent(Client *c, Atom proto);
#endif
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void grabbuttons(Client *c, int focused);
static void hide(const Arg *arg);
@ -499,7 +497,6 @@ static void killunsel(const Arg *arg);
static void layoutmenu(const Arg *arg);
#endif
static void manage(Window w, XWindowAttributes *wa);
static void managetray(Window win, XWindowAttributes *wa);
static void mappingnotify(XEvent *e);
static void maprequest(XEvent *e);
static void motionnotify(XEvent *e);
@ -535,7 +532,6 @@ static void resizemouse(const Arg *arg);
#endif
static void restack(Monitor *m);
static void run(void);
static void scantray(void);
static void scan(void);
/* tile functions */
@ -595,8 +591,6 @@ static void spawn(const Arg *arg);
static void swapclient(const Arg *arg);
static void swapfocus(const Arg *arg);
static void togglemark(const Arg *arg);
static void spawnbar();
static void unmanagetray(Window w);
static void tagmon(const Arg *arg);
/* layouts */
@ -3080,9 +3074,6 @@ resetbarpadding(const Arg *arg)
void
resetbarpaddingv(const Arg *arg)
{
if (altbar)
return;
vp = (barposition == 1) ? barpaddingv : - barpaddingv;
updatebarpos(selmon);
@ -3092,9 +3083,6 @@ resetbarpaddingv(const Arg *arg)
void
resetbarpaddingh(const Arg *arg)
{
if (altbar)
return;
sp = barpaddingh;
updatebarpos(selmon);
@ -3104,9 +3092,6 @@ resetbarpaddingh(const Arg *arg)
void
togglebarpadding(const Arg *arg)
{
if (altbar)
return;
togglebarpaddingv(arg);
togglebarpaddingh(arg);
}
@ -3114,9 +3099,6 @@ togglebarpadding(const Arg *arg)
void
togglebarpaddingv(const Arg *arg)
{
if (altbar)
return;
/* if its more than 1, disable padding, else enable padding */
if (vp > 0) {
/* save padding */
@ -3132,9 +3114,6 @@ togglebarpaddingv(const Arg *arg)
void
togglebarpaddingh(const Arg *arg)
{
if (altbar)
return;
/* if its more than 1, disable padding, else enable padding */
if (sp > 0) {
/* save padding */
@ -3157,9 +3136,6 @@ setbarpadding(const Arg *arg)
void
setbarpaddingv(const Arg *arg)
{
if (altbar)
return;
vp += arg->i;
/* prevent bar weirdness */
@ -3175,9 +3151,6 @@ setbarpaddingv(const Arg *arg)
void
setbarpaddingh(const Arg *arg)
{
if (altbar)
return;
sp += arg->i;
/* prevent bar weirdness */
@ -3193,13 +3166,10 @@ setbarpaddingh(const Arg *arg)
void
setbarheight(const Arg *arg)
{
if (altbar)
return;
bh += arg->i;
if (bh < drw->font->h)
bh = altbar ? 0 : drw->font->h;
bh = drw->font->h;
updatebarpos(selmon);
arrange(selmon);
@ -3208,9 +3178,6 @@ setbarheight(const Arg *arg)
void
setbpgaps(const Arg *arg)
{
if (altbar)
return;
setbarpaddingv(arg);
setbarpaddingh(arg);
incrgaps(arg);
@ -3222,10 +3189,7 @@ setbpgaps(const Arg *arg)
void
resetbarheight(const Arg *arg)
{
if (altbar)
return;
bh = altbar ? 0 : drw->font->h + barheight;
bh = drw->font->h + barheight;
updatebarpos(selmon);
arrange(selmon);
@ -3480,25 +3444,6 @@ manage(Window w, XWindowAttributes *wa)
focus(NULL); /* no need if warpcursor is enabled because warpcursor is going to warp and focus the window anyway */
}
void
managetray(Window win, XWindowAttributes *wa)
{
Monitor *m;
if (!(m = recttomon(wa->x, wa->y, wa->width, wa->height)))
return;
m->traywin = win;
m->tx = wa->x;
m->tw = wa->width;
updatebarpos(m);
arrange(m);
XSelectInput(dpy, win, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
XMoveResizeWindow(dpy, win, wa->x, wa->y, wa->width, wa->height);
XMapWindow(dpy, win);
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
(unsigned char *) &win, 1);
}
void
mappingnotify(XEvent *e)
{
@ -4862,27 +4807,6 @@ scratchpad_show_first(void)
}
}
void
scantray(void)
{
unsigned int num;
Window d1, d2, *wins = NULL;
XWindowAttributes wa;
if (XQueryTree(dpy, root, &d1, &d2, &wins, &num)) {
for (unsigned int i = 0; i < num; i++) {
if (wmclasscontains(wins[i], altbarclass, alttrayname)) {
if (!XGetWindowAttributes(dpy, wins[i], &wa))
break;
managetray(wins[i], &wa);
}
}
}
if (wins)
XFree(wins);
}
void
sendmon(Client *c, Monitor *m)
{
@ -5251,7 +5175,7 @@ setup(void)
if (!drw_font_create(drw, font))
die("no fonts could be loaded.");
lrpad = drw->font->h;
bh = altbar ? 0 : drw->font->h + barheight;
bh = drw->font->h + barheight;
/* barpadding */
sp = barpaddingh;
@ -5358,7 +5282,6 @@ setup(void)
#if USEIPC
setupepoll();
#endif
spawnbar();
}
void
@ -5527,18 +5450,6 @@ tag(const Arg *arg)
}
}
void
spawnbar()
{
if (!altbar)
return;
if (*altbarcmd)
if (system(altbarcmd) == 0)
return;
}
void
tagmon(const Arg *arg)
{
@ -5596,14 +5507,6 @@ void
togglebar(const Arg *arg)
{
/**
* Polybar tray does not raise maprequest event. It must be manually scanned
* for. Scanning it too early while the tray is being populated would give
* wrong dimensions.
*/
if (altbar && !selmon->traywin)
scantray();
Bar *bar;
selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
@ -5617,9 +5520,6 @@ togglebar(const Arg *arg)
void
togglebarpos(const Arg *arg)
{
if (altbar)
return;
selmon->barposition = !selmon->barposition;
#if USESYSTRAY
if (!selmon->hidesystray) {
@ -5772,9 +5672,6 @@ resetpowerline(const Arg *arg)
void
resetbar(const Arg *arg)
{
if (altbar)
return;
selmon->hidetags = hidetags;
selmon->hidetitle = hidetitle;
selmon->hidelayout = hidelayout;
@ -5922,22 +5819,6 @@ unmanage(Client *c, int destroyed)
}
}
void
unmanagetray(Window w)
{
Monitor *m = wintomon(w);
if (!m)
return;
m->traywin = 0;
m->tx = 0;
m->tw = 0;
updatebarpos(m);
arrange(m);
}
void
unmapnotify(XEvent *e)
{
@ -5952,8 +5833,6 @@ unmapnotify(XEvent *e)
unmanage(c, 0);
#if USESYSTRAY
} else if (!hidesystray && (c = wintosystrayicon(ev->window))) {
/* KLUDGE! sometimes icons occasionally unmap their windows, but do
* _not_ destroy them. We map those windows back */
XMapRaised(dpy, c->win);
drawbarwin(systray->bar);
#endif
@ -5963,9 +5842,6 @@ unmapnotify(XEvent *e)
void
updatebars(void)
{
if (altbar)
return;
unsigned int w;
Bar *bar;
Monitor *m;

View file

@ -57,9 +57,6 @@ ResourcePref resources[] = {
{ "col.systray", STRING, &col_systray },
{ "run.shell", STRING, &shell },
{ "status.defaultstatus", STRING, &defaultstatus },
{ "bar.altbarclass", STRING, &altbarclass },
{ "bar.altbarcmd", STRING, &altbarcmd },
{ "bar.alttrayname", STRING, &alttrayname },
{ "fullscreen.lockfullscreen", INTEGER, &lockfullscreen },
{ "fullscreen.movefullscreenmon",INTEGER, &movefullscreenmon },
{ "fullscreen.hidebar", INTEGER, &fullscreenhidebar },
@ -123,7 +120,6 @@ ResourcePref resources[] = {
{ "mouse.cfact", INTEGER, &mousecfact },
{ "focus.spawned", INTEGER, &focusspawn },
{ "client.floatscratchpad", INTEGER, &floatscratchpad },
{ "bar.altbar", INTEGER, &altbar },
{ "client.autofocus", INTEGER, &autofocus },
{ "client.automove", INTEGER, &automove },
{ "client.autoresize", INTEGER, &autoresize },