Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | icons are ready for testing |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk | master |
Files: | files | file ages | folders |
SHA3-256: |
5d32742a6af6aa834e93adbb0fdf3847 |
User & Date: | jesse@mccluresk9.com 2014-02-12 15:28:41 |
Context
2014-02-12
| ||
16:21 | allow for 1-bit opacity mask icons check-in: d8102a3a0a user: jesse@mccluresk9.com tags: trunk, master | |
15:28 | icons are ready for testing check-in: 5d32742a6a user: jesse@mccluresk9.com tags: trunk, master | |
2014-02-08
| ||
18:42 | fixed redraw on chvt check-in: 7ebf00f16e user: jesse@mccluresk9.com tags: trunk, master | |
Changes
Changes to TODO.
1 2 |
icons |
| |
1 2 |
add option for fixed-color tag icons
|
Changes to doc/alopex-1.tex.
2
3
4
5
6
7
8
9
10
11
12
13
14
15
..
24
25
26
27
28
29
30
31
32
33
|
\begin{Name}{1}{alopex}{Jesse McClure}{window manager}{Alopex - A Tabbed, Tiling Window Manager with Fur} \Prog{Alopex} - A Tabbed, Tiling Window Manager with Fur \end{Name} \section{Description} \Prog{Alopex} is ... \section{Author} Copyright \copyright 2012-2013 Jesse McClure \\ License GPLv3: GNU GPL version 3 \URL{http://gnu.org/licenses/gpl.html} \\ ................................................................................ \URL{http://mccluresk9.com/software.html} Documentation added and edited collaboratively by Jesse McClure and Sam Stuewe. Any concerns or comments regarding documentation may be submitted to \Email{halosghost@archlinux.info}. \section{See Also} \Cmd{alopex.config}{5}, \LatexManEnd |
>
>
>
|
>
|
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
..
27
28
29
30
31
32
33
34
35
36
37
|
\begin{Name}{1}{alopex}{Jesse McClure}{window manager}{Alopex - A Tabbed, Tiling Window Manager with Fur} \Prog{Alopex} - A Tabbed, Tiling Window Manager with Fur \end{Name} \section{Synopsis} xinit alopex \oArg{theme} \section{Description} \Prog{Alopex} is ... \section{Author} Copyright \copyright 2012-2013 Jesse McClure \\ License GPLv3: GNU GPL version 3 \URL{http://gnu.org/licenses/gpl.html} \\ ................................................................................ \URL{http://mccluresk9.com/software.html} Documentation added and edited collaboratively by Jesse McClure and Sam Stuewe. Any concerns or comments regarding documentation may be submitted to \Email{halosghost@archlinux.info}. \section{See Also} The most up to date documentation can be found at \URL{https://github.com/TrilbyWhite/alopex/wiki} \LatexManEnd |
Changes to src/draw.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 .. 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 ... 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 ... 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 ... 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 ... 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
#include "alopex.h" static int round_rect(Bar *, int, int, int, int, int, int, int, int); static int set_color(cairo_t *, int); static int sbar_icon(Bar *, int); static int sbar_text(Bar *, const char *); int draw_bar_sub(Monitor *M, Container *C, Bar *S, int x, Bool bg) { if (C->bar->opts & BAR_HIDE) return 0; if (S->w < 1) return 0; cairo_rectangle(C->bar->ctx, x, 0, S->w, C->bar->h); cairo_clip(C->bar->ctx); if (bg) { /* draw background as needed */ ................................................................................ if (m->focus == C && C->top == c) theme = 3; else if (C->top == c) theme = 6; round_rect(b, x, 0, w, h, TabOffset, TabBackground + theme, TabBorder + theme, TabText + theme); double off = conf.theme[TabText+theme].r; cairo_text_extents_t ext; cairo_text_extents(b->ctx, c->title, &ext); if (off < 0) off *= -1; else { off *= w - ext.x_advance; if (off < 0) off = 0; } // if icon, adjust off // TODO icons cairo_rectangle(b->ctx, x+off, 0, w-off, h); cairo_clip(b->ctx); cairo_move_to(b->ctx, x+off, h - 4); // - 4 ? cairo_show_text(b->ctx, c->title); cairo_reset_clip(b->ctx); } int icons_init(const char *fname) { return 0; } int icons_free() { return 0; } int round_rect(Bar *b, int x, int y, int w, int h, int off, int bg, int brd, int txt) { const Theme *q = &conf.theme[off]; if (b->opts & BAR_BOTTOM) { ................................................................................ cairo_set_line_width(b->ctx, conf.theme[brd].r); cairo_stroke(b->ctx); if (b->opts & BAR_BOTTOM) cairo_restore(b->ctx); set_color(b->ctx, txt); return 0; } int sbar_icon(Bar *S, int n) { if ( (--n) < 0 || n > 99) return 1; cairo_save(S->ctx); //cairo_set_source_surface(S->ctx, icon_img[n], S->xoff, 2); //cairo_paint(S->ctx); //S->xoff += icon_size; cairo_restore(S->ctx); return 0; } int sbar_parse(Bar *S, const char *s) { cairo_save(S->ctx); cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR); ................................................................................ cairo_restore(S->ctx); S->xoff = 0; set_color(S->ctx, StatusText); const char *c; char *t1, *t2, *str; double r, g, b, a; for (c = s; c && *c != '&' && *c != '\0' && *c != '\n'; c++) { if (*c == '{') { if (*(++c) == 'i') sbar_icon(S, atoi((++c))); else if (*c == 'f') cairo_set_font_face(S->ctx, conf.font); else if (*c == 'F') cairo_set_font_face(S->ctx, conf.bfont); else if (sscanf(c, "%lf %lf %lf %lf", &r, &g, &b, &a) == 4) cairo_set_source_rgba(S->ctx, r, g, b, a); c = strchr(c, '}'); } else { ................................................................................ return 1; } else return 0; } static int sbar_tag_icon(Monitor *M, Bar *S, int i) { if (conf.tag_icon[i] == -1) return 1; else return sbar_icon(S, conf.tag_icon[i]); } static int sbar_tag_text(Monitor *M, Bar *S, int i) { if (conf.tag_name[i][0] == '-') return 1; set_color(S->ctx, TagOccupied); if (M->occ & (1<<i)) cairo_set_font_face(S->ctx, conf.bfont); else cairo_set_font_face(S->ctx, conf.font); if ( (M->tags & (1<<i)) && (M->tags & (1<<(1+16))) ) set_color(S->ctx, TagBoth); else if (M->tags & (1<<i)) set_color(S->ctx, TagView); else if (M->tags & (1<<(i+16))) set_color(S->ctx, TagAlt); else if (!(M->occ & (1<<i))) return 0; sbar_text(S, conf.tag_name[i]); S->xoff += conf.bar_pad; return 1; } int sbar_tags(Monitor *M) { if (M->container->bar->opts & BAR_HIDE) return 0; ................................................................................ cairo_save(S->ctx); cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR); cairo_paint(S->ctx); cairo_restore(S->ctx); S->xoff = conf.bar_pad; int i, count = 0; for (i = 0; conf.tag_name[i]; i++) { switch (conf.tag_mode) { case TAG_ICON_TEXT: count += sbar_tag_icon(M, S, i); case TAG_TEXT: count += sbar_tag_text(M, S, i); break; case TAG_TEXT_ICON: count += sbar_tag_text(M, S, i); case TAG_ICON: count += sbar_tag_icon(M, S, i); break; } } |
| > > > | | > > > > > > > > > > > > > > > > > > > > > > > > | > > | | > > > > | | > | < < < < < < < < > > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 .. 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 ... 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 ... 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 ... 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 ... 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
#include "alopex.h" static int round_rect(Bar *, int, int, int, int, int, int, int, int); static int set_color(cairo_t *, int); static int sbar_icon(Bar *, int, Bool); static int sbar_text(Bar *, const char *); static cairo_surface_t *icon_img[100]; int draw_bar_sub(Monitor *M, Container *C, Bar *S, int x, Bool bg) { if (C->bar->opts & BAR_HIDE) return 0; if (S->w < 1) return 0; cairo_rectangle(C->bar->ctx, x, 0, S->w, C->bar->h); cairo_clip(C->bar->ctx); if (bg) { /* draw background as needed */ ................................................................................ if (m->focus == C && C->top == c) theme = 3; else if (C->top == c) theme = 6; round_rect(b, x, 0, w, h, TabOffset, TabBackground + theme, TabBorder + theme, TabText + theme); double off = conf.theme[TabText+theme].r; cairo_text_extents_t ext; cairo_text_extents(b->ctx, c->title, &ext); if (c->icon) ext.x_advance += conf.font_size + conf.bar_pad; if (off < 0) off *= -1; else { off *= w - ext.x_advance; if (off < 0) off = 0; } if (c->icon) { cairo_save(b->ctx); cairo_set_source_surface(b->ctx, c->icon, x + off, (b->h - conf.font_size) / 2.0); cairo_paint(b->ctx); off += conf.font_size + conf.bar_pad; cairo_restore(b->ctx); } cairo_rectangle(b->ctx, x+off, 0, w-off, h); cairo_clip(b->ctx); cairo_move_to(b->ctx, x+off, h - 4); // - 4 ? cairo_show_text(b->ctx, c->title); cairo_reset_clip(b->ctx); } int icons_init(const char *fname) { double iw, ih; int i, j, fs = conf.font_size; cairo_surface_t *img = cairo_image_surface_create_from_png(fname); iw = cairo_image_surface_get_width(img) / 10.0; ih = cairo_image_surface_get_height(img) / 10.0; cairo_t *ctx; for (j = 0; j < 10; j++) for (i = 0; i < 10; i++) { icon_img[j*10+i] = cairo_image_surface_create(0, fs, fs); ctx = cairo_create(icon_img[j*10+i]); cairo_scale(ctx, fs/iw, fs/ih); cairo_set_source_surface(ctx, img, -1 * i * iw, -1 * j * ih); cairo_paint(ctx); cairo_destroy(ctx); } cairo_surface_destroy(img); return 0; } int icons_free() { int i; for (i = 0; i < 100; i++) cairo_surface_destroy(icon_img[i]); return 0; } int round_rect(Bar *b, int x, int y, int w, int h, int off, int bg, int brd, int txt) { const Theme *q = &conf.theme[off]; if (b->opts & BAR_BOTTOM) { ................................................................................ cairo_set_line_width(b->ctx, conf.theme[brd].r); cairo_stroke(b->ctx); if (b->opts & BAR_BOTTOM) cairo_restore(b->ctx); set_color(b->ctx, txt); return 0; } int sbar_icon(Bar *S, int n, Bool col) { // TODO fix the "2" if ( (--n) < 0 || n > 99) return 1; cairo_save(S->ctx); if (col) { cairo_set_source_surface(S->ctx, icon_img[n], S->xoff, 2); cairo_paint(S->ctx); } else { cairo_mask_surface(S->ctx, icon_img[n], S->xoff, 2); } S->xoff += conf.font_size; cairo_restore(S->ctx); return 0; } int sbar_parse(Bar *S, const char *s) { cairo_save(S->ctx); cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR); ................................................................................ cairo_restore(S->ctx); S->xoff = 0; set_color(S->ctx, StatusText); const char *c; char *t1, *t2, *str; double r, g, b, a; for (c = s; c && *c != '&' && *c != '\0' && *c != '\n'; c++) { if (*c == '{') { if (*(++c) == 'i') sbar_icon(S, atoi((++c)), True); else if (*c == 'I') sbar_icon(S, atoi((++c)), False); else if (*c == 'f') cairo_set_font_face(S->ctx, conf.font); else if (*c == 'F') cairo_set_font_face(S->ctx, conf.bfont); else if (sscanf(c, "%lf %lf %lf %lf", &r, &g, &b, &a) == 4) cairo_set_source_rgba(S->ctx, r, g, b, a); c = strchr(c, '}'); } else { ................................................................................ return 1; } else return 0; } static int sbar_tag_icon(Monitor *M, Bar *S, int i) { if (conf.tag_icon[i] == -1) return 1; else return sbar_icon(S, conf.tag_icon[i], True); //TODO: True -> conf } static int sbar_tag_text(Monitor *M, Bar *S, int i) { if (conf.tag_name[i][0] == '-') return 1; sbar_text(S, conf.tag_name[i]); S->xoff += conf.bar_pad; return 1; } int sbar_tags(Monitor *M) { if (M->container->bar->opts & BAR_HIDE) return 0; ................................................................................ cairo_save(S->ctx); cairo_set_operator(S->ctx, CAIRO_OPERATOR_CLEAR); cairo_paint(S->ctx); cairo_restore(S->ctx); S->xoff = conf.bar_pad; int i, count = 0; for (i = 0; conf.tag_name[i]; i++) { set_color(S->ctx, TagOccupied); if (M->occ & (1<<i)) cairo_set_font_face(S->ctx, conf.bfont); else cairo_set_font_face(S->ctx, conf.font); if ( (M->tags & (1<<i)) && (M->tags & (1<<(1+16))) ) set_color(S->ctx, TagBoth); else if (M->tags & (1<<i)) set_color(S->ctx, TagView); else if (M->tags & (1<<(i+16))) set_color(S->ctx, TagAlt); else if (!(M->occ & (1<<i))) continue; switch (conf.tag_mode) { case TAG_ICON_TEXT: count += sbar_tag_icon(M, S, i); case TAG_TEXT: count += sbar_tag_text(M, S, i); break; case TAG_TEXT_ICON: count += sbar_tag_text(M, S, i); case TAG_ICON: count += sbar_tag_icon(M, S, i); break; } } |
Deleted src/tile.back.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
#include "alopex.h" static int resize_container(Monitor *, Container *, int, int); static Bool tile_check(Monitor *, Container *, Client *); static int tile_container(Monitor *, Container *, Client *, int); int tile() { Monitor *M; Container *C; Client *c, *pc; int num, cn, numC, ord; for (M = mons; M; M = M->next) { /* calculate how many containers will be used: */ if (M->mode == MONOCLE) numC = 1; else { c = clients; for (numC = 0, C = M->container; C; C = C->next, numC++) { cn = (M->mode == MONOCLE ? 1024 : (C->n > 0 ? C->n : 1024)); for (num = 0, pc = c; c && num < cn; c = c->next) if (tile_check(M, C, c)) num++; if (num == 0) break; } } /* tile each used container: */ c = clients; for (ord = 0, C = M->container; C; C = C->next, ord++) { cn = (M->mode == MONOCLE ? 1024 : (C->n > 0 ? C->n : 1024)); for (num = 0, pc = c; c && num < cn; c = c->next) if (tile_check(M, C, c)) num++; resize_container(M, C, numC, ord); tile_container(M, C, pc, num); } for (c = clients; c; c = c->next) { // TODO tile floaters } } } int resize_container(Monitor *M, Container *C, int numC, int ord) { int stack_size; if (numC == 1) { C->x = M->x + M->gap; C->y = M->y + M->gap; C->w = M->w - 2 * M->gap; C->h = M->h - 2 * M->gap; } else if (M->mode == RSTACK) { stack_size = (M->h - M->gap) / (numC - 1) - M->gap; C->x = M->x + M->gap + (ord ? (M->w - M->gap) / 2 + M->split: 0); C->y = M->y + M->gap + (stack_size + M->gap) * (ord ? ord - 1 : 0); C->w = (ord ? M->w - M->gap - C->x - M->split : (M->w - M->gap) / 2 - M->gap + M->split); C->h = (ord ? stack_size : M->h - 2 * M->gap); // - if (ord == numC - 1) C->h = M->h - M->gap - C->y + M->y; } else if (M->mode == BSTACK) { // TODO } if (!(C->bar_opts & BAR_HIDE)) { C->h -= C->bar->h; if (!(C->bar_opts & BAR_BOTTOM)) C->y += C->bar->h; } } Bool tile_check(Monitor *M, Container *C, Client *c) { return ((M->tags | c->tags) && !(c->flags & WIN_FLOAT)); } int tile_container(Monitor *M, Container *C, Client *pc, int num) { //TODO get / set C->top Client *c; if (C->bar_opts & BAR_HIDE) purgatory(C->win); else { if (C->bar_opts & BAR_BOTTOM) XMoveResizeWindow(dpy, C->win, C->x, C->y+C->h, C->w, C->bar->h); else XMoveResizeWindow(dpy, C->win, C->x, C->y ,C->w, C->bar->h); } for (c = pc; c && num; c = c->next, num--) { if (tile_check(M, C, c)) XMoveResizeWindow(dpy, c->win, C->x, C->y, C->w, C->h); } } |
< < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < |
Changes to src/xlib.c.
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
if (hint->flags & (IconPixmapHint | IconMaskHint)) get_icon(c); XFree(hint); // TODO EWMH checks return 0; } int get_icon(Client *c) { // TODO return 0; } int get_name(Client *c) { static const char *noname = "(no name)"; Client *p; if (c->title && c->title != noname) XFree(c->title); |
| > > > > > > > > > > > > > > > > > > > > > > > > > |
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
if (hint->flags & (IconPixmapHint | IconMaskHint)) get_icon(c); XFree(hint); // TODO EWMH checks return 0; } int get_icon(Client *c) { // TODO: needs testing XWMHints *hint; if (!(hint=XGetWMHints(dpy,c->win))) return; if (!(hint->flags & (IconPixmapHint | IconMaskHint))) return; if (c->icon) { cairo_surface_destroy(c->icon); c->icon = NULL; } int w, h, ig, sz = conf.font_size; Window wig; XGetGeometry(dpy, hint->icon_pixmap, &wig, &ig, &ig, &w, &h, &ig, &ig); if (c->icon) cairo_surface_destroy(c->icon); cairo_surface_t *icon, *mask = NULL; icon = cairo_xlib_surface_create(dpy, hint->icon_pixmap, DefaultVisual(dpy,scr), w, h); if (hint->flags & IconMaskHint) //mask = cairo_xlib_surface_create(dpy, hint->icon_mask, // DefaultVisual(dpy,scr), w, h); mask = cairo_xlib_surface_create_for_bitmap(dpy, hint->icon_mask, DefaultScreenOfDisplay(dpy), w, h); c->icon = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, sz, sz); cairo_t *ctx = cairo_create(c->icon); cairo_scale(ctx, sz / (double) w, sz / (double) h); cairo_set_source_surface(ctx, icon, 0, 0); if (mask) cairo_mask_surface(ctx, mask, 0, 0); else cairo_paint(ctx); cairo_destroy(ctx); cairo_surface_destroy(icon); if (mask) cairo_surface_destroy(mask); return 0; } int get_name(Client *c) { static const char *noname = "(no name)"; Client *p; if (c->title && c->title != noname) XFree(c->title); |
Changes to stat.
1 2 3 4 |
#!/bin/bash # ridiculously simple example status script while :; do echo "&& $(date +%H:%M) &"; sleep 60; done |
| |
1 2 3 4 |
#!/bin/bash
# ridiculously simple example status script
while :; do echo "&& {I 11} $(date +%H:%M) &"; sleep 60; done
|