Add systray color scheme
This commit is contained in:
parent
3c82600eff
commit
1f9641927e
2
colors.h
2
colors.h
|
@ -15,6 +15,7 @@ static char *colors[][3] = {
|
|||
[SchemeSelTitle] = { col_textsel, col_title, col_textsel },
|
||||
[SchemeHiddenTitle] = { col_title, col_background, col_title },
|
||||
[SchemeLayout] = { col_layouttext, col_layoutbgsel, col_layoutbgnorm },
|
||||
[SchemeSystray] = { col_systraybg, col_systraybg, col_systraybg },
|
||||
/* text background window border
|
||||
*/
|
||||
};
|
||||
|
@ -52,6 +53,7 @@ static const unsigned int alphas[][3] = {
|
|||
[SchemeHiddenTitle] = { OPAQUE, hiddenopacity, hiddenopacity },
|
||||
[SchemeNormBorder] = { OPAQUE, normborderopacity, selborderopacity },
|
||||
[SchemeTags] = { tagselopacity, tagselopacity, tagnormopacity },
|
||||
[SchemeSystray] = { OPAQUE, systrayopacity, systrayopacity },
|
||||
};
|
||||
|
||||
/* Colors to use for tags
|
||||
|
|
|
@ -55,6 +55,10 @@
|
|||
- speedwm.col_layoutbgnorm: #222222
|
||||
- speedwm.col_layoutbgsel: #bbbbbb
|
||||
!!
|
||||
!! Systray colors
|
||||
!!
|
||||
- speedwm.col_systraybg: #222222
|
||||
!!
|
||||
!! Status colors
|
||||
!!
|
||||
!! These are status2d colors. If you are a user of the default status bar, they will be used without any additional effort.
|
||||
|
|
2
host.mk
2
host.mk
|
@ -14,7 +14,7 @@ HTMLDIR = "/home/anon/Projects/page"
|
|||
# If you use GNU/Linux, uncomment these lines (remove the # at the start of the line below)
|
||||
FREETYPELIBS = -lfontconfig -lXft
|
||||
FREETYPEINC = /usr/include/freetype2
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-result -Ofast -march=native ${INCS} ${CPPFLAGS}
|
||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Wno-unused-variable -Wno-unused-result -Wno-unused-function -Ofast -march=native ${INCS} ${CPPFLAGS}
|
||||
LDFLAGS = ${LIBS}
|
||||
|
||||
# OpenBSD support
|
||||
|
|
|
@ -306,7 +306,10 @@ static char col_layouttext[] = "#000000"; /* Layout indicator t
|
|||
static char col_layoutbgnorm[] = "#222222"; /* Layout indicator background (norm) */
|
||||
static char col_layoutbgsel[] = "#bbbbbb"; /* Layout indicator background (norm) */
|
||||
|
||||
/* status2d colors */
|
||||
/* Systray colors */
|
||||
static char col_systraybg[] = "#222222"; /* Systray background color */
|
||||
|
||||
/* Status colors */
|
||||
static char col_status0[] = "#131210";
|
||||
static char col_status1[] = "#bf616a";
|
||||
static char col_status2[] = "#A16F9D";
|
||||
|
@ -341,6 +344,7 @@ static const unsigned int normborderopacity = OPAQUE; /* Opacity for the all w
|
|||
static const unsigned int selborderopacity = OPAQUE; /* Opacity for the selected window border */
|
||||
static const unsigned int hiddenopacity = 0; /* Opacity for hidden/minimized windows */
|
||||
static const unsigned int statusopacity = 160; /* Opacity for speedwm status bar */
|
||||
static const unsigned int systrayopacity = 160; /* Opacity for the speedwm built in systray */
|
||||
|
||||
/* Tag text options
|
||||
*
|
||||
|
|
64
speedwm.c
64
speedwm.c
|
@ -105,6 +105,7 @@ enum { SchemeNormBorder,
|
|||
SchemeNormTitle,
|
||||
SchemeSelTitle,
|
||||
SchemeStatus,
|
||||
SchemeSystray,
|
||||
};
|
||||
|
||||
enum { NetSupported, NetWMName,
|
||||
|
@ -3739,55 +3740,6 @@ propertynotify(XEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
saveSession(void)
|
||||
{
|
||||
FILE *fw = fopen(SESSION_FILE, "w");
|
||||
for (Client *c = selmon->clients; c != NULL; c = c->next) { // get all the clients with their tags and write them to the file
|
||||
fprintf(fw, "%lu %u\n", c->win, c->tags);
|
||||
}
|
||||
fclose(fw);
|
||||
}
|
||||
|
||||
void
|
||||
restoreSession(void)
|
||||
{
|
||||
// restore session
|
||||
FILE *fr = fopen(SESSION_FILE, "r");
|
||||
if (!fr)
|
||||
return;
|
||||
|
||||
char *str = malloc(23 * sizeof(char)); // allocate enough space for excepted input from text file
|
||||
while (fscanf(fr, "%[^\n] ", str) != EOF) { // read file till the end
|
||||
long unsigned int winId;
|
||||
unsigned int tagsForWin;
|
||||
int check = sscanf(str, "%lu %u", &winId, &tagsForWin); // get data
|
||||
if (check != 2) // break loop if data wasn't read correctly
|
||||
break;
|
||||
|
||||
for (Client *c = selmon->clients; c ; c = c->next) { // add tags to every window by winId
|
||||
if (c->win == winId) {
|
||||
c->tags = tagsForWin;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Client *c = selmon->clients; c ; c = c->next) { // refocus on windows
|
||||
focus(c);
|
||||
restack(c->mon);
|
||||
}
|
||||
|
||||
for (Monitor *m = selmon; m; m = m->next) // rearrange all monitors
|
||||
arrange(m);
|
||||
|
||||
free(str);
|
||||
fclose(fr);
|
||||
|
||||
// delete a file
|
||||
remove(SESSION_FILE);
|
||||
}
|
||||
|
||||
void
|
||||
quit(const Arg *arg)
|
||||
{
|
||||
|
@ -3805,9 +3757,6 @@ quit(const Arg *arg)
|
|||
|
||||
if(arg->i) restart = 1;
|
||||
running = 0;
|
||||
|
||||
if (restart == 1)
|
||||
saveSession();
|
||||
}
|
||||
|
||||
Client *
|
||||
|
@ -5788,10 +5737,10 @@ updatesystray(void)
|
|||
/* init systray */
|
||||
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
|
||||
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
|
||||
systray->win = XCreateSimpleWindow(dpy, root, x, y, w, bh, 0, 0, scheme[SchemeSelTitle][ColBg].pixel);
|
||||
systray->win = XCreateSimpleWindow(dpy, root, x, y, w, bh, 0, 0, scheme[SchemeSystray][ColBg].pixel);
|
||||
wa.event_mask = ButtonPressMask | ExposureMask;
|
||||
wa.override_redirect = True;
|
||||
wa.background_pixel = scheme[SchemeBar][ColBg].pixel;
|
||||
wa.background_pixel = scheme[SchemeSystray][ColBg].pixel;
|
||||
XSelectInput(dpy, systray->win, SubstructureNotifyMask);
|
||||
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
|
||||
PropModeReplace, (unsigned char *)&netatom[NetSystemTrayOrientationHorz], 1);
|
||||
|
@ -5803,7 +5752,7 @@ updatesystray(void)
|
|||
XSync(dpy, False);
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "dwm: unable to obtain system tray.\n");
|
||||
fprintf(stderr, "speedwm: failed to get systray.\n");
|
||||
free(systray);
|
||||
systray = NULL;
|
||||
return;
|
||||
|
@ -5811,7 +5760,7 @@ updatesystray(void)
|
|||
}
|
||||
for (w = 0, i = systray->icons; i; i = i->next) {
|
||||
/* make sure the background color stays the same */
|
||||
wa.background_pixel = scheme[SchemeBar][ColBg].pixel;
|
||||
wa.background_pixel = scheme[SchemeSystray][ColBg].pixel;
|
||||
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
|
||||
XMapRaised(dpy, i->win);
|
||||
w += systrayspacing;
|
||||
|
@ -5830,7 +5779,7 @@ updatesystray(void)
|
|||
XMapWindow(dpy, systray->win);
|
||||
XMapSubwindows(dpy, systray->win);
|
||||
/* redraw background */
|
||||
XSetForeground(dpy, drw->gc, scheme[SchemeBar][ColBg].pixel);
|
||||
XSetForeground(dpy, drw->gc, scheme[SchemeSystray][ColBg].pixel);
|
||||
//XFillRectangle(dpy, systray->win, drw->gc, 0, 0, w, bh); // vanilla
|
||||
XFillRectangle(dpy, systray->win, XCreateGC(dpy, root, 0 , NULL), 0, 0, w, bh);
|
||||
XSync(dpy, False);
|
||||
|
@ -6109,7 +6058,6 @@ main(int argc, char *argv[])
|
|||
die("pledge");
|
||||
#endif /* __OpenBSD__ */
|
||||
scan();
|
||||
restoreSession();
|
||||
run();
|
||||
if(restart) execvp(argv[0], argv);
|
||||
cleanup();
|
||||
|
|
|
@ -53,9 +53,11 @@ ResourcePref resources[] = {
|
|||
{ "col_status13", STRING, &col_status13 },
|
||||
{ "col_status14", STRING, &col_status14 },
|
||||
{ "col_status15", STRING, &col_status15 },
|
||||
{ "col_systraybg", STRING, &col_systraybg },
|
||||
|
||||
/* pywal support */
|
||||
{ "color0", STRING, &col_background },
|
||||
{ "color0", STRING, &col_systraybg },
|
||||
{ "color4", STRING, &col_title },
|
||||
{ "color8", STRING, &col_windowbordersel },
|
||||
{ "color0", STRING, &col_windowbordernorm },
|
||||
|
|
Loading…
Reference in a new issue