Compare commits
2 commits
54f80f0da8
...
7ddf13eb62
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ddf13eb62 | ||
|
|
b5e0f47b80 |
2 changed files with 19 additions and 26 deletions
|
|
@ -31,29 +31,10 @@ Item {
|
||||||
implicitHeight: M.Theme.barHeight - 3 - _pad
|
implicitHeight: M.Theme.barHeight - 3 - _pad
|
||||||
|
|
||||||
readonly property int _pad: 6
|
readonly property int _pad: 6
|
||||||
|
property bool _hovered: false
|
||||||
|
|
||||||
// Shadow source — rendered offscreen, only its glow is visible
|
HoverHandler {
|
||||||
Rectangle {
|
onHoveredChanged: root._hovered = hovered
|
||||||
id: shadowSource
|
|
||||||
anchors.fill: parent
|
|
||||||
color: "transparent"
|
|
||||||
border.color: root.borderColor
|
|
||||||
border.width: 1
|
|
||||||
topLeftRadius: root._tlr
|
|
||||||
topRightRadius: root._trr
|
|
||||||
bottomLeftRadius: root._blr
|
|
||||||
bottomRightRadius: root._brr
|
|
||||||
visible: false
|
|
||||||
}
|
|
||||||
|
|
||||||
MultiEffect {
|
|
||||||
source: shadowSource
|
|
||||||
anchors.fill: shadowSource
|
|
||||||
shadowEnabled: true
|
|
||||||
shadowColor: root.borderColor
|
|
||||||
shadowBlur: 1.0
|
|
||||||
shadowVerticalOffset: 0
|
|
||||||
shadowHorizontalOffset: 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frosted base — semi-transparent so the bar background bleeds through
|
// Frosted base — semi-transparent so the bar background bleeds through
|
||||||
|
|
@ -104,7 +85,7 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visible border
|
// Visible border — glow on hover only
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
@ -114,6 +95,15 @@ Item {
|
||||||
topRightRadius: root._trr
|
topRightRadius: root._trr
|
||||||
bottomLeftRadius: root._blr
|
bottomLeftRadius: root._blr
|
||||||
bottomRightRadius: root._brr
|
bottomRightRadius: root._brr
|
||||||
|
|
||||||
|
layer.enabled: root._hovered
|
||||||
|
layer.effect: MultiEffect {
|
||||||
|
shadowEnabled: true
|
||||||
|
shadowColor: root.borderColor
|
||||||
|
shadowBlur: 1.0
|
||||||
|
shadowVerticalOffset: 0
|
||||||
|
shadowHorizontalOffset: 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|
|
||||||
|
|
@ -201,18 +201,21 @@ fn main() {
|
||||||
let stdout = io::stdout();
|
let stdout = io::stdout();
|
||||||
let mut out = io::BufWriter::new(stdout.lock());
|
let mut out = io::BufWriter::new(stdout.lock());
|
||||||
let mut prev: Vec<Sample> = vec![];
|
let mut prev: Vec<Sample> = vec![];
|
||||||
|
let mut freqs: Vec<f64> = vec![];
|
||||||
let mut tick = 0u64;
|
let mut tick = 0u64;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let t0 = Instant::now();
|
let t0 = Instant::now();
|
||||||
|
|
||||||
let curr = read_stat();
|
let curr = read_stat();
|
||||||
let freqs = read_core_freqs();
|
if tick.is_multiple_of(2) {
|
||||||
|
freqs = read_core_freqs();
|
||||||
|
emit_mem(&mut out);
|
||||||
|
}
|
||||||
emit_cpu(&mut out, &prev, &curr, &freqs);
|
emit_cpu(&mut out, &prev, &curr, &freqs);
|
||||||
prev = curr;
|
prev = curr;
|
||||||
|
|
||||||
if tick.is_multiple_of(2) {
|
if tick.is_multiple_of(4) {
|
||||||
emit_mem(&mut out);
|
|
||||||
emit_temp(&mut out);
|
emit_temp(&mut out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue