summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <eblima@gmail.com>2015-02-10 19:10:08 -0200
committerEduardo Lima (Etrunko) <eblima@gmail.com>2015-02-10 19:16:05 -0200
commit84e40245b989ed8e5ec8ae97072e1c7b9719f32d (patch)
tree96a6486fee6c2a38615ee50f3775c7c4b8e6d21e
parent65153abf6fc0505931d4a3058eff3265cd9d1d56 (diff)
Add indicators for minutes other than 5
Signed-off-by: Eduardo Lima (Etrunko) <eblima@gmail.com>
-rw-r--r--klok.edc56
1 files changed, 46 insertions, 10 deletions
diff --git a/klok.edc b/klok.edc
index a3d8694..e6e38d6 100644
--- a/klok.edc
+++ b/klok.edc
@@ -9,12 +9,17 @@ collections {
9 new Float:second; 9 new Float:second;
10 10
11 date(year, month, day, yearday, weekday, hour, minute, second); 11 date(year, month, day, yearday, weekday, hour, minute, second);
12 // Callback every 5 minutes 12
13 timer(60 * (4 - (minute % 5)) + 60.0 - second, "clock_cb", 1); 13 timer(60.0 - second, "clock_cb", 1);
14#define SHUTOFF(_name) \ 14#define SHUTOFF(_name) \
15 set_state(PART:"on_"_name, "hidden", 0.0); \ 15 set_state(PART:"on_"_name, "hidden", 0.0); \
16 set_state(PART:"off_"_name, "default", 0.0) 16 set_state(PART:"off_"_name, "default", 0.0)
17 17
18 SHUTOFF("topleft");
19 SHUTOFF("topright");
20 SHUTOFF("bottomleft");
21 SHUTOFF("bottomright");
22
18 SHUTOFF("l0.0"); 23 SHUTOFF("l0.0");
19 SHUTOFF("l1.0"); 24 SHUTOFF("l1.0");
20 SHUTOFF("l2.0"); 25 SHUTOFF("l2.0");
@@ -131,12 +136,14 @@ collections {
131 set_state(PART:"off_"_name, "hidden", 0.0); \ 136 set_state(PART:"off_"_name, "hidden", 0.0); \
132 set_state(PART:"on_"_name, "default", 0.0) 137 set_state(PART:"on_"_name, "default", 0.0)
133 138
139 // IT IS
134 SHUTON("l0.0"); 140 SHUTON("l0.0");
135 SHUTON("l1.0"); 141 SHUTON("l1.0");
136 SHUTON("l3.0"); 142 SHUTON("l3.0");
137 SHUTON("l4.0"); 143 SHUTON("l4.0");
144
145 // OCLOCK
138 if (0 <= minute && minute < 5) { 146 if (0 <= minute && minute < 5) {
139 // OCLOCK
140 SHUTON("l5.9"); 147 SHUTON("l5.9");
141 SHUTON("l6.9"); 148 SHUTON("l6.9");
142 SHUTON("l7.9"); 149 SHUTON("l7.9");
@@ -144,6 +151,21 @@ collections {
144 SHUTON("l9.9"); 151 SHUTON("l9.9");
145 SHUTON("la.9"); 152 SHUTON("la.9");
146 } 153 }
154
155 // MINUTES
156 if ((minute % 5) >= 1) {
157 SHUTON("topleft");
158 }
159 if ((minute % 5) >= 2) {
160 SHUTON("topright");
161 }
162 if ((minute % 5) >= 3) {
163 SHUTON("bottomleft");
164 }
165 if ((minute % 5) >= 4) {
166 SHUTON("bottomright");
167 }
168
147 if ((5 <= minute && minute < 10) 169 if ((5 <= minute && minute < 10)
148 || (25 <= minute && minute < 30) 170 || (25 <= minute && minute < 30)
149 || (35 <= minute && minute < 40) 171 || (35 <= minute && minute < 40)
@@ -368,10 +390,12 @@ collections {
368 align: 0.5 0.5; 390 align: 0.5 0.5;
369 aspect: 1.0 1.0; 391 aspect: 1.0 1.0;
370 aspect_preference: BOTH; 392 aspect_preference: BOTH;
393 rel1.relative: 0.08 0.08;
394 rel2.relative: 0.92 0.92;
371 } 395 }
372 } 396 }
373 397
374 #define LETTER(_name, _x0, _y0, _x1, _y1, _letter) \ 398 #define SYMBOL(_name, _x0, _y0, _x1, _y1, _off, _on, _rel) \
375 part { \ 399 part { \
376 name: "off_"_name; \ 400 name: "off_"_name; \
377 type: TEXT; \ 401 type: TEXT; \
@@ -383,11 +407,11 @@ collections {
383 step: 10 11; \ 407 step: 10 11; \
384 rel1 { \ 408 rel1 { \
385 relative: _x0 _y0; \ 409 relative: _x0 _y0; \
386 to: "bg.square"; \ 410 to: _rel; \
387 } \ 411 } \
388 rel2 { \ 412 rel2 { \
389 relative: _x1 _y1; \ 413 relative: _x1 _y1; \
390 to: "bg.square"; \ 414 to: _rel; \
391 } \ 415 } \
392 text { \ 416 text { \
393 font: "Sans:style=Mono"; \ 417 font: "Sans:style=Mono"; \
@@ -395,7 +419,7 @@ collections {
395 min: 1 1; \ 419 min: 1 1; \
396 fit: 0 1; \ 420 fit: 0 1; \
397 align: 0.5 0.5; \ 421 align: 0.5 0.5; \
398 text: _letter; \ 422 text: _off; \
399 text_class: "klok_letter"; \ 423 text_class: "klok_letter"; \
400 } \ 424 } \
401 } \ 425 } \
@@ -417,11 +441,11 @@ collections {
417 step: 10 11; \ 441 step: 10 11; \
418 rel1 { \ 442 rel1 { \
419 relative: _x0 _y0; \ 443 relative: _x0 _y0; \
420 to: "bg.square"; \ 444 to: _rel; \
421 } \ 445 } \
422 rel2 { \ 446 rel2 { \
423 relative: _x1 _y1; \ 447 relative: _x1 _y1; \
424 to: "bg.square"; \ 448 to: _rel; \
425 } \ 449 } \
426 text { \ 450 text { \
427 font: "Sans:style=Mono"; \ 451 font: "Sans:style=Mono"; \
@@ -429,7 +453,7 @@ collections {
429 min: 1 1; \ 453 min: 1 1; \
430 fit: 0 1; \ 454 fit: 0 1; \
431 align: 0.5 0.5; \ 455 align: 0.5 0.5; \
432 text: _letter; \ 456 text: _on; \
433 text_class: "klok_letter"; \ 457 text_class: "klok_letter"; \
434 } \ 458 } \
435 } \ 459 } \
@@ -440,6 +464,18 @@ collections {
440 } \ 464 } \
441 } 465 }
442 466
467 #define DOT(_name, _x0, _y0, _x1, _y1) \
468 SYMBOL(_name, _x0, _y0, _x1, _y1, "○", "●", "bg")
469
470 // MINUTES INDICATION
471 DOT("topleft", 0.03, 0.03, 0.07, 0.07)
472 DOT("topright", 0.93, 0.03, 0.97, 0.07)
473 DOT("bottomleft", 0.03, 0.93, 0.07, 0.97)
474 DOT("bottomright", 0.93, 0.93, 0.97, 0.97)
475
476 #define LETTER(_name, _x0, _y0, _x1, _y1, _letter) \
477 SYMBOL(_name, _x0, _y0, _x1, _y1, _letter, _letter, "bg.square")
478
443 LETTER("l0.0", 0, 0, 0.091, 0.1, "I") 479 LETTER("l0.0", 0, 0, 0.091, 0.1, "I")
444 LETTER("l1.0", 0.091, 0, 0.182, 0.1, "T") 480 LETTER("l1.0", 0.091, 0, 0.182, 0.1, "T")
445 LETTER("l2.0", 0.182, 0, 0.273, 0.1, "L") 481 LETTER("l2.0", 0.182, 0, 0.273, 0.1, "L")