add memory
This commit is contained in:
parent
202f94f122
commit
78046cdcb2
2 changed files with 20 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ import Pywal from "./Pywal";
|
|||
import Tray from "./Tray";
|
||||
import SwayNC from "./SwayNC";
|
||||
import WirePlumber from "./WirePlumber";
|
||||
import Memory from "./Memory";
|
||||
|
||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
||||
|
|
@ -34,6 +35,7 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|||
<Pywal />
|
||||
<WirePlumber />
|
||||
<Internet />
|
||||
<Memory />
|
||||
<Calendar />
|
||||
<SwayNC />
|
||||
</box>
|
||||
|
|
|
|||
18
widget/Memory.tsx
Normal file
18
widget/Memory.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { bind, Variable } from "astal";
|
||||
|
||||
const Memory = function () {
|
||||
const usage = Variable(0).poll(
|
||||
1000,
|
||||
["bash", "-c", "free -m | grep Mem | awk '{print ($3/$2)*100}'"],
|
||||
(value) => Number(value),
|
||||
);
|
||||
|
||||
return (
|
||||
<label
|
||||
cssClasses={["Label"]}
|
||||
label={bind(usage).as((usage) => ` ${usage.toFixed()} %`)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export default Memory;
|
||||
Loading…
Add table
Reference in a new issue