forked from enlightenment/efl
parent
6c084b19b0
commit
daa7b6c7e1
3 changed files with 129 additions and 14 deletions
@ -0,0 +1,115 @@ |
||||
// XXX: fix cc's |
||||
|
||||
group { name: "e/modules/procstats/border"; |
||||
max: 160 160; |
||||
min: 16 16; |
||||
script { |
||||
public message(Msg_Type:type, id, ...) { |
||||
if ((type == MSG_INT_SET) && (id == 1973)) { |
||||
new cpu_num, cpu, pages_total, pages; |
||||
new cp, cn, m500, mt; |
||||
new Float:x, Float:y; |
||||
|
||||
cpu_num = getarg(2); |
||||
cpu = getarg(3); |
||||
pages_total = getarg(4); |
||||
pages = getarg(5); |
||||
|
||||
cp = cpu; |
||||
if (cpu_num > 0) cn = cp / cpu_num; |
||||
else cn = cp; |
||||
|
||||
m500 = pages * 100 / 131072; // 512m of pages |
||||
if (pages_total > 0) mt = pages * 100 / pages_total; |
||||
else mt = m500; |
||||
|
||||
if (cp > 100) cp = 100; |
||||
if (cn > 100) cn = 100; |
||||
if (m500 > 100) m500 = 100; |
||||
if (mt > 100) mt = 100; |
||||
|
||||
custom_state(PART:"cpu_perc", "default", 0.0); |
||||
get_state_val(PART:"cpu_perc", STATE_REL2, x, y); |
||||
x = float(cp) / 100.0; |
||||
set_state_val(PART:"cpu_perc", STATE_REL2, x, y); |
||||
set_state(PART:"cpu_perc", "custom", 0.0); |
||||
|
||||
custom_state(PART:"cpu_num", "default", 0.0); |
||||
get_state_val(PART:"cpu_num", STATE_REL2, x, y); |
||||
x = float(cn) / 100.0; |
||||
set_state_val(PART:"cpu_num", STATE_REL2, x, y); |
||||
set_state(PART:"cpu_num", "custom", 0.0); |
||||
|
||||
custom_state(PART:"mem_500", "default", 0.0); |
||||
get_state_val(PART:"mem_500", STATE_REL2, x, y); |
||||
x = float(m500) / 100.0; |
||||
set_state_val(PART:"mem_500", STATE_REL2, x, y); |
||||
set_state(PART:"mem_500", "custom", 0.0); |
||||
|
||||
custom_state(PART:"mem_total", "default", 0.0); |
||||
get_state_val(PART:"mem_total", STATE_REL2, x, y); |
||||
x = float(mt) / 100.0; |
||||
set_state_val(PART:"mem_total", STATE_REL2, x, y); |
||||
set_state(PART:"mem_total", "custom", 0.0); |
||||
} |
||||
} |
||||
} |
||||
parts { |
||||
part { name: "base"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
aspect: 1.0 1.0; aspect_preference: BOTH; |
||||
color_class: "/dim/normal/procstats/border"; |
||||
} |
||||
} |
||||
part { name: "area"; type: SPACER; |
||||
scale: 1; |
||||
description { state: "default" 0.0; |
||||
rel.to: "base"; |
||||
rel1.offset: 2 2; |
||||
rel2.offset: -3 -3; |
||||
offscale; |
||||
} |
||||
} |
||||
part { name: "cpu_perc"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
rel.to: "area"; |
||||
rel1.relative: 0.0 0.00; |
||||
rel2.relative: 1.0 0.25; |
||||
color: 255 51 153 255; |
||||
} |
||||
} |
||||
part { name: "cpu_num"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
rel.to: "area"; |
||||
rel1.relative: 0.0 0.25; |
||||
rel2.relative: 1.0 0.50; |
||||
color: 255 153 51 255; |
||||
} |
||||
} |
||||
part { name: "mem_500"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
rel.to: "area"; |
||||
rel1.relative: 0.0 0.50; |
||||
rel2.relative: 1.0 0.75; |
||||
color: 153 255 51 255; |
||||
} |
||||
} |
||||
part { name: "mem_total"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
rel.to: "area"; |
||||
rel1.relative: 0.0 0.75; |
||||
rel2.relative: 1.0 1.00; |
||||
color: 51 153 255 255; |
||||
} |
||||
} |
||||
part { name: "over"; type: RECT; |
||||
description { state: "default" 0.0; |
||||
color: 0 0 0 0; // no cc |
||||
} |
||||
} |
||||
} |
||||
programs { |
||||
} |
||||
} |
||||
|
||||
|
Loading…
Reference in new issue