summaryrefslogtreecommitdiff
path: root/data/elementary/themes/edc/cpumonitor.edc
blob: ebe42bb750043b340a87eef6250d2485f1d6271f (plain)
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
87
88
group { name: "e/modules/cpumonitor/main";
   image: "cpu_bar.png" COMP;
   image: "cpu_green_on.png" COMP;
   image: "cpu_yellow_on.png" COMP;
   image: "cpu_red_on.png" COMP;
   script {
      public message(Msg_Type:type, id, ...) {
         if ((type == MSG_INT_SET) && (id == 1)) {
            new val = getarg(2);
            if (val > (100 / 7 * 1)) set_state(PART:"led1", "on",  0.0);
            else                     set_state(PART:"led1", "off", 0.0);
            if (val > (100 / 7 * 2)) set_state(PART:"led2", "on",  0.0);
            else                     set_state(PART:"led2", "off", 0.0);
            if (val > (100 / 7 * 3)) set_state(PART:"led3", "on",  0.0);
            else                     set_state(PART:"led3", "off", 0.0);
            if (val > (100 / 7 * 4)) set_state(PART:"led4", "on",  0.0);
            else                     set_state(PART:"led4", "off", 0.0);
            if (val > (100 / 7 * 5)) set_state(PART:"led5", "on",  0.0);
            else                     set_state(PART:"led5", "off", 0.0);
            if (val > (100 / 7 * 6)) set_state(PART:"led6", "on",  0.0);
            else                     set_state(PART:"led6", "off", 0.0);
         }
      }
   }
   parts {
      part { name: "bg";
         desc { "default";
            aspect: (10 / 54) (10 / 54);
            aspect_preference: BOTH;
            image.normal: "cpu_bar.png";
         }
         part { name: "led1";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 5);
               rel2.relative: 1.0 (1.0 / 6 * 6);
               image.normal: "cpu_green_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
         part { name: "led2";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 4);
               rel2.relative: 1.0 (1.0 / 6 * 5);
               image.normal: "cpu_green_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
         part { name: "led3";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 3);
               rel2.relative: 1.0 (1.0 / 6 * 4);
               image.normal: "cpu_green_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
         part { name: "led4";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 2);
               rel2.relative: 1.0 (1.0 / 6 * 3);
               image.normal: "cpu_yellow_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
         part { name: "led5";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 1);
               rel2.relative: 1.0 (1.0 / 6 * 2);
               image.normal: "cpu_yellow_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
         part { name: "led6";
            desc { "default"; hid;
               rel1.relative: 0.0 (1.0 / 6 * 0);
               rel2.relative: 1.0 (1.0 / 6 * 1);
               image.normal: "cpu_red_on.png";
            }
            desc { "on";  inherit: "default"; vis; }
            desc { "off"; inherit: "default"; hid; }
         }
      }
   }
}