mirror of
https://git.sr.ht/~coasteen/dotfiles
synced 2025-11-04 14:47:38 +01:00
Upload files to ".suckless/patch"
This commit is contained in:
parent
736b987538
commit
9e4091ea12
5 changed files with 122 additions and 0 deletions
20
.suckless/patch/bar_status.c
Normal file
20
.suckless/patch/bar_status.c
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
int
|
||||
width_status(Bar *bar, BarArg *a)
|
||||
{
|
||||
return TEXTWM(stext);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
draw_status(Bar *bar, BarArg *a)
|
||||
{
|
||||
return drw_text(drw, a->x, a->y, a->w, a->h, lrpad / 2, stext, 0, True);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
click_status(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
return ClkStatusText;
|
||||
}
|
||||
|
||||
4
.suckless/patch/bar_status.h
Normal file
4
.suckless/patch/bar_status.h
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
static int width_status(Bar *bar, BarArg *a);
|
||||
static int draw_status(Bar *bar, BarArg *a);
|
||||
static int click_status(Bar *bar, Arg *arg, BarArg *a);
|
||||
|
||||
9
.suckless/patch/bar_tagicons.c
Normal file
9
.suckless/patch/bar_tagicons.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
char *
|
||||
tagicon(Monitor *m, int tag)
|
||||
{
|
||||
int tagindex = tag + NUMTAGS * m->num;
|
||||
if (tagindex >= LENGTH(tagicons[DEFAULT_TAGS]))
|
||||
tagindex = tagindex % LENGTH(tagicons[DEFAULT_TAGS]);
|
||||
return tagicons[DEFAULT_TAGS][tagindex];
|
||||
}
|
||||
|
||||
8
.suckless/patch/bar_tagicons.h
Normal file
8
.suckless/patch/bar_tagicons.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
enum {
|
||||
DEFAULT_TAGS,
|
||||
ALTERNATIVE_TAGS,
|
||||
ALT_TAGS_DECORATION,
|
||||
};
|
||||
|
||||
static char * tagicon(Monitor *m, int tag);
|
||||
|
||||
81
.suckless/patch/bar_tags.c
Normal file
81
.suckless/patch/bar_tags.c
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
int
|
||||
width_tags(Bar *bar, BarArg *a)
|
||||
{
|
||||
int w, i;
|
||||
Client *c;
|
||||
unsigned int occ = 0;
|
||||
for (c = bar->mon->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
|
||||
for (w = 0, i = 0; i < NUMTAGS; i++) {
|
||||
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
|
||||
continue;
|
||||
w += TEXTW(tagicon(bar->mon, i));
|
||||
}
|
||||
return w;
|
||||
}
|
||||
|
||||
int
|
||||
draw_tags(Bar *bar, BarArg *a)
|
||||
{
|
||||
int invert;
|
||||
int w, x = a->x;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
char *icon;
|
||||
Client *c;
|
||||
Monitor *m = bar->mon;
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
for (i = 0; i < NUMTAGS; i++) {
|
||||
/* do not draw vacant tags */
|
||||
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
continue;
|
||||
|
||||
icon = tagicon(bar->mon, i);
|
||||
invert = 0;
|
||||
w = TEXTW(icon);
|
||||
drw_setscheme(drw, scheme[
|
||||
m->tagset[m->seltags] & 1 << i
|
||||
? SchemeTagsSel
|
||||
: urg & 1 << i
|
||||
? SchemeUrg
|
||||
: SchemeTagsNorm
|
||||
]);
|
||||
drw_text(drw, x, a->y, w, a->h, lrpad / 2, icon, invert, False);
|
||||
drawindicator(m, NULL, occ, x, a->y, w, a->h, i, -1, invert, tagindicatortype);
|
||||
x += w;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
click_tags(Bar *bar, Arg *arg, BarArg *a)
|
||||
{
|
||||
int i = 0, x = 0;
|
||||
Client *c;
|
||||
unsigned int occ = 0;
|
||||
for (c = bar->mon->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
|
||||
do {
|
||||
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
|
||||
continue;
|
||||
x += TEXTW(tagicon(bar->mon, i));
|
||||
} while (a->x >= x && ++i < NUMTAGS);
|
||||
if (i < NUMTAGS) {
|
||||
arg->ui = 1 << i;
|
||||
}
|
||||
return ClkTagBar;
|
||||
}
|
||||
|
||||
int
|
||||
hover_tags(Bar *bar, BarArg *a, XMotionEvent *ev)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue