mirror of
https://github.com/0intro/wmii
synced 2024-12-28 06:09:41 +03:00
added focuscolors (three color tuples now, which indicate focus and selection state)
This commit is contained in:
parent
9025f56301
commit
7324531047
@ -1,5 +1,4 @@
|
|||||||
- introduce empty views
|
- introduce empty views
|
||||||
- apply the focuscolor patch by Stefan Tibus
|
|
||||||
- UTF8 fixes with iconv?
|
- UTF8 fixes with iconv?
|
||||||
- move /<view> to /tags/<name|sel>/
|
- move /<view> to /tags/<name|sel>/
|
||||||
- add /tags/sel/index (for column reverse-addressing)
|
- add /tags/sel/index (for column reverse-addressing)
|
||||||
|
@ -46,7 +46,7 @@ create_bar(char *name, Bool intern)
|
|||||||
b->id = id++;
|
b->id = id++;
|
||||||
b->intern = intern;
|
b->intern = intern;
|
||||||
cext_strlcpy(b->name, name, sizeof(b->name));
|
cext_strlcpy(b->name, name, sizeof(b->name));
|
||||||
cext_strlcpy(b->colstr, def.selcolor, sizeof(b->colstr));
|
cext_strlcpy(b->colstr, def.focuscolor, sizeof(b->colstr));
|
||||||
b->color = def.sel;
|
b->color = def.sel;
|
||||||
cext_vattach(vector_of_bars(&bar), b);
|
cext_vattach(vector_of_bars(&bar), b);
|
||||||
qsort(bar.data, bar.size, sizeof(Bar *), comp_bar_name);
|
qsort(bar.data, bar.size, sizeof(Bar *), comp_bar_name);
|
||||||
@ -120,7 +120,7 @@ draw_bar()
|
|||||||
b = bar.data[i];
|
b = bar.data[i];
|
||||||
if(b->intern) {
|
if(b->intern) {
|
||||||
if(view.size && !strncmp(b->name, view.data[sel]->name, sizeof(b->name)))
|
if(view.size && !strncmp(b->name, view.data[sel]->name, sizeof(b->name)))
|
||||||
b->color = def.sel;
|
b->color = def.focus;
|
||||||
else
|
else
|
||||||
b->color = def.norm;
|
b->color = def.norm;
|
||||||
}
|
}
|
||||||
|
@ -273,9 +273,13 @@ draw_client(Client *c)
|
|||||||
d.gc = c->gc;
|
d.gc = c->gc;
|
||||||
|
|
||||||
if(c == sel_client())
|
if(c == sel_client())
|
||||||
d.color = def.sel;
|
d.color = def.focus;
|
||||||
else
|
else {
|
||||||
d.color = def.norm;
|
if(f->area->sel == fidx)
|
||||||
|
d.color = def.sel;
|
||||||
|
else
|
||||||
|
d.color = def.norm;
|
||||||
|
}
|
||||||
|
|
||||||
/* draw border */
|
/* draw border */
|
||||||
if(def.border) {
|
if(def.border) {
|
||||||
@ -301,19 +305,10 @@ draw_client(Client *c)
|
|||||||
d.rect.x = f->rect.width - d.rect.width;
|
d.rect.x = f->rect.width - d.rect.width;
|
||||||
d.data = buf;
|
d.data = buf;
|
||||||
|
|
||||||
if(f->area->sel == fidx)
|
|
||||||
d.color = def.sel;
|
|
||||||
else
|
|
||||||
d.color = def.norm;
|
|
||||||
blitz_drawlabel(dpy, &d);
|
blitz_drawlabel(dpy, &d);
|
||||||
blitz_drawborder(dpy, &d);
|
blitz_drawborder(dpy, &d);
|
||||||
d.rect.x = 0;
|
d.rect.x = 0;
|
||||||
|
|
||||||
if(c == sel_client())
|
|
||||||
d.color = def.sel;
|
|
||||||
else
|
|
||||||
d.color = def.norm;
|
|
||||||
|
|
||||||
/* tag bar */
|
/* tag bar */
|
||||||
d.rect.width = d.rect.height + blitz_textwidth(dpy, &blitzfont, c->tags);
|
d.rect.width = d.rect.height + blitz_textwidth(dpy, &blitzfont, c->tags);
|
||||||
if(d.rect.width + w > f->rect.width)
|
if(d.rect.width + w > f->rect.width)
|
||||||
|
21
cmd/wm/fs.c
21
cmd/wm/fs.c
@ -36,6 +36,7 @@ enum { WMII_IOUNIT = 2048 };
|
|||||||
* /def/ FsDdef
|
* /def/ FsDdef
|
||||||
* /def/border FsFborder 0..n
|
* /def/border FsFborder 0..n
|
||||||
* /def/font FsFfont xlib font name
|
* /def/font FsFfont xlib font name
|
||||||
|
* /def/focuscolors FsFfocuscolors focused colors
|
||||||
* /def/selcolors FsFselcolors selected colors
|
* /def/selcolors FsFselcolors selected colors
|
||||||
* /def/normcolors FsFnormcolors normal colors
|
* /def/normcolors FsFnormcolors normal colors
|
||||||
* /def/rules FsFrules rules
|
* /def/rules FsFrules rules
|
||||||
@ -196,6 +197,7 @@ name_of_qid(Qid wqid[IXP_MAX_WELEM], unsigned short qsel)
|
|||||||
snprintf(buf, sizeof(buf), "%u", i3);
|
snprintf(buf, sizeof(buf), "%u", i3);
|
||||||
return buf;
|
return buf;
|
||||||
break;
|
break;
|
||||||
|
case FsFfocuscolors: return "focuscolors"; break;
|
||||||
case FsFselcolors: return "selcolors"; break;
|
case FsFselcolors: return "selcolors"; break;
|
||||||
case FsFnormcolors: return "normcolors"; break;
|
case FsFnormcolors: return "normcolors"; break;
|
||||||
case FsFfont: return "font"; break;
|
case FsFfont: return "font"; break;
|
||||||
@ -297,6 +299,8 @@ type_of_name(Qid wqid[IXP_MAX_WELEM], unsigned short qsel, char *name)
|
|||||||
return FsFgeom;
|
return FsFgeom;
|
||||||
if(!strncmp(name, "colors", 7))
|
if(!strncmp(name, "colors", 7))
|
||||||
return FsFcolors;
|
return FsFcolors;
|
||||||
|
if(!strncmp(name, "focuscolors", 12))
|
||||||
|
return FsFfocuscolors;
|
||||||
if(!strncmp(name, "selcolors", 10))
|
if(!strncmp(name, "selcolors", 10))
|
||||||
return FsFselcolors;
|
return FsFselcolors;
|
||||||
if(!strncmp(name, "normcolors", 11))
|
if(!strncmp(name, "normcolors", 11))
|
||||||
@ -457,6 +461,7 @@ qid_of_name(Qid wqid[IXP_MAX_WELEM], unsigned short qsel, char *name)
|
|||||||
case FsFfont:
|
case FsFfont:
|
||||||
case FsFcolw:
|
case FsFcolw:
|
||||||
case FsFrules:
|
case FsFrules:
|
||||||
|
case FsFfocuscolors:
|
||||||
case FsFselcolors:
|
case FsFselcolors:
|
||||||
case FsFnormcolors:
|
case FsFnormcolors:
|
||||||
case FsFkeys:
|
case FsFkeys:
|
||||||
@ -609,6 +614,7 @@ stat_of_name(Stat *stat, char *name, Qid wqid[IXP_MAX_WELEM], unsigned short qse
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FsFcolors:
|
case FsFcolors:
|
||||||
|
case FsFfocuscolors:
|
||||||
case FsFselcolors:
|
case FsFselcolors:
|
||||||
case FsFnormcolors:
|
case FsFnormcolors:
|
||||||
return pack_stat(stat, wqid, qsel, name, 23, IXP_DMREAD | IXP_DMWRITE);
|
return pack_stat(stat, wqid, qsel, name, 23, IXP_DMREAD | IXP_DMWRITE);
|
||||||
@ -1049,6 +1055,8 @@ xread(IXPConn *c, Fcall *fcall)
|
|||||||
case FsDdef:
|
case FsDdef:
|
||||||
fcall->count = stat_of_name(&stat, "border", m->wqid, m->sel);
|
fcall->count = stat_of_name(&stat, "border", m->wqid, m->sel);
|
||||||
p = ixp_pack_stat(p, &stat);
|
p = ixp_pack_stat(p, &stat);
|
||||||
|
fcall->count += stat_of_name(&stat, "focuscolors", m->wqid, m->sel);
|
||||||
|
p = ixp_pack_stat(p, &stat);
|
||||||
fcall->count += stat_of_name(&stat, "selcolors", m->wqid, m->sel);
|
fcall->count += stat_of_name(&stat, "selcolors", m->wqid, m->sel);
|
||||||
p = ixp_pack_stat(p, &stat);
|
p = ixp_pack_stat(p, &stat);
|
||||||
fcall->count += stat_of_name(&stat, "normcolors", m->wqid, m->sel);
|
fcall->count += stat_of_name(&stat, "normcolors", m->wqid, m->sel);
|
||||||
@ -1218,6 +1226,10 @@ xread(IXPConn *c, Fcall *fcall)
|
|||||||
if((fcall->count = strlen(bar.data[i1]->colstr)))
|
if((fcall->count = strlen(bar.data[i1]->colstr)))
|
||||||
memcpy(p, bar.data[i1]->colstr, fcall->count);
|
memcpy(p, bar.data[i1]->colstr, fcall->count);
|
||||||
break;
|
break;
|
||||||
|
case FsFfocuscolors:
|
||||||
|
if((fcall->count = strlen(def.focuscolor)))
|
||||||
|
memcpy(p, def.focuscolor, fcall->count);
|
||||||
|
break;
|
||||||
case FsFselcolors:
|
case FsFselcolors:
|
||||||
if((fcall->count = strlen(def.selcolor)))
|
if((fcall->count = strlen(def.selcolor)))
|
||||||
memcpy(p, def.selcolor, fcall->count);
|
memcpy(p, def.selcolor, fcall->count);
|
||||||
@ -1418,6 +1430,15 @@ xwrite(IXPConn *c, Fcall *fcall)
|
|||||||
blitz_loadcolor(dpy, &bar.data[i1]->color, screen, bar.data[i1]->colstr);
|
blitz_loadcolor(dpy, &bar.data[i1]->color, screen, bar.data[i1]->colstr);
|
||||||
draw_bar();
|
draw_bar();
|
||||||
break;
|
break;
|
||||||
|
case FsFfocuscolors:
|
||||||
|
if((fcall->count != 23) || (fcall->data[0] != '#')
|
||||||
|
|| (fcall->data[8] != '#') || (fcall->data[16] != '#'))
|
||||||
|
return Ebadvalue;
|
||||||
|
memcpy(def.focuscolor, fcall->data, fcall->count);
|
||||||
|
def.focuscolor[fcall->count] = 0;
|
||||||
|
blitz_loadcolor(dpy, &def.sel, screen, def.focuscolor);
|
||||||
|
draw_clients();
|
||||||
|
break;
|
||||||
case FsFselcolors:
|
case FsFselcolors:
|
||||||
if((fcall->count != 23) || (fcall->data[0] != '#')
|
if((fcall->count != 23) || (fcall->data[0] != '#')
|
||||||
|| (fcall->data[8] != '#') || (fcall->data[16] != '#'))
|
|| (fcall->data[8] != '#') || (fcall->data[16] != '#'))
|
||||||
|
@ -143,7 +143,7 @@ init_screen()
|
|||||||
|
|
||||||
gcv.subwindow_mode = IncludeInferiors;
|
gcv.subwindow_mode = IncludeInferiors;
|
||||||
gcv.function = GXxor;
|
gcv.function = GXxor;
|
||||||
gcv.foreground = def.sel.bg;
|
gcv.foreground = def.focus.bg;
|
||||||
gcv.plane_mask = AllPlanes;
|
gcv.plane_mask = AllPlanes;
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
xorgc = XCreateGC(dpy, root, GCForeground | GCGraphicsExposures
|
xorgc = XCreateGC(dpy, root, GCForeground | GCGraphicsExposures
|
||||||
@ -303,6 +303,8 @@ main(int argc, char *argv[])
|
|||||||
def.border = 2;
|
def.border = 2;
|
||||||
def.colmode = Coldefault;
|
def.colmode = Coldefault;
|
||||||
def.colw = 0;
|
def.colw = 0;
|
||||||
|
cext_strlcpy(def.focuscolor, BLITZ_FOCUSCOLORS, sizeof(def.focuscolor));
|
||||||
|
blitz_loadcolor(dpy, &def.focus, screen, def.focuscolor);
|
||||||
cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor));
|
cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor));
|
||||||
blitz_loadcolor(dpy, &def.sel, screen, def.selcolor);
|
blitz_loadcolor(dpy, &def.sel, screen, def.selcolor);
|
||||||
cext_strlcpy(def.normcolor, BLITZ_NORMCOLORS, sizeof(def.normcolor));
|
cext_strlcpy(def.normcolor, BLITZ_NORMCOLORS, sizeof(def.normcolor));
|
||||||
|
@ -54,6 +54,7 @@ enum {
|
|||||||
FsFdata,
|
FsFdata,
|
||||||
FsFcolors,
|
FsFcolors,
|
||||||
FsFfont,
|
FsFfont,
|
||||||
|
FsFfocuscolors,
|
||||||
FsFselcolors,
|
FsFselcolors,
|
||||||
FsFnormcolors,
|
FsFnormcolors,
|
||||||
FsFkeys,
|
FsFkeys,
|
||||||
@ -149,9 +150,11 @@ typedef struct {
|
|||||||
|
|
||||||
/* default values */
|
/* default values */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
char focuscolor[24];
|
||||||
char selcolor[24];
|
char selcolor[24];
|
||||||
char normcolor[24];
|
char normcolor[24];
|
||||||
char *font;
|
char *font;
|
||||||
|
BlitzColor focus;
|
||||||
BlitzColor sel;
|
BlitzColor sel;
|
||||||
BlitzColor norm;
|
BlitzColor norm;
|
||||||
unsigned int border;
|
unsigned int border;
|
||||||
|
@ -361,9 +361,9 @@ main(int argc, char *argv[])
|
|||||||
if (!normcolstr || strlen(normcolstr) != 23)
|
if (!normcolstr || strlen(normcolstr) != 23)
|
||||||
normcolstr = strdup(BLITZ_NORMCOLORS);
|
normcolstr = strdup(BLITZ_NORMCOLORS);
|
||||||
blitz_loadcolor(dpy, &normcolor, screen, normcolstr);
|
blitz_loadcolor(dpy, &normcolor, screen, normcolstr);
|
||||||
selcolstr = getenv("WMII_SELCOLORS");
|
selcolstr = getenv("WMII_FOCUSCOLORS");
|
||||||
if (!selcolstr || strlen(selcolstr) != 23)
|
if (!selcolstr || strlen(selcolstr) != 23)
|
||||||
selcolstr = strdup(BLITZ_SELCOLORS);
|
selcolstr = strdup(BLITZ_FOCUSCOLORS);
|
||||||
blitz_loadcolor(dpy, &selcolor, screen, selcolstr);
|
blitz_loadcolor(dpy, &selcolor, screen, selcolstr);
|
||||||
|
|
||||||
wa.override_redirect = 1;
|
wa.override_redirect = 1;
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
#include <X11/Xlocale.h>
|
#include <X11/Xlocale.h>
|
||||||
|
|
||||||
#define BLITZ_FONT "fixed"
|
#define BLITZ_FONT "fixed"
|
||||||
#define BLITZ_SELCOLORS "#ffffff #285577 #4c7899"
|
#define BLITZ_FOCUSCOLORS "#ffffff #285577 #4c7899"
|
||||||
|
#define BLITZ_SELCOLORS "#bbbbbb #103355 #18466a"
|
||||||
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
|
#define BLITZ_NORMCOLORS "#222222 #eeeeee #666666"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -17,12 +17,13 @@ LEFT=h
|
|||||||
RIGHT=l
|
RIGHT=l
|
||||||
|
|
||||||
WMII_FONT='fixed'
|
WMII_FONT='fixed'
|
||||||
WMII_SELCOLORS='#ffffff #285577 #4c7899'
|
WMII_FOCUSCOLORS='#ffffff #285577 #4c7899'
|
||||||
|
WMII_SELCOLORS='#bbbbbb #103355 #18466a'
|
||||||
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
WMII_NORMCOLORS='#222222 #eeeeee #666666'
|
||||||
# dark background
|
# dark background
|
||||||
#WMII_NORMCOLORS='#e0e0e0 #0a0a0a #202020'
|
#WMII_NORMCOLORS='#e0e0e0 #0a0a0a #202020'
|
||||||
|
|
||||||
export WMII_FONT WMII_NORMCOLORS WMII_SELCOLORS
|
export WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
|
||||||
|
|
||||||
# give wmiiwm a chance to start
|
# give wmiiwm a chance to start
|
||||||
while :
|
while :
|
||||||
@ -34,6 +35,7 @@ done
|
|||||||
# WM CONFIGURATION
|
# WM CONFIGURATION
|
||||||
xwrite /def/border 2
|
xwrite /def/border 2
|
||||||
xwrite /def/font $WMII_FONT
|
xwrite /def/font $WMII_FONT
|
||||||
|
xwrite /def/focuscolors $WMII_FOCUSCOLORS
|
||||||
xwrite /def/selcolors $WMII_SELCOLORS
|
xwrite /def/selcolors $WMII_SELCOLORS
|
||||||
xwrite /def/normcolors $WMII_NORMCOLORS
|
xwrite /def/normcolors $WMII_NORMCOLORS
|
||||||
xwrite /def/colmode default
|
xwrite /def/colmode default
|
||||||
|
Loading…
Reference in New Issue
Block a user